GithubHelp home page GithubHelp logo

hpjrvs / refactorfirst Goto Github PK

View Code? Open in Web Editor NEW

This project forked from refactorfirst/refactorfirst

0.0 0.0 0.0 400 KB

Tool for Java codebases that will help you identify the God Classes you should refactor first.

License: Apache License 2.0

Java 100.00%

refactorfirst's Introduction

RefactorFirst

This tool for Java codebases will help you identify the God Classes you should refactor first. The graph generated in the report will look similar to this one: image info

There are several ways to run the analysis on your codebase:

From The Command Line

Run the following command from the root of your project (the source code does not need to be built):

mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.3.0:report

As Part of a Build

Add the following to your project in the build section. showDetails will show God Class metrics and rankings in the generated table.

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.hjug.refactorfirst.plugin</groupId>
            <artifactId>refactor-first-maven-plugin</artifactId>
            <version>0.3.0</version>       
            <!-- optional -->
            <configuration>
                <showDetails>true</showDetails>
            </configuration>
        </plugin>
        ...
    </plugins>
</build>

As a Report

Add the following to your project in the reports section. Not supported as of Version 0.2.0 due to CVE-2020-13936

<reporting>
    <plugins>
        ...
        <plugin>
            <groupId>org.hjug.refactorfirst.plugin</groupId>
            <artifactId>refactor-first-maven-plugin</artifactId>
            <version>0.1.1</version>       
        </plugin>
        ...
    </plugins>
</reporting>

Viewing the Report

Once the plugin finishes executing (it may take a while for a large / old codebase), open the file target/site/refactor-first-report.html in the root of the project. It will contain a graph similar to the one above, and a table that lists God classes in the recommended order that they should be refactored. The classes in the top left of the graph are the easiest to refactor while also having the biggest positive impact to team productivity.

Additional Details

This plugin will work on both single module and multi-module Maven projects that have a typical Maven project layout.

This tool is based on the paper Prioritizing Design Debt Investment Opportunities by Nico Zazworka, Carolyn Seaman, and Forrest Shull. The presentation based on the paper is available at https://resources.sei.cmu.edu/asset_files/Presentation/2011_017_001_516911.pdf

Limitations

  • My time. This is a passion project and is developed in my spare time.

Feedback and Collaboration Welcome

There is still much to be done. Your feedback and collaboration would be greatly appreciated in the form of feature requests, bug submissions, and PRs.
If you find this plugin useful, please star this repository and share with your friends & colleagues and on social media.

Future Plans

  • Add a Gradle plugin.
  • Incorporate Unit Test coverage metrics to quickly identify the safety of refactoring a God class.
  • Incorporate bug counts per God class to the Impact (Y-Axis) calculation.
  • Incorporate more disharmonies from Object Oriented Metrics In Practice (Lanza and Marinescu, 2004).

Note:

If you are a user of Version 0.1.0 or 0.1.1, you may notice that the list of God classes found by the plugin has changed. This is due to changes in PMD.

Thank You! Enjoy!

refactorfirst's People

Contributors

jimbethancourt avatar chriswininger avatar actions-user avatar aalmiray avatar snyk-bot avatar aravindparappil46 avatar ciarant avatar jkschneider avatar nickebbitt avatar scottbob avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.