Skip to content

feat: support global excludes in .bec/rules.yaml #93

Closed

Description

@YasserYG8

Description:

Describe the Feature

Currently, developers must define exclude paths for each rule individually:

rules:
  - id: no-console-log
    paths: ["**/*.js"]
    exclude: ["node_modules/**", "dist/**", "vendor/**"]
    check: "becwright run forbid --pattern 'console.log'"

  - id: no-debugger
    paths: ["**/*.js"]
    exclude: ["node_modules/**", "dist/**", "vendor/**"]
    check: "becwright run forbid --pattern 'debugger'"

In larger codebases with many rules, this leads to significant configuration boilerplate and duplication. If a new folder needs to be ignored (e.g., build/), the developer has to update every single rule's exclude list.

We should introduce a global_exclude configuration block at the root of .bec/rules.yaml to define ignore patterns globally.


Proposed Design

Add support for a top-level global_exclude key in .bec/rules.yaml containing a list of glob patterns:

schema_version: 1

global_exclude:
  - "node_modules/**"
  - "dist/**"
  - "vendor/**"
  - "build/**"

rules:
  - id: no-console-log
    paths: ["**/*.js"]
    check: "becwright run forbid --pattern 'console.log'"

  - id: no-debugger
    paths: ["**/*.js"]
    check: "becwright run forbid --pattern 'debugger'"

Execution Flow / Rules Logic

  1. During execution, the engine compiles rules and file lists.
  2. For each rule, a file is matching if:
    • It matches one of the rule's paths globs.
    • It does not match any of the rule's local exclude globs.
    • It does not match any of the global_exclude globs defined at the file root.
  3. Update the YAML schema file (schema/rules.schema.json) to validate the new global_exclude key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions