refactorfirst / RefactorFirst

Identifies and prioritizes God Classes and Highly Coupled classes in Java codebases you should refactor first.
Apache License 2.0
360 stars 39 forks source link

Provide CLI version #21

Open jimbethancourt opened 2 years ago

jimbethancourt commented 2 years ago

@aalmiray suggested the idea of a CLI version: https://twitter.com/aalmiray/status/1417549718419300358?s=20 Let's do it! Table output could be generated on the command line using one of the libraries mentioned on https://github.com/akullpp/awesome-java#cli

Adding to SDKMan will be taken up in a separate issue - let's get this done first.

icougil commented 2 years ago

That will be amazing! Basically, I'd like to try RefactorFirst with some projects, and using it via CLI will be so easy, because then I'll not need to change any dependency or start using maven (for example, if the project is managed via gradle, etc)

aalmiray commented 2 years ago

I can certainly craft a PR to get the base code in place however @jimbethancourt I'm afraid this will require some knowledge transfer for both Maven and PicoCLI. If it's OK with you I can work on a PR, set it as draft, then we review together (Zoom or other) til you're satisfied.

jimbethancourt commented 2 years ago

You're too kind to offer @aalmiray! I came across https://github.com/remkop/picocli/tree/master/picocli-spring-boot-starter -- I'm pretty familiar with Spring Boot and the Spring beans could be used in both the CLI and webapp versions (unless you think this won't make things easier and makes you wince 😆).

aalmiray commented 2 years ago

Oh goodie, yes, if you'd like to continue using PicoCLI + Spring then sure, let's go. I was thinking more into the particular setup for Maven modules, crafting a release likely using GitHub Actions, and other stuff.

aalmiray commented 2 years ago

FWIW here's a sample Spring Boot project (no PicoCLI at the moment) that shows the minimum settings for packaging as native executables (with GraalVM Native Image), generate all executables with GitHub Actions, and releasing with JReleaser

https://github.com/aalmiray/sb-cli

Should you want to keep the CLI as regular Java instead of native executable then I'll have to make asime adjustments 😉

jimbethancourt commented 2 years ago

Thank you @aalmiray! This is great! I was thinking of using the Spring Native plugin -- I've done some work with it before and I'm somewhat familiar with it. I'll give it a go soon 😄

d4c4nf3 commented 1 year ago

Hello, I have created a draft pull request where I started to refactor the code, so reporting logic could be reused in maven/gradle plugins or CLI application. I did not change any behavior, just migrated some classes to a new module, and stripped away maven-core logic from classes that generate reports. It would be nice if you could review this code for now, so that I know I am on the right track before I continue making CLI application.