-
Notifications
You must be signed in to change notification settings - Fork 258
feat: automatically add local rubocop requires to config_files #2336
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
base: main
Are you sure you want to change the base?
Conversation
|
No issue mentions found. Please mention an issue in the pull request description. Use GitHub automation to close the issue when a PR is merged |
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.
Pull Request Overview
This PR automatically adds local RuboCop custom cop files to the config_files section in the Qlty configuration. The feature detects local custom cop file paths from RuboCop configuration files and includes them in the generated Qlty configuration.
Key Changes
- Added RuboCop configuration parsing to extract custom cop file paths from YAML configs
- Extended the plugin activation structure to support
config_filesfield - Modified the TOML renderer to output the
config_filessection for plugins
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
qlty-cli/src/initializer/scanner/rubocop_config.rs |
New module implementing custom cop file extraction from RuboCop YAML configurations |
qlty-cli/src/initializer/scanner.rs |
Added module declaration for the new rubocop_config module |
qlty-cli/src/initializer/renderer.rs |
Extended PluginActivation struct and TOML rendering to support config_files field |
qlty-cli/src/initializer/initializer.rs |
Added RuboCop-specific logic to detect and include custom cop files during initialization |
| Test files | Added integration test case demonstrating the feature with sample RuboCop configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Diff Coverage for macos-15: The code coverage on the diff in this pull request is 96.4%. Total Coverage for macos-15: This PR will increase coverage by 0.04%. File Coverage Changes
🛟 Help
|
|
Diff Coverage for ubuntu-latest: The code coverage on the diff in this pull request is 96.4%. Total Coverage for ubuntu-latest: This PR will increase coverage by 0.04%. File Coverage Changes
🛟 Help
|
1 new issue
|
| config_files = custom_cops; | ||
| } | ||
| } | ||
| } |
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.
I agree hard coding a RuboCop specific block into this file is problematic. We can discuss some ways to resolve tomorrow.
My initial idea is that we should handle this similar to the way that we handle customer parsers for plugins....
We can define a trait like CustomPluginEnabler with a TBD interface. Then we define a RuboCopEnabler impl CustomPluginEnabler for the RuboCop specific logic.
To bring it all together we would then add a new property to the TOML plugin definition like this:
custom_enabler = "rubocop" # Use custom enabling logic
This would open the door for us to add custom enablers for any plugin where it is valuable without breaking the abstraction.
| ..Default::default() | ||
| }; | ||
|
|
||
| // Get the plugin definition from scanner's sources_only_config |
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.
This comment matched the code in that it gets the plugin definition from the sources_only_config. Why do we do that?
(Ideally the comment should focus on the why and the code is self-explanatory for the what)
528c6df to
8625e0e
Compare
| if path.starts_with("./") || path.contains('/') { | ||
| // Remove leading ./ if present | ||
| let clean_path = path.strip_prefix("./").unwrap_or(path); | ||
| custom_cop_files.insert(clean_path.to_string()); |
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.
No description provided.