Skip to content

Add no-dayc suppression comments#67

Merged
nonprofittechy merged 6 commits into
mainfrom
issue-52-no-dayc-suppressions
Jul 10, 2026
Merged

Add no-dayc suppression comments#67
nonprofittechy merged 6 commits into
mainfrom
issue-52-no-dayc-suppressions

Conversation

@nonprofittechy

@nonprofittechy nonprofittechy commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Implemented # no-dayc finding suppression functionality (fixes #52).

Changes

  • Added Inline and Block Suppressions: Introduced # no-dayc: <codes> and # no-dayc-block: <codes>
    parsing in yaml_structure.py to allow suppressing specific findings within the YAML source.
  • Added Global Suppressions: Implemented a new --suppress command-line argument that accepts a comma-
    separated list of IDs or finding classes, suppressing them globally across all checked files.
  • Finding Class Support: Both in-source and global suppressions support filtering by specific finding
    classes (e.g. accessibility, style) in addition to precise IDs.
  • Documentation: Updated the README.md with comprehensive instructions and examples on how to utilize
    these new suppression features.
  • Tests: Added tests in test_yaml_structure.py covering inline and block suppressions and ensuring
    findings do not bleed across blocks.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a suppression mechanism for DAYamlChecker findings, allowing users to silence specific findings via # no-dayc / # no-dayc-block comments in YAML and via a new --suppress CLI flag.

Changes:

  • Added parsing and application of inline (# no-dayc: ...) and document-level (# no-dayc-block: ...) suppressions.
  • Added --suppress CLI argument to globally suppress findings by code or class.
  • Updated README and added tests for inline and block suppressions.

Reviewed changes

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

File Description
tests/test_yaml_structure.py Adds test cases for inline and document-level suppression behavior.
src/dayamlchecker/yaml_structure.py Implements suppression parsing/matching and wires it into string/file processing and CLI.
README.md Documents the new suppression syntax and CLI option.

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

Comment thread src/dayamlchecker/yaml_structure.py
Comment thread tests/test_yaml_structure.py
Comment thread src/dayamlchecker/yaml_structure.py Outdated
@nonprofittechy

Copy link
Copy Markdown
Member Author

additional commits to address the latest feedback:

  1. Decode Handling: Updated Path(...).read_text() to use encoding="utf-8" and correctly catch
    UnicodeDecodeError alongside OSError .
  2. Missing Class-Suppression Tests: Added comprehensive tests verifying that both inline and block directives
    correctly suppress findings by their finding class ( general , style , etc.).
  3. Line-less URL Findings: Modified the suppression logic so that URLIssue findings (which are inherently
    line-less) are successfully suppressed if they match an in-source # no-dayc-block: document suppression.
  4. Clarified Block Suppression Placement: Rather than complicating the parser to carry # no-dayc-block
    comments over document boundaries (across --- ), we opted to keep the implementation simple. The README.md
    has been updated to explicitly state that the # no-dayc-block: comment must be placed inside the document
    block (i.e., immediately after the --- marker).
  5. CLI --suppress Test Coverage Gap: Added tests to exercise the new CLI --suppress integration path,
    verifying it successfully suppresses runtime errors via main() .

@rajeswari1301 rajeswari1301 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me! Tested and works exactly as the README says and all the new tests pass.
One question, I want to understand if the inline # no-dayc comment get applied based on the finding's line or the line the comment itself is on? those aren't always the same when there are multiple code blocks.

@nonprofittechy

Copy link
Copy Markdown
Member Author

Looks good to me! Tested and works exactly as the README says and all the new tests pass. One question, I want to understand if the inline # no-dayc comment get applied based on the finding's line or the line the comment itself is on? those aren't always the same when there are multiple code blocks.

Inline ignore comments apply to the line that the comment appears on, which means you can't use it on all block types

@nonprofittechy nonprofittechy merged commit 62643e5 into main Jul 10, 2026
4 checks passed
@nonprofittechy nonprofittechy deleted the issue-52-no-dayc-suppressions branch July 10, 2026 19:21
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.

Add a test suppression mechanism

3 participants