Skip to content

Add posibility to disable entire rules via config file#279

Merged
AndreiDurlea merged 17 commits intobemanproject:mainfrom
AndreiDurlea:andreidurlea-ignored-rules
Apr 30, 2026
Merged

Add posibility to disable entire rules via config file#279
AndreiDurlea merged 17 commits intobemanproject:mainfrom
AndreiDurlea:andreidurlea-ignored-rules

Conversation

@AndreiDurlea
Copy link
Copy Markdown
Member

@AndreiDurlea AndreiDurlea commented Apr 25, 2026

#278
also intended to provide a clean way to solve #241 (disabling readme.title on beman.exemplar)
Designed it as such:

(from README.md)
beman-tidy attempts to read configuration for each source file from a .beman-tidy.yaml file located in the root of your repository. You can also specify a custom configuration file path using the --config option.

The following configuration options may be used in a .beman-tidy.yaml file:

[...]

  • disabled_rules - A list of rule names (or patterns) to be completely skipped during checks.

    • To disable a specific rule, provide its exact name (e.g., readme.title).
    • To disable all rules in a category, use a glob pattern with * (e.g., readme.* to skip all readme checks).
    • To disable a specific rule across all categories, use *.rule_name (e.g., *.title).
    • Unknown patterns that don't match any known rule will produce a warning and be skipped.
    • Disabled rules appear as "disabled" in the summary and are excluded from coverage calculations.
  • Example:

    disabled_rules:
      # Disable a single rule
      - readme.title
    
      # Disable all readme checks
      - readme.*
    
      # Disable all rules named "title" across categories
      - "*.title"

@AndreiDurlea
Copy link
Copy Markdown
Member Author

@neatudarius cool logging update, used it here as well

@AndreiDurlea
Copy link
Copy Markdown
Member Author

I'm thinking about whether to mark the run as failed if a certain number of rules are ignored, or to make a parameter that makes the run without ignoring rules (and one that does the same for fies)
Maybe one that disregards the entire config file atp.
@neatudarius what do you think?

@AndreiDurlea AndreiDurlea marked this pull request as ready for review April 27, 2026 18:29
Comment thread beman_tidy/lib/utils/config.py Outdated
Comment thread beman_tidy/lib/pipeline.py Outdated
Copy link
Copy Markdown
Member

@neatudarius neatudarius left a comment

Choose a reason for hiding this comment

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

LGTM overall - please check logs from tools from root README.md

Comment thread beman_tidy/lib/pipeline.py Outdated
Comment thread beman_tidy/lib/pipeline.py Outdated
Comment thread beman_tidy/lib/pipeline.py Outdated
Comment thread beman_tidy/lib/pipeline.py Outdated
Comment thread beman_tidy/lib/pipeline.py Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
@AndreiDurlea
Copy link
Copy Markdown
Member Author

AndreiDurlea commented Apr 30, 2026

I'm thinking about whether to mark the run as failed if a certain number of rules are ignored, or to make a parameter that makes the run without ignoring rules (and one that does the same for fies)
Maybe one that disregards the entire config file atp.

Do we want this?

@neatudarius
Copy link
Copy Markdown
Member

I'm thinking about whether to mark the run as failed if a certain number of rules are ignored, or to make a parameter that makes the run without ignoring rules (and one that does the same for fies)
Maybe one that disregards the entire config file atp.

Do we want this?

You should just disabled the rule. And updates stats from end of run in the tool.

@AndreiDurlea
Copy link
Copy Markdown
Member Author

Alright, I'll leave it at just that

@AndreiDurlea AndreiDurlea force-pushed the andreidurlea-ignored-rules branch from 6a81761 to ec9796a Compare April 30, 2026 14:57
Copy link
Copy Markdown
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

Adds repository-configurable disabling of entire beman-tidy rules (including glob-style patterns), integrates disabled-rule handling into the pipeline output/coverage, and documents/tests the new behavior to support use cases like selectively skipping readme checks (e.g., beman.exemplar).

Changes:

  • Add disabled_rules config validation + pattern expansion logic in beman_tidy.lib.utils.config.
  • Update the pipeline to skip disabled checks, report them in the summary, and exclude them from coverage calculations.
  • Add unit tests for ignored-path matching and for disabled-rules validation/expansion; document the new config option in README.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
beman_tidy/lib/utils/config.py Adds disabled_rules validation and glob expansion helpers.
beman_tidy/lib/pipeline.py Skips disabled checks; updates summary + coverage calculations to account for disabled checks.
tests/lib/utils/test_config_disabled_rules.py Adds tests for disabled_rules validation, expansion, and load behavior.
tests/lib/utils/test_config_ignored_files.py Adds tests for ignored_paths matching behavior.
README.md Documents disabled_rules configuration usage and examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread beman_tidy/lib/pipeline.py
Comment thread beman_tidy/lib/pipeline.py Outdated
Comment thread beman_tidy/lib/utils/config.py Outdated
Comment thread beman_tidy/lib/utils/config.py Outdated
Comment thread beman_tidy/lib/utils/config.py Outdated
Comment thread README.md
@AndreiDurlea AndreiDurlea changed the title Add posibility to ignore entire rules via config file Add posibility to disable entire rules via config file Apr 30, 2026
@AndreiDurlea
Copy link
Copy Markdown
Member Author

phew, this should be it. shall we get this merged? @neatudarius

@AndreiDurlea AndreiDurlea merged commit 68f3ff0 into bemanproject:main Apr 30, 2026
6 checks passed
@AndreiDurlea AndreiDurlea deleted the andreidurlea-ignored-rules branch April 30, 2026 18:15
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