Skip to content

Support 'exclude' globs in rules #11

Description

@DataDave-Dev

Context

A rule's paths is include-only. To skip a subdirectory you have to enumerate
includes (e.g. src/becwright/*.py to avoid checks/). An exclude list would
be cleaner and would directly address the "self-reference" scoping problem (a
text check cannot run over its own source — see
documentation/writing-checks.md).

Proposed approach

  • Add an optional exclude: [globs] field to the Rule model in rules.py.
  • In engine.py, after matching a file against paths, drop it if it matches any
    exclude glob.
  • Reuse the existing matches() / _glob_to_regex() helpers in engine.py.

Acceptance criteria

  • A rule with paths + exclude runs only on (included minus excluded) files.
  • Tests cover the exclusion.
  • Documented in documentation/usage.md (and its Spanish variant).

Notes

This adds a field to the rules format — please confirm the design in this issue
before implementing.

Relevant files

src/becwright/rules.py, src/becwright/engine.py, documentation/usage.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions