Skip to content

feat(engine): add inline suppression via archgate-ignore comments#383

Merged
rhuanbarreto merged 1 commit into
mainfrom
claude/hardcore-bassi-af1f98
May 29, 2026
Merged

feat(engine): add inline suppression via archgate-ignore comments#383
rhuanbarreto merged 1 commit into
mainfrom
claude/hardcore-bassi-af1f98

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • New engine feature: archgate-ignore inline comments that suppress individual rule violations in source code, without modifying the rule itself
  • New documentation: "Opt-out directives" section in the writing-rules guide and "Inline suppression" section in the rule-api reference, across all 3 locales (EN, pt-BR, nb)
  • 27 new tests for the suppression parser and filter logic, plus 5 integration tests in runner and reporter suites

Syntax

// archgate-ignore ARCH-006/no-unapproved-deps legacy dep, migration planned
import chalk from "chalk";

// archgate-ignore-file ARCH-005/test-mirrors-src generated file, no manual test

// Stack multiple comments to suppress more than one rule on the same line:
// archgate-ignore ARCH-006/no-unapproved-deps legacy dep
// archgate-ignore ARCH-003/use-style-text third-party lib handles colors
import chalk from "chalk";

Key behaviors

  • Next-line scope: suppresses the violation on the immediately following line
  • File-level scope: archgate-ignore-file suppresses all matching violations anywhere in the file
  • Reason required: a suppression without a reason is ignored and emits a warning
  • Stacked comments: consecutive suppression comments all target the first non-suppression line (no limit on how many)
  • Unused suppression warnings: comments that don't match any violation produce warnings
  • Markdown-aware: examples inside fenced code blocks in .md/.mdx files are not parsed as real suppressions
  • Comment styles: supports both // and # (TypeScript, YAML, Python, shell, etc.)

Changed files

File Change
src/engine/suppressions.ts New — parsing + filtering logic
src/engine/runner.ts Integrates suppression post-processing after rule execution
src/engine/reporter.ts Displays suppressed count and suppression warnings in all output formats
src/engine/context.ts Extends EMPTY_SUMMARY with suppressed and suppressionWarnings
tests/engine/suppressions.test.ts New — 27 tests
tests/engine/runner.test.ts 3 integration tests for suppression flow
tests/engine/reporter.test.ts 2 tests for buildSummary suppression fields
tests/commands/check-action.test.ts Updated mock data for new fields
docs/**/writing-rules.mdx "Opt-out directives" section (EN, pt-BR, nb)
docs/**/rule-api.mdx "Inline suppression" section (EN, pt-BR, nb)
docs/public/llms-full.txt Regenerated

Test plan

  • bun run validate passes (lint, typecheck, format, 1250 tests, 39/39 ADR rules)
  • Stacked suppression comments (2+) all target the correct line
  • Missing reason leaves violation active and emits warning
  • Unused suppression produces warning
  • File-level suppression covers violations without line numbers
  • Markdown code block examples in docs are not parsed
  • All 3 locales (EN, pt-BR, nb) have matching doc updates

Add engine-level inline suppression so developers can suppress individual
rule violations in source code without modifying the rule itself.

Syntax:
  // archgate-ignore ADR-ID/rule-id reason text
  // archgate-ignore-file ADR-ID/rule-id reason text

Key behaviors:
- Next-line scope: suppresses the violation on the immediately following line
- File-level scope: suppresses all matching violations anywhere in the file
- Reason is required — missing reason ignores the suppression and emits a warning
- Stacked comments: consecutive suppression comments all target the first
  non-suppression line, so multiple rules can be suppressed on one line
- Unused suppressions produce warnings to prevent stale exceptions
- Markdown code block awareness: examples in .md/.mdx docs are not parsed
- Supports both // and # comment styles (TS, YAML, Python, shell, etc.)

New files:
- src/engine/suppressions.ts — parsing + filtering logic
- tests/engine/suppressions.test.ts — 27 tests

Modified:
- runner.ts — integrates suppression post-processing after rule execution
- reporter.ts — displays suppressed count and suppression warnings
- context.ts — extends EMPTY_SUMMARY with new fields

Docs:
- Added "Opt-out directives" section to writing-rules guide (EN, pt-BR, nb)
- Added "Inline suppression" section to rule-api reference (EN, pt-BR, nb)
- Regenerated llms-full.txt

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4441795
Status: ✅  Deploy successful!
Preview URL: https://e1f36086.archgate-cli.pages.dev
Branch Preview URL: https://claude-hardcore-bassi-af1f98.archgate-cli.pages.dev

View logs

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.3% (6735 / 7458)
Threshold 90% minimum — met
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.0% 2082 / 2365
src/engine/ 93.1% 1379 / 1481
src/formats/ 100.0% 141 / 141
src/helpers/ 90.3% 3133 / 3471

@rhuanbarreto rhuanbarreto merged commit 1240860 into main May 29, 2026
19 checks passed
@rhuanbarreto rhuanbarreto deleted the claude/hardcore-bassi-af1f98 branch May 29, 2026 21:30
@archgatebot archgatebot Bot mentioned this pull request May 29, 2026
rhuanbarreto pushed a commit that referenced this pull request May 30, 2026
# archgate

## [0.42.0](v0.41.1...v0.42.0)
(2026-05-30)

### Features

* **engine:** add inline suppression via archgate-ignore comments
([#383](#383))
([1240860](1240860))

### Bug Fixes

* **deps:** resolve dependency dashboard deprecation and lookup warnings
([#387](#387))
([18eae44](18eae44)),
closes [#107](#107)
* **docs:** restore Norwegian Bokmål diacritical marks across nb/ locale
([#384](#384))
([ef98b39](ef98b39))
* **shims,docs:** resolve CodeQL and AI code quality findings
([#388](#388))
([63ec93f](63ec93f))

---
This PR was generated with
[simple-release](https://github.com/TrigenSoftware/simple-release).

<details>
<summary>📄 Cheatsheet</summary>
<br>



You can configure the bot's behavior through a pull request comment
using the `!simple-release/set-options` command.

### Command Format

````md
!simple-release/set-options

```json
{
  "bump": {},
  "publish": {}
}
```
````

### Useful Parameters

#### Bump

| Parameter | Type | Description |
|-----------|------|-------------|
| `version` | `string` | Force set specific version |
| `as` | `'major' \| 'minor' \| 'patch' \| 'prerelease'` | Release type
|
| `prerelease` | `string` | Pre-release identifier (e.g., "alpha",
"beta") |
| `firstRelease` | `boolean` | Whether this is the first release |
| `skip` | `boolean` | Skip version bump |
| `byProject` | `Record<string, object>` | Per-project bump options for
monorepos |

#### Publish

| Parameter | Type | Description |
|-----------|------|-------------|
| `skip` | `boolean` | Skip publishing |
| `access` | `'public' \| 'restricted'` | Package access level |
| `tag` | `string` | Tag for npm publication |

### Usage Examples

#### Force specific version

````md
!simple-release/set-options

```json
{
  "bump": {
    "version": "2.0.0"
  }
}
```
````

#### Force major bump

````md
!simple-release/set-options

```json
{
  "bump": {
    "as": "major"
  }
}
```
````

#### Create alpha pre-release

````md
!simple-release/set-options

```json
{
  "bump": {
    "prerelease": "alpha"
  }
}
```
````

#### Publish with specific access and tag

````md
!simple-release/set-options

```json
{
  "bump": {
    "prerelease": "beta"
  },
  "publish": {
    "access": "public",
    "tag": "beta"
  }
}
```
````

### Access Restrictions

The command can only be used by users with permissions:
- repository owner
- organization member
- collaborator

### Notes

- The last comment with `!simple-release/set-options` command takes
priority
- JSON must be valid, otherwise the command will be ignored
- Parameters apply only to the current release execution
- The command can be updated by editing the comment or adding a new one


</details>

<!--
  Please do not edit this comment.
  simple-release-pull-request: true
  simple-release-branch-from: release
  simple-release-branch-to: main
-->

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@archgatebot archgatebot Bot mentioned this pull request May 30, 2026
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.

1 participant