refactorfirst / RefactorFirst

Identifies and prioritizes God Classes Highly Coupled classes, and Class Cycles in Java codebases you should refactor first.
Apache License 2.0
457 stars 42 forks source link

Provide CLI verion #66

Closed d4c4nf3 closed 1 year ago

d4c4nf3 commented 1 year ago

Closes #21 Refactor maven plugin module so that it only contains logic for maven plugin. Migrate code for generating reports to a separate module so it can be reused in maven/gradle plugins or CLI application.

ghost commented 1 year ago
👇 Click on the image for a new way to code review #### [![Review these changes using an interactive CodeSee Map](https://s3.us-east-2.amazonaws.com/maps.codesee.io/images/github/jimbethancourt/RefactorFirst/66/17064b09/692dfbbc94531ea6844dc7c631af4562a6721f0a.svg)](https://app.codesee.io/r/reviews?pr=66&src=https%3A%2F%2Fgithub.com%2Fjimbethancourt%2FRefactorFirst) #### Legend CodeSee Map legend
jimbethancourt commented 1 year ago

Hi @Vojislav-Cuk! Thank you! It looks like you put quite a bit of work into this! I'm currently working on converting the Maven plugin back into a MavenReport and upgrading the version of Doxia Site Renderer and related dependencies, but I think I can work around what you've done.

The pom.xml in the new report module will need to be source/target Java 8 compatible to remain backwards compatible with Java 8 users. It still makes up probably 40% of the market at this time, and they're the users who could probably benefit from this tool the most. I'm not certain, but it's possible that the CLI version can remain at Java 17 and use Spring Boot 3.

Jim

d4c4nf3 commented 1 year ago

Great. With this refactored it should not be hard to create CLI app now.

The pom.xml in the new report module will need to be source/target Java 8 compatible

This is something I wanted to ask. OK, I will change it to use java 8.

Do you have some idea how the CLI command should look like? The name of command and parameters?

jimbethancourt commented 1 year ago

Hi @Vojislav-Cuk, I apologize for not getting back to you sooner - it's looking great! As for the name: It might be a bit cheeky, but having the command as rf would be memorable

d4c4nf3 commented 1 year ago

I created it as refirst with this usage Usage: report [-d] [-b=] [-o=] [-p=] [-t=] [-v=] Generate a report -b, --base-dir= Base directory of the project -d, --details Show detailed report -o, --output= Output directory -p, --project= Project name -t, --type= Report type: HTML, JSON, CSV -v, --version= Project version It should not be hard to change it any way you like. I decided not to use spring boot because it looked like an overkill for one simple command. Please just confirm if you are OK with the way I packaged the executable and named the parameters. I will change command name to rf.

d4c4nf3 commented 1 year ago

@jimbethancourt I have changed the command to rf. I also added reading project name and version from pom.xml file if those arguments are not already set. During package stage, rf sh script is created as executable jar. Parameters of rf commands are the ones from my message above.