Skip to content

Conversation

@JuanVqz
Copy link
Contributor

@JuanVqz JuanVqz commented Jul 23, 2025

Context

Previously, obtaining the churn value required running the rubycritic command from within the project directory, as it depended on being in a .git context. This limitation prevented running the command from outside the project.

This PR addresses the issue by inspecting RubyCritic::Config.paths to locate the project root—identified by the presence of a .git directory. The churn context is then established from this root directory, allowing the rubycritic command to be executed from any location, not just within the project directory.

This change improves flexibility and usability for users running rubycritic.

Check list:

@JuanVqz JuanVqz force-pushed the feature/run-rubycritic-from-outside branch 4 times, most recently from 6916e81 to 9ccf3d6 Compare July 24, 2025 00:08
@JuanVqz
Copy link
Contributor Author

JuanVqz commented Jul 24, 2025

@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!

@JuanVqz JuanVqz marked this pull request as ready for review July 24, 2025 00:11
@fbuys
Copy link
Collaborator

fbuys commented Jul 28, 2025

Hey @JuanVqz could you rebase this PR on top of the latest main please?

@JuanVqz JuanVqz force-pushed the feature/run-rubycritic-from-outside branch from 9ccf3d6 to 1216374 Compare July 28, 2025 22:35
# :reek:DuplicateMethodCall
# :reek:NilCheck
def self.supported?
git('branch 2>&1') && $CHILD_STATUS.success?
Copy link
Contributor Author

@JuanVqz JuanVqz Jul 28, 2025

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.

@JuanVqz JuanVqz force-pushed the feature/run-rubycritic-from-outside branch from 3e53edf to f4967b1 Compare July 28, 2025 22:55
@JuanVqz
Copy link
Contributor Author

JuanVqz commented Jul 28, 2025

Hey @fbuys, This is ready for review :)

Copy link
Collaborator

@fbuys fbuys left a 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.

@fbuys fbuys merged commit 358f600 into whitesmith:main Jul 30, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants