Skip to content

An IntelliJ IDEA plugin that discovers performed refactorings in the commit history of the project and visualizes them

License

Notifications You must be signed in to change notification settings

juliabeliaeva/refactorinsight

 
 

Repository files navigation

RefactorInsight Icon RefactorInsight

JB Research License pipeline status Downloads

RefactorInsight is a plugin for IntelliJ IDEA that enhances the representation of code changes with refactoring information in Java and Kotlin projects. RefactorInsight relies on RefactoringMiner and kotlinRMiner for retrieval of refactorings.

The plugin is compatible with IntelliJ IDEA 2023.1 and is available for free on JetBrains Marketplace.

Table of contents

Features

Smart diff

RefactorInsight labels code diffs with information about performed refactorings. It shows close to refactoring changes and opens the corresponding code diff by click.

Code Diff

To make reviewing bug fixes or new features easier, the plugin auto folds refactorings in code diffs and shows hints with short descriptions of each refactoring. Currently, it works for the following refactoring types: Move Method, Pull Up/Push Down Method, Extract Method, and Inline Method.

Example

Refactorings in commits

To see refactorings in your Git repository, go to the Git tab in IntelliJ IDEA and click the toggle button on the right.

Click a commit and then the to see the refactorings detected in that commit. It looks like this:

Example

Refactorings in pull requests

To see the refactorings in a specific pull request, go to the Pull Requests tab in IntelliJ IDEA, select any pull request and click .

PullRequests

Refactoring history of an object

To see the refactoring history of a method, class, or attribute, right-click the object's signature and select Check Refactoring History. Here is an example for a method named Repl:

RefactoringHistory

Double-click a leaf node in the tree to open the VCS log at that specific commit and see a list of detected refactorings in that commit.

Settings

By default, for performance reasons, refactorings are only retrieved from the last 100 commits in the project history. This number can be adjusted in the plugin's settings. Alternatively, you can use Mine All Refactorings on the Tools menu to go through all commits in the history of your project. The plugin also keeps track of new commits and processes them.

Build instructions

You need to install Java 17 and IntelliJ IDEA. The project structure consists of several modules:

  • common — adapters for entities from RefactoringMiner and kotlinRMiner;
  • java-impl — handlers of refactorings performed in Java;
  • kotlin-impl — handlers of refactorings performed in Kotlin;
  • plugin — UI components (actions, toggles, diffs);
  • runner — runners for refactoring detection that could be used in external plugins.

Available Run configurations could be found in Gradle → Run Configurations:

  • Build Plugin — builds the plugin;
  • Run Plugin — runs an IDE instance with pre-installed plugin.

Contribution and feedback

You are welcome to submit a bug report or suggest a feature: open an issue. Pull requests are also welcome and encouraged.

For more information about the tool on which RefactorInsight relies to identify refactorings, read RefactoringMiner 2.0.

Citing RefactorInsight

A paper about RefactorInsight was presented at ASE'21. If you use RefactorInsight in your academic work, please cite it.

@article{kurbatova2021refactorinsight,
  title={Refactorinsight: Enhancing ide representation of changes in git with refactorings information},
  author={Kurbatova, Zarina and Kovalenko, Vladimir and Savu, Ioana and Brockbernd, Bob and Andreescu, Dan 
  and Anton, Matei and Venediktov, Roman and Tikhomirova, Elena and Bryksin, Timofey},
  journal={arXiv preprint arXiv:2108.11202},
  year={2021}
}

About

An IntelliJ IDEA plugin that discovers performed refactorings in the commit history of the project and visualizes them

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 92.9%
  • Shell 5.5%
  • Perl 1.1%
  • Kotlin 0.5%