lostconf 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -3
- package/README.md +17 -3
- package/dist/cli.js +1 -1
- package/dist/output/sarif.js +1 -1
- package/dist/parsers/alex.d.ts +10 -0
- package/dist/parsers/alex.d.ts.map +1 -0
- package/dist/parsers/alex.js +59 -0
- package/dist/parsers/alex.js.map +1 -0
- package/dist/parsers/ansible-lint.d.ts +8 -0
- package/dist/parsers/ansible-lint.d.ts.map +1 -0
- package/dist/parsers/ansible-lint.js +71 -0
- package/dist/parsers/ansible-lint.js.map +1 -0
- package/dist/parsers/brakeman.d.ts +8 -0
- package/dist/parsers/brakeman.d.ts.map +1 -0
- package/dist/parsers/brakeman.js +85 -0
- package/dist/parsers/brakeman.js.map +1 -0
- package/dist/parsers/buf.d.ts +8 -0
- package/dist/parsers/buf.d.ts.map +1 -0
- package/dist/parsers/buf.js +121 -0
- package/dist/parsers/buf.js.map +1 -0
- package/dist/parsers/bundler-audit.d.ts +11 -0
- package/dist/parsers/bundler-audit.d.ts.map +1 -0
- package/dist/parsers/bundler-audit.js +73 -0
- package/dist/parsers/bundler-audit.js.map +1 -0
- package/dist/parsers/commitlint.d.ts +8 -0
- package/dist/parsers/commitlint.d.ts.map +1 -0
- package/dist/parsers/commitlint.js +86 -0
- package/dist/parsers/commitlint.js.map +1 -0
- package/dist/parsers/eslint-flat.d.ts +9 -0
- package/dist/parsers/eslint-flat.d.ts.map +1 -0
- package/dist/parsers/eslint-flat.js +79 -0
- package/dist/parsers/eslint-flat.js.map +1 -0
- package/dist/parsers/index.d.ts +14 -0
- package/dist/parsers/index.d.ts.map +1 -1
- package/dist/parsers/index.js +55 -1
- package/dist/parsers/index.js.map +1 -1
- package/dist/parsers/lefthook.d.ts +8 -0
- package/dist/parsers/lefthook.d.ts.map +1 -0
- package/dist/parsers/lefthook.js +111 -0
- package/dist/parsers/lefthook.js.map +1 -0
- package/dist/parsers/lint-staged.d.ts +8 -0
- package/dist/parsers/lint-staged.d.ts.map +1 -0
- package/dist/parsers/lint-staged.js +74 -0
- package/dist/parsers/lint-staged.js.map +1 -0
- package/dist/parsers/oxlint.d.ts +8 -0
- package/dist/parsers/oxlint.d.ts.map +1 -0
- package/dist/parsers/oxlint.js +65 -0
- package/dist/parsers/oxlint.js.map +1 -0
- package/dist/parsers/pre-commit.d.ts +8 -0
- package/dist/parsers/pre-commit.d.ts.map +1 -0
- package/dist/parsers/pre-commit.js +95 -0
- package/dist/parsers/pre-commit.js.map +1 -0
- package/dist/parsers/reek.d.ts +8 -0
- package/dist/parsers/reek.d.ts.map +1 -0
- package/dist/parsers/reek.js +70 -0
- package/dist/parsers/reek.js.map +1 -0
- package/dist/parsers/sqlfluff.d.ts +10 -0
- package/dist/parsers/sqlfluff.d.ts.map +1 -0
- package/dist/parsers/sqlfluff.js +88 -0
- package/dist/parsers/sqlfluff.js.map +1 -0
- package/dist/parsers/yard-lint.d.ts +8 -0
- package/dist/parsers/yard-lint.d.ts.map +1 -0
- package/dist/parsers/yard-lint.js +97 -0
- package/dist/parsers/yard-lint.js.map +1 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.0] - 2026-01-26
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Support for 10 new popular linters and configuration tools:
|
|
14
|
+
- **ESLint Flat Config** (`eslint.config.json`) - New ESLint v9+ flat configuration format (JSON only)
|
|
15
|
+
- **Oxlint** (`.oxlintrc.json`) - Fast Rust-based JavaScript/TypeScript linter
|
|
16
|
+
- **commitlint** (`.commitlintrc`, `.commitlintrc.json`) - Commit message linting
|
|
17
|
+
- **lint-staged** (`.lintstagedrc`, `.lintstagedrc.json`) - Run linters on staged files
|
|
18
|
+
- **lefthook** (`lefthook.yml`, `.lefthook.yml`) - Fast Go-based git hooks manager
|
|
19
|
+
- **pre-commit** (`.pre-commit-config.yaml`) - Python-based git hooks framework
|
|
20
|
+
- **ansible-lint** (`.ansible-lint`, `.ansible-lint.yaml`) - Ansible playbook linter
|
|
21
|
+
- **SQLFluff** (`.sqlfluff`, `setup.cfg`) - SQL linter supporting 24+ dialects
|
|
22
|
+
- **buf** (`buf.yaml`, `buf.work.yaml`) - Protocol Buffers linter and generator
|
|
23
|
+
- **alex** (`.alexignore`, `.alexrc`, `.alexrc.json`) - Inclusive language linter
|
|
24
|
+
- Support for 4 essential Ruby/Rails linters:
|
|
25
|
+
- **Brakeman** (`config/brakeman.yml`, `.brakeman.yml`) - Security vulnerability scanner for Rails
|
|
26
|
+
- **Reek** (`.reek.yml`, `.reek`, `config.reek`) - Code smell detector for Ruby
|
|
27
|
+
- **bundler-audit** (`.bundler-audit.yml`) - Dependency vulnerability scanner
|
|
28
|
+
- **YARD-Lint** (`.yard-lint.yml`) - Documentation linter for YARD docs
|
|
29
|
+
- Total supported configuration files increased from 48+ to 62+
|
|
30
|
+
- Comprehensive test coverage with 140+ new tests for all new parsers
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Updated README with new linter documentation and usage examples
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
- Alex parser no longer attempts to validate linguistic terms as file paths
|
|
37
|
+
- SQLFluff parser now correctly identifies path-related fields (excludes rule IDs and file extensions)
|
|
38
|
+
- Commitlint parser logic improved to properly filter npm packages vs. local file paths
|
|
39
|
+
- Unused parameter warnings fixed in buf and sqlfluff parsers
|
|
40
|
+
|
|
41
|
+
## [0.2.1] - 2026-01-26
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- Minor documentation updates
|
|
45
|
+
|
|
10
46
|
## [0.2.0] - 2026-01-26
|
|
11
47
|
|
|
12
48
|
### Added
|
|
@@ -78,6 +114,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
78
114
|
- Examples for CI/CD integration
|
|
79
115
|
- Contributing guidelines
|
|
80
116
|
|
|
81
|
-
[Unreleased]: https://github.com/
|
|
82
|
-
[0.
|
|
83
|
-
[0.1
|
|
117
|
+
[Unreleased]: https://github.com/mensfeld/lostconf/compare/v0.3.0...HEAD
|
|
118
|
+
[0.3.0]: https://github.com/mensfeld/lostconf/compare/v0.2.1...v0.3.0
|
|
119
|
+
[0.2.1]: https://github.com/mensfeld/lostconf/compare/v0.2.0...v0.2.1
|
|
120
|
+
[0.2.0]: https://github.com/mensfeld/lostconf/compare/v0.1.0...v0.2.0
|
|
121
|
+
[0.1.0]: https://github.com/mensfeld/lostconf/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# lostconf
|
|
2
2
|
|
|
3
|
-
[](https://github.com/mensfeld/lostconf/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/lostconf)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
@@ -115,23 +115,32 @@ npx lostconf --exclude "**/test/**" --exclude "**/tests/**"
|
|
|
115
115
|
|
|
116
116
|
## Supported Config Files
|
|
117
117
|
|
|
118
|
-
lostconf supports **
|
|
118
|
+
lostconf supports **62+ configuration files** from popular tools across **15+ languages**:
|
|
119
119
|
|
|
120
120
|
| Language/Category | Tool | Config File(s) | What We Check |
|
|
121
121
|
|-------------------|------|----------------|---------------|
|
|
122
122
|
| **JavaScript/TypeScript** | ESLint | `.eslintignore` | File paths and glob patterns in ignore list |
|
|
123
|
+
| | ESLint Flat Config | `eslint.config.json` | Patterns in `ignores` and `files` arrays (JSON only) |
|
|
123
124
|
| | Prettier | `.prettierignore` | File paths and glob patterns in ignore list |
|
|
124
125
|
| | TypeScript | `tsconfig.json` | Files in `exclude`, `include` arrays |
|
|
125
126
|
| | Jest | `jest.config.json` | Test paths, coverage paths, module paths |
|
|
126
127
|
| | Stylelint | `.stylelintignore`, `.stylelintrc.json` | File paths and glob patterns, ignore patterns in config |
|
|
127
128
|
| | Biome | `biome.json`, `biome.jsonc` | Patterns in `files.ignore`, `linter.ignore`, `formatter.ignore` |
|
|
128
129
|
| | Deno | `deno.json`, `deno.jsonc` | Global `exclude`, `lint.exclude/include`, `fmt.exclude/include`, `test.exclude/include` |
|
|
130
|
+
| | Oxlint | `.oxlintrc.json`, `oxlint.config.json` | Patterns in `ignorePatterns` array |
|
|
131
|
+
| | commitlint | `.commitlintrc`, `.commitlintrc.json` | Commit message patterns in `ignores`, file paths in `extends` |
|
|
132
|
+
| | lint-staged | `.lintstagedrc`, `.lintstagedrc.json` | Object keys are glob patterns matching staged files |
|
|
129
133
|
| **Python** | pytest, coverage, mypy, ruff, black, isort | `pyproject.toml` | Test paths, source paths, exclude patterns, omit patterns |
|
|
130
134
|
| | Flake8 | `.flake8`, `setup.cfg` | Exclude patterns, extend-exclude, filename patterns, per-file-ignores |
|
|
131
135
|
| | Pylint | `.pylintrc`, `pylintrc` | Ignore paths, ignore patterns in `[MASTER]`/`[MAIN]` section |
|
|
132
136
|
| | Bandit | `.bandit` | Exclude directories, exclude files, test paths |
|
|
133
137
|
| | Pyright | `pyrightconfig.json` | `include`, `exclude`, `ignore`, `extraPaths` patterns |
|
|
138
|
+
| **SQL** | SQLFluff | `.sqlfluff`, `setup.cfg` | Exclude patterns, ignore patterns, template paths |
|
|
134
139
|
| **Ruby** | RuboCop | `.rubocop.yml` | Exclude patterns, Include patterns in AllCops |
|
|
140
|
+
| | Brakeman | `config/brakeman.yml`, `.brakeman.yml` | Patterns in `skip-files` and `only-files` |
|
|
141
|
+
| | Reek | `.reek.yml`, `.reek`, `config.reek` | Directory paths in `exclude_paths` |
|
|
142
|
+
| | bundler-audit | `.bundler-audit.yml` | Advisory IDs in `ignore` (CVE, OSVDB, GHSA) |
|
|
143
|
+
| | YARD-Lint | `.yard-lint.yml` | File patterns in global and per-validator `Exclude` |
|
|
135
144
|
| **Go** | golangci-lint | `.golangci.yml` | Skip-dirs, skip-files, exclude patterns |
|
|
136
145
|
| **Rust** | rustfmt | `rustfmt.toml` | Ignore patterns |
|
|
137
146
|
| | Clippy | `clippy.toml` | Excluded files |
|
|
@@ -155,9 +164,14 @@ lostconf supports **48+ configuration files** from popular tools across **15+ la
|
|
|
155
164
|
| **Security** | Semgrep | `.semgrep.yml`, `.semgrep.yaml`, `.semgrepignore` | `paths.exclude`, `paths.include` in rules, ignore patterns |
|
|
156
165
|
| | Gitleaks | `.gitleaks.toml` | `allowlist.paths`, `allowlist.regexes`, rule-specific allowlists |
|
|
157
166
|
| **Docker** | Hadolint | `.hadolint.yaml`, `.hadolint.yml` | `ignored` patterns, `trustedRegistries` (non-URL paths) |
|
|
167
|
+
| **DevOps** | ansible-lint | `.ansible-lint`, `.ansible-lint.yaml` | Patterns in `exclude_paths` list |
|
|
168
|
+
| **Protocol Buffers** | buf | `buf.yaml`, `buf.work.yaml` | Patterns in `lint.ignore`, `breaking.ignore`, workspace `directories` |
|
|
169
|
+
| **Git Hooks** | lefthook | `lefthook.yml`, `.lefthook.yml` | Patterns in `files`, `glob`, `exclude`, `skip` fields |
|
|
170
|
+
| | pre-commit | `.pre-commit-config.yaml` | Regex patterns in top-level and hook-level `files` and `exclude` |
|
|
158
171
|
| **General** | Git | `.gitignore` | All file paths and patterns |
|
|
159
172
|
| | Docker | `.dockerignore` | All file paths and patterns |
|
|
160
173
|
| | markdownlint | `.markdownlintignore` | All file paths and patterns |
|
|
174
|
+
| **Documentation** | alex | `.alexignore`, `.alexrc`, `.alexrc.json` | Ignore patterns and allowed terms |
|
|
161
175
|
|
|
162
176
|
## What Does lostconf Validate?
|
|
163
177
|
|
|
@@ -411,7 +425,7 @@ Contributions are welcome! Here's how to get started:
|
|
|
411
425
|
|
|
412
426
|
```bash
|
|
413
427
|
# Clone the repository
|
|
414
|
-
git clone https://github.com/
|
|
428
|
+
git clone https://github.com/mensfeld/lostconf.git
|
|
415
429
|
cd lostconf
|
|
416
430
|
|
|
417
431
|
# Install dependencies
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ const program = new Command();
|
|
|
14
14
|
program
|
|
15
15
|
.name('lostconf')
|
|
16
16
|
.description('A meta-linter that detects stale references in configuration files')
|
|
17
|
-
.version('0.
|
|
17
|
+
.version('0.3.0')
|
|
18
18
|
.argument('[paths...]', 'Paths to scan (default: current directory)')
|
|
19
19
|
.option('-f, --format <fmt>', 'Output format: text, json, sarif', 'text')
|
|
20
20
|
.option('-o, --output <file>', 'Write to file instead of stdout')
|
package/dist/output/sarif.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for alex (inclusive language linter) configuration files
|
|
3
|
+
* https://alexjs.com/
|
|
4
|
+
*/
|
|
5
|
+
import type { Parser } from '../plugin/types.js';
|
|
6
|
+
/** alex ignore file parser */
|
|
7
|
+
export declare const alexIgnoreParser: Parser;
|
|
8
|
+
/** alex config file parser */
|
|
9
|
+
export declare const alexRcParser: Parser;
|
|
10
|
+
//# sourceMappingURL=alex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alex.d.ts","sourceRoot":"","sources":["../../src/parsers/alex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAqDjD,8BAA8B;AAC9B,eAAO,MAAM,gBAAgB,EAAE,MAI9B,CAAC;AAEF,8BAA8B;AAC9B,eAAO,MAAM,YAAY,EAAE,MAI1B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for alex (inclusive language linter) configuration files
|
|
3
|
+
* https://alexjs.com/
|
|
4
|
+
*/
|
|
5
|
+
import { PatternType } from '../core/types.js';
|
|
6
|
+
import { isGlobPattern } from '../validator/glob.js';
|
|
7
|
+
/** Parse .alexignore file (same format as .gitignore) */
|
|
8
|
+
function parseAlexIgnore(_filename, content) {
|
|
9
|
+
const patterns = [];
|
|
10
|
+
const lines = content.split('\n');
|
|
11
|
+
for (let i = 0; i < lines.length; i++) {
|
|
12
|
+
const line = lines[i];
|
|
13
|
+
const lineNum = i + 1;
|
|
14
|
+
// Skip empty lines and comments
|
|
15
|
+
const trimmed = line.trim();
|
|
16
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
// Check for negation
|
|
20
|
+
let patternValue = trimmed;
|
|
21
|
+
let negated = false;
|
|
22
|
+
if (patternValue.startsWith('!')) {
|
|
23
|
+
negated = true;
|
|
24
|
+
patternValue = patternValue.slice(1);
|
|
25
|
+
}
|
|
26
|
+
// Determine pattern type
|
|
27
|
+
const type = isGlobPattern(patternValue) ? PatternType.GLOB : PatternType.PATH;
|
|
28
|
+
patterns.push({
|
|
29
|
+
value: patternValue,
|
|
30
|
+
type,
|
|
31
|
+
line: lineNum,
|
|
32
|
+
column: 1,
|
|
33
|
+
negated
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return patterns;
|
|
37
|
+
}
|
|
38
|
+
/** Parse .alexrc/.alexrc.json configuration */
|
|
39
|
+
function parseAlexRc(_filename, _content) {
|
|
40
|
+
const patterns = [];
|
|
41
|
+
// Note: The 'allow' field in .alexrc contains linguistic terms (words/phrases),
|
|
42
|
+
// not filesystem paths. These cannot be validated against the filesystem,
|
|
43
|
+
// so we intentionally skip parsing them.
|
|
44
|
+
// Example: ["boogeyman", "garbageman"] are words to allow, not file paths.
|
|
45
|
+
return patterns;
|
|
46
|
+
}
|
|
47
|
+
/** alex ignore file parser */
|
|
48
|
+
export const alexIgnoreParser = {
|
|
49
|
+
name: 'alexignore',
|
|
50
|
+
filePatterns: ['.alexignore', '**/.alexignore'],
|
|
51
|
+
parse: parseAlexIgnore
|
|
52
|
+
};
|
|
53
|
+
/** alex config file parser */
|
|
54
|
+
export const alexRcParser = {
|
|
55
|
+
name: 'alexrc',
|
|
56
|
+
filePatterns: ['.alexrc', '.alexrc.json', '**/.alexrc', '**/.alexrc.json'],
|
|
57
|
+
parse: parseAlexRc
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=alex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alex.js","sourceRoot":"","sources":["../../src/parsers/alex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,yDAAyD;AACzD,SAAS,eAAe,CAAC,SAAiB,EAAE,OAAe;IACzD,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAEtB,gCAAgC;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxC,SAAS;QACX,CAAC;QAED,qBAAqB;QACrB,IAAI,YAAY,GAAG,OAAO,CAAC;QAC3B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QAED,yBAAyB;QACzB,MAAM,IAAI,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC;QAE/E,QAAQ,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE,YAAY;YACnB,IAAI;YACJ,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,CAAC;YACT,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,+CAA+C;AAC/C,SAAS,WAAW,CAAC,SAAiB,EAAE,QAAgB;IACtD,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,gFAAgF;IAChF,0EAA0E;IAC1E,yCAAyC;IACzC,2EAA2E;IAE3E,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,8BAA8B;AAC9B,MAAM,CAAC,MAAM,gBAAgB,GAAW;IACtC,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC;IAC/C,KAAK,EAAE,eAAe;CACvB,CAAC;AAEF,8BAA8B;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAW;IAClC,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,CAAC;IAC1E,KAAK,EAAE,WAAW;CACnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for ansible-lint configuration files
|
|
3
|
+
* https://ansible-lint.readthedocs.io/
|
|
4
|
+
*/
|
|
5
|
+
import type { Parser } from '../plugin/types.js';
|
|
6
|
+
/** ansible-lint config parser */
|
|
7
|
+
export declare const ansibleLintParser: Parser;
|
|
8
|
+
//# sourceMappingURL=ansible-lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansible-lint.d.ts","sourceRoot":"","sources":["../../src/parsers/ansible-lint.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA+EjD,iCAAiC;AACjC,eAAO,MAAM,iBAAiB,EAAE,MAI/B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for ansible-lint configuration files
|
|
3
|
+
* https://ansible-lint.readthedocs.io/
|
|
4
|
+
*/
|
|
5
|
+
import { parse as parseYaml } from 'yaml';
|
|
6
|
+
import { PatternType } from '../core/types.js';
|
|
7
|
+
import { isGlobPattern } from '../validator/glob.js';
|
|
8
|
+
/** Parse .ansible-lint configuration */
|
|
9
|
+
function parseAnsibleLint(_filename, content) {
|
|
10
|
+
const patterns = [];
|
|
11
|
+
let config;
|
|
12
|
+
try {
|
|
13
|
+
config = parseYaml(content);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return patterns;
|
|
17
|
+
}
|
|
18
|
+
if (!config || typeof config !== 'object') {
|
|
19
|
+
return patterns;
|
|
20
|
+
}
|
|
21
|
+
const lineMap = buildLineMap(content);
|
|
22
|
+
// Extract exclude_paths (file paths and globs)
|
|
23
|
+
if (Array.isArray(config.exclude_paths)) {
|
|
24
|
+
for (const value of config.exclude_paths) {
|
|
25
|
+
if (typeof value !== 'string')
|
|
26
|
+
continue;
|
|
27
|
+
const lineInfo = lineMap.get(value);
|
|
28
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
29
|
+
patterns.push({
|
|
30
|
+
value,
|
|
31
|
+
type,
|
|
32
|
+
line: lineInfo?.line ?? 1,
|
|
33
|
+
column: lineInfo?.column
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Note: skip_list and warn_list contain rule IDs, not file paths, so we skip them
|
|
38
|
+
return patterns;
|
|
39
|
+
}
|
|
40
|
+
function buildLineMap(content) {
|
|
41
|
+
const map = new Map();
|
|
42
|
+
const lines = content.split('\n');
|
|
43
|
+
for (let i = 0; i < lines.length; i++) {
|
|
44
|
+
const line = lines[i];
|
|
45
|
+
const lineNum = i + 1;
|
|
46
|
+
// Match YAML string values (quoted and unquoted)
|
|
47
|
+
const quotedMatches = line.matchAll(/["']([^"']+)["']/g);
|
|
48
|
+
for (const match of quotedMatches) {
|
|
49
|
+
const value = match[1];
|
|
50
|
+
if (value && !map.has(value)) {
|
|
51
|
+
map.set(value, { line: lineNum, column: (match.index ?? 0) + 1 });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Match unquoted list items
|
|
55
|
+
const listItemMatch = line.match(/^\s*-\s+([^\s#]+)/);
|
|
56
|
+
if (listItemMatch && listItemMatch[1]) {
|
|
57
|
+
const value = listItemMatch[1];
|
|
58
|
+
if (!map.has(value)) {
|
|
59
|
+
map.set(value, { line: lineNum, column: (listItemMatch.index ?? 0) + 1 });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return map;
|
|
64
|
+
}
|
|
65
|
+
/** ansible-lint config parser */
|
|
66
|
+
export const ansibleLintParser = {
|
|
67
|
+
name: 'ansible-lint',
|
|
68
|
+
filePatterns: ['.ansible-lint', '.ansible-lint.yaml', '.ansible-lint.yml', '**/.ansible-lint'],
|
|
69
|
+
parse: parseAnsibleLint
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ansible-lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansible-lint.js","sourceRoot":"","sources":["../../src/parsers/ansible-lint.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AASrD,wCAAwC;AACxC,SAAS,gBAAgB,CAAC,SAAiB,EAAE,OAAe;IAC1D,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,IAAI,MAAyB,CAAC;IAC9B,I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":"","sources":["../../src/parsers/brakeman.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA6FjD,6BAA6B;AAC7B,eAAO,MAAM,cAAc,EAAE,MAI5B,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for Brakeman configuration files
|
|
3
|
+
* https://brakemanscanner.org/
|
|
4
|
+
*/
|
|
5
|
+
import { parse as parseYaml } from 'yaml';
|
|
6
|
+
import { PatternType } from '../core/types.js';
|
|
7
|
+
import { isGlobPattern } from '../validator/glob.js';
|
|
8
|
+
/** Parse Brakeman configuration */
|
|
9
|
+
function parseBrakeman(_filename, content) {
|
|
10
|
+
const patterns = [];
|
|
11
|
+
let config;
|
|
12
|
+
try {
|
|
13
|
+
config = parseYaml(content);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return patterns;
|
|
17
|
+
}
|
|
18
|
+
if (!config || typeof config !== 'object') {
|
|
19
|
+
return patterns;
|
|
20
|
+
}
|
|
21
|
+
const lineMap = buildLineMap(content);
|
|
22
|
+
// Extract skip-files patterns
|
|
23
|
+
if (Array.isArray(config['skip-files'])) {
|
|
24
|
+
for (const value of config['skip-files']) {
|
|
25
|
+
if (typeof value !== 'string')
|
|
26
|
+
continue;
|
|
27
|
+
const lineInfo = lineMap.get(value);
|
|
28
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
29
|
+
patterns.push({
|
|
30
|
+
value,
|
|
31
|
+
type,
|
|
32
|
+
line: lineInfo?.line ?? 1,
|
|
33
|
+
column: lineInfo?.column
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Extract only-files patterns
|
|
38
|
+
if (Array.isArray(config['only-files'])) {
|
|
39
|
+
for (const value of config['only-files']) {
|
|
40
|
+
if (typeof value !== 'string')
|
|
41
|
+
continue;
|
|
42
|
+
const lineInfo = lineMap.get(value);
|
|
43
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
44
|
+
patterns.push({
|
|
45
|
+
value,
|
|
46
|
+
type,
|
|
47
|
+
line: lineInfo?.line ?? 1,
|
|
48
|
+
column: lineInfo?.column
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return patterns;
|
|
53
|
+
}
|
|
54
|
+
function buildLineMap(content) {
|
|
55
|
+
const map = new Map();
|
|
56
|
+
const lines = content.split('\n');
|
|
57
|
+
for (let i = 0; i < lines.length; i++) {
|
|
58
|
+
const line = lines[i];
|
|
59
|
+
const lineNum = i + 1;
|
|
60
|
+
// Match YAML string values (quoted and unquoted)
|
|
61
|
+
const quotedMatches = line.matchAll(/["']([^"']+)["']/g);
|
|
62
|
+
for (const match of quotedMatches) {
|
|
63
|
+
const value = match[1];
|
|
64
|
+
if (value && !map.has(value)) {
|
|
65
|
+
map.set(value, { line: lineNum, column: (match.index ?? 0) + 1 });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Match unquoted list items
|
|
69
|
+
const listItemMatch = line.match(/^\s*-\s+([^\s#]+)/);
|
|
70
|
+
if (listItemMatch && listItemMatch[1]) {
|
|
71
|
+
const value = listItemMatch[1];
|
|
72
|
+
if (!map.has(value)) {
|
|
73
|
+
map.set(value, { line: lineNum, column: (listItemMatch.index ?? 0) + 1 });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return map;
|
|
78
|
+
}
|
|
79
|
+
/** Brakeman config parser */
|
|
80
|
+
export const brakemanParser = {
|
|
81
|
+
name: 'brakeman',
|
|
82
|
+
filePatterns: ['config/brakeman.yml', '.brakeman.yml', '**/config/brakeman.yml'],
|
|
83
|
+
parse: parseBrakeman
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=brakeman.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brakeman.js","sourceRo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;gBAC7B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;QAED,4BAA4B;QAC5B,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACtD,IAAI,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,6BAA6B;AAC7B,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,CAAC,qBAAqB,EAAE,eAAe,EAAE,wBAAwB,CAAC;IAChF,KAAK,EAAE,aAAa;CACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buf.d.ts","sourceRoot":"","sources":["../../src/parsers/buf.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAuJjD,wBAAwB;AACxB,eAAO,MAAM,SAAS,EAAE,MAIvB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for buf configuration files
|
|
3
|
+
* https://buf.build/docs/
|
|
4
|
+
*/
|
|
5
|
+
import { parse as parseYaml } from 'yaml';
|
|
6
|
+
import { PatternType } from '../core/types.js';
|
|
7
|
+
import { isGlobPattern } from '../validator/glob.js';
|
|
8
|
+
/** Parse buf.yaml or buf.work.yaml configuration */
|
|
9
|
+
function parseBuf(_filename, content) {
|
|
10
|
+
const patterns = [];
|
|
11
|
+
let config;
|
|
12
|
+
try {
|
|
13
|
+
config = parseYaml(content);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return patterns;
|
|
17
|
+
}
|
|
18
|
+
if (!config || typeof config !== 'object') {
|
|
19
|
+
return patterns;
|
|
20
|
+
}
|
|
21
|
+
const lineMap = buildLineMap(content);
|
|
22
|
+
// Handle buf.work.yaml (workspace config)
|
|
23
|
+
if ('directories' in config && Array.isArray(config.directories)) {
|
|
24
|
+
for (const value of config.directories) {
|
|
25
|
+
if (typeof value !== 'string')
|
|
26
|
+
continue;
|
|
27
|
+
const lineInfo = lineMap.get(value);
|
|
28
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
29
|
+
patterns.push({
|
|
30
|
+
value,
|
|
31
|
+
type,
|
|
32
|
+
line: lineInfo?.line ?? 1,
|
|
33
|
+
column: lineInfo?.column
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Handle buf.yaml (module config)
|
|
38
|
+
const bufConfig = config;
|
|
39
|
+
// Extract lint ignore patterns
|
|
40
|
+
if (bufConfig.lint?.ignore && Array.isArray(bufConfig.lint.ignore)) {
|
|
41
|
+
for (const value of bufConfig.lint.ignore) {
|
|
42
|
+
if (typeof value !== 'string')
|
|
43
|
+
continue;
|
|
44
|
+
const lineInfo = lineMap.get(value);
|
|
45
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
46
|
+
patterns.push({
|
|
47
|
+
value,
|
|
48
|
+
type,
|
|
49
|
+
line: lineInfo?.line ?? 1,
|
|
50
|
+
column: lineInfo?.column
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Extract breaking ignore patterns
|
|
55
|
+
if (bufConfig.breaking?.ignore && Array.isArray(bufConfig.breaking.ignore)) {
|
|
56
|
+
for (const value of bufConfig.breaking.ignore) {
|
|
57
|
+
if (typeof value !== 'string')
|
|
58
|
+
continue;
|
|
59
|
+
const lineInfo = lineMap.get(value);
|
|
60
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
61
|
+
patterns.push({
|
|
62
|
+
value,
|
|
63
|
+
type,
|
|
64
|
+
line: lineInfo?.line ?? 1,
|
|
65
|
+
column: lineInfo?.column
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Extract ignore_only patterns (per-rule ignores)
|
|
70
|
+
if (bufConfig.lint?.ignore_only && typeof bufConfig.lint.ignore_only === 'object') {
|
|
71
|
+
for (const paths of Object.values(bufConfig.lint.ignore_only)) {
|
|
72
|
+
if (Array.isArray(paths)) {
|
|
73
|
+
for (const value of paths) {
|
|
74
|
+
if (typeof value !== 'string')
|
|
75
|
+
continue;
|
|
76
|
+
const lineInfo = lineMap.get(value);
|
|
77
|
+
const type = isGlobPattern(value) ? PatternType.GLOB : PatternType.PATH;
|
|
78
|
+
patterns.push({
|
|
79
|
+
value,
|
|
80
|
+
type,
|
|
81
|
+
line: lineInfo?.line ?? 1,
|
|
82
|
+
column: lineInfo?.column
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return patterns;
|
|
89
|
+
}
|
|
90
|
+
function buildLineMap(content) {
|
|
91
|
+
const map = new Map();
|
|
92
|
+
const lines = content.split('\n');
|
|
93
|
+
for (let i = 0; i < lines.length; i++) {
|
|
94
|
+
const line = lines[i];
|
|
95
|
+
const lineNum = i + 1;
|
|
96
|
+
// Match YAML string values (quoted and unquoted)
|
|
97
|
+
const quotedMatches = line.matchAll(/["']([^"']+)["']/g);
|
|
98
|
+
for (const match of quotedMatches) {
|
|
99
|
+
const value = match[1];
|
|
100
|
+
if (value && !map.has(value)) {
|
|
101
|
+
map.set(value, { line: lineNum, column: (match.index ?? 0) + 1 });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Match unquoted list items
|
|
105
|
+
const listItemMatch = line.match(/^\s*-\s+([^\s#]+)/);
|
|
106
|
+
if (listItemMatch && listItemMatch[1]) {
|
|
107
|
+
const value = listItemMatch[1];
|
|
108
|
+
if (!map.has(value)) {
|
|
109
|
+
map.set(value, { line: lineNum, column: (listItemMatch.index ?? 0) + 1 });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return map;
|
|
114
|
+
}
|
|
115
|
+
/** buf config parser */
|
|
116
|
+
export const bufParser = {
|
|
117
|
+
name: 'buf',
|
|
118
|
+
filePatterns: ['buf.yaml', 'buf.work.yaml', 'buf.gen.yaml', '**/buf.yaml', '**/buf.work.yaml'],
|
|
119
|
+
parse: parseBuf
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=buf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buf.js","sourceRoot":"","sources":["../../src/parsers/buf.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAyBrD,oDAAoD;AACpD,SAAS,QAAQ,CAAC,SAAiB,EAAE,OAAe;IAClD,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,IAAI,MAAiC,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,SAAS,CAAC,OAAO,CAA8B,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,OAAO,MAA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AC5B,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACtD,IAAI,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wBAAwB;AACxB,MAAM,CAAC,MAAM,SAAS,GAAW;IAC/B,IAAI,EAAE,KAAK;IACX,YAAY,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,CAAC;IAC9F,KAAK,EAAE,QAAQ;CAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for bundler-audit configuration files
|
|
3
|
+
* https://github.com/rubysec/bundler-audit
|
|
4
|
+
*
|
|
5
|
+
* Note: bundler-audit's ignore field contains advisory IDs (CVE-YYYY-XXXX),
|
|
6
|
+
* not file paths. These are tracked but cannot be validated against the filesystem.
|
|
7
|
+
*/
|
|
8
|
+
import type { Parser } from '../plugin/types.js';
|
|
9
|
+
/** bundler-audit config parser */
|
|
10
|
+
export declare const bundlerAuditParser: Parser;
|
|
11
|
+
//# sourceMappingURL=bundler-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler-audit.d.ts","sourceRoot":"","sources":["../../src/parsers/bundler-audit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA2EjD,kCAAkC;AAClC,eAAO,MAAM,kBAAkB,EAAE,MAIhC,CAAC"}
|