Skip to content

Conversation

@marschattha
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings August 20, 2025 23:24
@github-actions
Copy link
Contributor

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

@marschattha marschattha requested a review from brynary August 20, 2025 23:24
Copy link
Contributor

Copilot AI left a 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_files field
  • Modified the TOML renderer to output the config_files section 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.

@qltysh
Copy link
Contributor

qltysh bot commented Aug 20, 2025

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
Path File Coverage Δ Indirect
qlty-cli/src/initializer/custom_enabler.rs 100.0
qlty-cli/src/initializer/custom_enabler/rubocop_enabler.rs 95.6
qlty-cli/src/initializer/initializer.rs 4.6
qlty-cli/src/initializer/renderer.rs 0.1
qlty-coverage/src/ci/github.rs -0.3
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh
Copy link
Contributor

qltysh bot commented Aug 20, 2025

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
Path File Coverage Δ Indirect
qlty-check/src/executor.rs 16.6
qlty-check/src/executor/invocation_script.rs 2.1
qlty-check/src/executor/staging_area.rs 6.0
qlty-check/src/parser/clippy.rs 0.8
qlty-check/src/planner.rs 8.6
qlty-check/src/planner/config.rs -0.3
qlty-check/src/planner/config_files.rs 9.1
qlty-check/src/planner/plan.rs 4.8
qlty-check/src/settings.rs 7.3
qlty-cli/src/commands/check.rs 15.0
qlty-cli/src/commands/coverage/publish.rs 11.2
qlty-cli/src/commands/coverage/utils.rs 8.0
qlty-cli/src/initializer/custom_enabler.rs 100.0
qlty-cli/src/initializer/custom_enabler/rubocop_enabler.rs 95.6
qlty-cli/src/initializer/initializer.rs 10.4
qlty-cli/src/initializer/renderer.rs 0.1
qlty-config/src/config/builder.rs 3.6
qlty-config/src/migration.rs -0.5
qlty-config/src/migration/checks.rs -0.1
qlty-coverage/src/ci/buildkite.rs 0.2
qlty-coverage/src/ci/github.rs -0.3
qlty-coverage/src/git.rs 28.2
qlty-coverage/src/publish/planner.rs 2.3
qlty-coverage/src/transformer.rs -1.7
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh
Copy link
Contributor

qltysh bot commented Aug 20, 2025

1 new issue

Tool Category Rule Count
qlty Structure Deeply nested control flow (level = 5) 1

config_files = custom_cops;
}
}
}
Copy link
Member

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.

@marschattha marschattha requested a review from brynary September 1, 2025 19:29
..Default::default()
};

// Get the plugin definition from scanner's sources_only_config
Copy link
Member

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)

@marschattha marschattha force-pushed the ma/create_config_files_for_rubocop_requires branch from 528c6df to 8625e0e Compare October 9, 2025 17:25
Comment on lines +100 to +103
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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deeply nested control flow (level = 5) [qlty:nested-control-flow]

@marschattha marschattha requested a review from brynary October 9, 2025 17:49
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