bug: RulesEngine.check breaks after first matching rule per file

Open Beginner friendly
#56 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
tooling

Research direction

Start in src/diff_contract/engine.py at RulesEngine.check and inspect the existing test suite for rule matching. Add coverage for a file matching three rules, then run the existing tests and confirm that all three violations are reported while current behavior remains intact.

Written by the indexing model from the issue text.

Description

bug

Context

In RulesEngine.check in src/diff_contract/engine.py, the inner loop has break after the first matching rule for a file.

Problem

If a file matches multiple rules (e.g., both a deny rule and an allow rule), only the first violation is reported. The user sees an incomplete picture of all contract violations, which could mask additional issues.

Impact

  • Incomplete violation reporting: users miss multiple contract breaches per file
  • Security risk: a second denied change goes unreported
  • Debugging difficulty: must re-run after fixing first violation to discover others

Suggested Fix

Remove the break to collect all violations per file, or add a configuration option to control this behavior.

Acceptance Criteria

  • A file matching 3 rules produces 3 violations (not 1)
  • Existing tests pass
  • New tests cover multi-rule matching
Dominant language
Python
Stars
1
Forks
3
Avg merge
8h 23m
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yunaremaia/diff-contract

All issues in yunaremaia/diff-contract

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.