Skip to content

Repository files navigation

Caprese

Caprese is a function-level change impact recommendation framework for Node.js applications. It supports three recommendation approaches:

  • Repository-based recommendation using frequent co-change pattern mining from software history
  • Dynamic recommendation using runtime dependency analysis
  • Hybrid recommendation combining both historical and runtime signals

Given a change set (i.e., a set of modified functions), Caprese produces a ranked Candidate Inspection Set (CIS) containing functions recommended for inspection.

This repository contains:

  • The implementation of Caprese
  • Scripts for extracting historical and dynamic dependencies
  • Experimental data used in our evaluation

Setup Overview

1- Install dependencies (check here)
2- Initialize the required constants (check here)
3- It's ready to go! (check here)

An artifact is also available here.


Install Dependencies

Dynamic Analysis

Install NodeProf

Caprese uses NodeProf for its dynamic analysis phase. NodeProf is an efficient instrumentation and profiling framework for Graal.js.

To install nodeProf, You can follow this instruction.

NodeProf is available under Apache License, Version 2.0

Other Dependencies

Change your directory to "DA/", then run npm install in order to install other dependencies.

Frequent Pattern Detection

Install RefDiff

Caprese uses a changed version of Refdiff to detect the changed entities.

RefDiff originally is a tool to mine refactorings in the commit history of git repositories. In Caprese we changed it to detect changed entities between two different revisions.

To install RefDiff, first, make sure you have git and java > 8 installed in your system. Also, set the JAVA_HOME environment variable to point to the installation directory of the desired JDK. Then, change your directory to "refdiff/" and use gradlew to install Refdiff.

Install Maven

Install the latest version of Maven, if you do not have it installed already.


Run

Needs a bit of coding action

After installing all dependencies, you should initialize the required constants in "Caprese/constants.js". The customizable variables include the followings:

  • REPO_URL: Repository url
  • REPO_MAIN_BRANCH: The main branch’s name
  • REPO_TEST_RELATIVE_DIR: The relative path of the test directory
  • REPO_TEST_EXCLUDED_DIRS: the test paths to be excluded from dynamic analysis
  • FPD_EXCLUDED_DIRS: the paths to be excluded from frequent pattern detection
  • SEED_COMMIT: the commit to start the analysis with
  • DATA_PATH: the storage path

You can also modify any other constants based on your unique needs, such as the digging depth of the repository.

Ready to go

Run the following command to extract dynamic dependencies:

node caprese.js da

Run the following command to extract sequences:

node caprese.js mine

After these commands, the following command can be used to get the impacted functions by a change set. In this command, the functions provided as input must be between double quotation marks, separated by space, and follow the naming format of functionName-filePath-firstLine-LastLine. If the function is anonymous, immediate, or arrow function, you should set the name as arrowAnonymousFunction. Also, if the change is in the main body of a file, not in any function, you should only mention the filePath.

  • An example of a list of functions: "getAssist-main/assist/getAssists.js-12-18 arrowAnonymousFunction-main/index.js-10-13 index.js"
node caprese.js detect "list of functions"

The output of this execution will be accessible in "Caprese/capreseResult.json" file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages