-
Notifications
You must be signed in to change notification settings - Fork 229
Allow run RubyCritic outside of project #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow run RubyCritic outside of project #527
Conversation
6916e81 to
9ccf3d6
Compare
|
@etagwerker It would be nice if you could review and merge these changes. CI was fixed in this PR #526 if you merge that PR, I can rebase, and all should be good. Thanks! |
|
Hey @JuanVqz could you rebase this PR on top of the latest main please? |
9ccf3d6 to
1216374
Compare
| # :reek:DuplicateMethodCall | ||
| # :reek:NilCheck | ||
| def self.supported? | ||
| git('branch 2>&1') && $CHILD_STATUS.success? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFI: This was the main reason we could not run the RubyCritic command outside of the project; the Git class checks for the existence of git in the current path (pwd), and if it exists, it returns a supported? value as true.
3e53edf to
f4967b1
Compare
|
Hey @fbuys, This is ready for review :) |
fbuys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I tested it locally on different projects and it works as expected.
Context
Previously, obtaining the
churnvalue required running therubycriticcommand from within the project directory, as it depended on being in a.gitcontext. This limitation prevented running the command from outside the project.This PR addresses the issue by inspecting
RubyCritic::Config.pathsto locate the project root—identified by the presence of a.gitdirectory. Thechurncontext is then established from this root directory, allowing therubycriticcommand to be executed from any location, not just within the project directory.This change improves flexibility and usability for users running
rubycritic.Check list:
I didn't do it but you can do it when merging into main, is that fine?