11# CycloneDX Schema Linter
22
3- A modular linter for CycloneDX JSON schemas, enforcing ISO House Style and Oxford English conventions .
3+ A modular linter for CycloneDX JSON schemas.
44
55## Requirements
66
@@ -19,40 +19,48 @@ brew install aspell
1919
2020``` bash
2121# Lint files
22- node src/cli.js schema.json
23- node src/cli.js schemas/* .schema.json
22+ cdx-lint schema.json
23+ cdx-lint schemas/* .schema.json
2424
2525# Exclude or include specific checks
26- node src/cli.js --exclude formatting-indent schema.json
27- node src/cli.js --include description-full-stop schema.json
26+ cdx-lint --exclude formatting-indent schema.json
27+ cdx-lint --include description-full-stop schema.json
2828
2929# Output formats: stylish (default), json, compact
30- node src/cli.js --format json schema.json
30+ cdx-lint --format json schema.json
3131
3232# List available checks
33- node src/cli.js --list-checks
33+ cdx-lint --list-checks
34+ ```
35+
36+ Or run directly with Node:
37+
38+ ``` bash
39+ node src/cli.js schema.json
3440```
3541
3642## Checks
3743
3844| Check | Description |
3945| -------| -------------|
40- | ` schema-draft ` | Validates ` $schema ` is JSON Schema 2020-12 and first property |
46+ | ` schema-draft ` | Validates ` $schema ` is ` https://json-schema.org/draft/ 2020-12/schema ` |
4147| ` schema-id-pattern ` | Validates ` $id ` matches CycloneDX URL pattern |
42- | ` schema-comment ` | Validates ` $comment ` contains required standard notice |
43- | ` formatting-indent ` | Validates 2-space indentation |
44- | ` description-full-stop ` | Descriptions must end with full stop |
45- | ` meta-enum-full-stop ` | ` meta:enum ` values must end with full stop |
46- | ` property-name-american-english ` | Property names use American English |
47- | ` description-oxford-english ` | Descriptions use Oxford English (en_GB-ize) |
48- | ` no-uppercase-rfc ` | No uppercase RFC 2119 keywords (MUST, SHALL, etc.) |
49- | ` no-must-word ` | Use "shall" instead of "must" per ISO style |
50- | ` additional-properties-false ` | Objects must have ` additionalProperties: false ` |
51- | ` title-formatting ` | Validates title formatting conventions |
52- | ` enum-value-formatting ` | Validates enum value formatting and ` meta:enum ` coverage |
53- | ` ref-usage ` | Suggests using ` $ref ` for repeated structures |
54- | ` duplicate-content ` | Detects duplicate titles and descriptions |
55- | ` duplicate-definitions ` | Detects duplicate definitions and missing ` $ref ` usage |
48+ | ` schema-comment ` | Validates ` $comment ` contains required OWASP/Ecma standard notice |
49+ | ` model-property-order ` | Validates model schemas have properties in order: ` $schema ` , ` $id ` , ` type ` , ` title ` , ` $comment ` , ` $defs ` |
50+ | ` model-structure ` | Validates model schemas have ` type: "null" ` , ` $defs ` , and no ` properties ` |
51+ | ` formatting-indent ` | Validates 2-space indentation, no tabs, no trailing whitespace, LF line endings |
52+ | ` description-full-stop ` | Descriptions must end with a full stop |
53+ | ` meta-enum-full-stop ` | ` meta:enum ` values must end with a full stop |
54+ | ` property-name-american-english ` | Property names must use American English spelling |
55+ | ` description-oxford-english ` | Descriptions must use Oxford English spelling (British with -ize) |
56+ | ` no-uppercase-rfc ` | No uppercase RFC 2119 keywords (MUST, SHALL, SHOULD, etc.) |
57+ | ` no-must-word ` | Use "shall" instead of "must" per ISO House Style |
58+ | ` additional-properties-false ` | Object definitions must have ` additionalProperties: false ` |
59+ | ` title-formatting ` | Titles must use sentence case |
60+ | ` enum-value-formatting ` | Enum values must be lowercase kebab-case; ` meta:enum ` must cover all values |
61+ | ` ref-usage ` | ` $ref ` must not be combined with other keywords |
62+ | ` duplicate-content ` | Titles and descriptions must be unique within a schema |
63+ | ` duplicate-definitions ` | Definitions must be reused via ` $ref ` , not duplicated |
5664
5765## Configuration
5866
@@ -69,13 +77,3 @@ Create `.cdxlintrc.json` in your project root:
6977 "includeChecks" : null
7078}
7179```
72-
73- ## Running Tests
74-
75- ``` bash
76- npm test
77- ```
78-
79- ## Licence
80-
81- Apache-2.0
0 commit comments