Skip to content
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

Bundle the per-rule configurations/overrides #389

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jacobotb
Copy link
Contributor

@jacobotb jacobotb commented Jun 6, 2024

What problem are you trying to solve?

We have per-rule enable/disable, per-rule arguments, and per-rule severity/category overrides, all spread across three different objects that are initialized separately, passed separately, and used separately.

We will be adding more.

What is your solution?

This PR bundles those objects together so only one object needs to be initialized, and only one object needs to be passed to the 'analyze' function.

Since the analyze function takes one file name and a list of rules, we can avoid parsing the filename more than once. To that end, the RuleConfigProvider has a config_for_file function that generates a RuleConfig scoped to a particular file, with the file name all parsed up nicely. This is the object that is passed to the analyze function.

The RuleConfig then has functions to get argument values, severity, enable/disable status, etc., for any rule and for the file it was created for.

Alternatives considered

What the reviewer should know

@jacobotb jacobotb requested a review from jasonforal June 6, 2024 07:01
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.

None yet

1 participant