Ignoring Files
archlint provides several ways to exclude files or directories from analysis.
Global Ignore
The ignore section at the root of .archlint.yaml specifies files that should be completely skipped by all detectors.
ignore:
- '**/node_modules/**'
- '**/dist/**'
- '**/coverage/**'
- '**/tmp/**'
- '**/*.d.ts'.gitignore Support
By default, archlint automatically respects your .gitignore file. You don't need to duplicate these patterns in .archlint.yaml. If you want to disable this behavior, set git: { enabled: false }.
Per-Rule Ignore
You can exclude files from a specific detector using the exclude field inside the rules section. This is useful if you want a file to be analyzed by most detectors but skipped by one specific detector.
rules:
cycles:
exclude:
- '**/generated/**'
- '**/*.entity.ts'Path Overrides
For more complex logic (e.g., changing settings or disabling multiple rules for a specific directory), use the overrides section:
overrides:
- files: ['**/tests/**', '**/mocks/**']
rules:
complexity: off
god_module: off
large_file: mediumInline Ignore
You can ignore specific architectural smells directly in your source code using special comments. This is useful for suppressing warnings in exceptional cases.
Usage:
Both single-line (// archlint-...) and block comment (/* archlint-... */) syntaxes are supported for all patterns.
- Whole File: Add
// archlint-disableat the top of the file. - Current Line: Add
// archlint-disable-lineat the end of the line or on the line above. - Next Line: Use
// archlint-disable-next-linebefore the problematic line. - Blocks: Use
// archlint-disableand// archlint-enableto wrap a section of code.
Examples:
// archlint-disable * - Entire file uses legacy patterns
// Ignore all rules for the entire file
// prettier-ignore
// archlint-disable-next-line long-params - This legacy function requires many parameters
function processTransaction(id: string, amount: number, currency: string, date: Date, recipient: string, note: string) {
// Long params detector will be ignored only for this line
}
import { internal } from './private'; // archlint-disable-line layer_violation - Temporary exclusion for migration
/* archlint-disable complexity */
function legacyCode() {
// This block is ignored
}
/* archlint-enable complexity */You can specify multiple rules separated by commas or use * to ignore all rules.