-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcheck-modules-rule-registry.schema.json
More file actions
203 lines (203 loc) · 6.2 KB
/
check-modules-rule-registry.schema.json
File metadata and controls
203 lines (203 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Check Modules Rule Registry",
"type": "object",
"description": "Schema describing the rule registry consumed by the check-modules implementation.",
"additionalProperties": false,
"properties": {
"schemaVersion": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+$",
"description": "Semantic version of the registry format (e.g. 1.0.0)."
},
"generatedAt": {
"type": "string",
"format": "date-time",
"description": "ISO timestamp capturing when the registry file was generated."
},
"rules": {
"type": "array",
"description": "Collection of rule definitions applied by the check-modules stage.",
"items": {
"$ref": "#/$defs/rule"
},
"minItems": 1,
"uniqueItems": true
}
},
"required": ["schemaVersion", "rules"],
"$defs": {
"rule": {
"type": "object",
"title": "Rule",
"description": "Declarative definition of a lint rule that produces issues for a module.",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]*$",
"description": "Stable, kebab-case identifier (e.g. text-deprecated-new-buffer)."
},
"label": {
"type": "string",
"description": "Short human-readable name for the rule."
},
"category": {
"type": "string",
"enum": [
"Deprecated",
"Recommendation",
"Typo",
"Outdated",
"Security",
"Performance"
],
"description": "High-level grouping shown alongside findings."
},
"severity": {
"type": "string",
"enum": ["info", "low", "medium", "high", "critical"],
"description": "Relative priority used for ordering and alerting."
},
"autofixable": {
"type": "boolean",
"default": false,
"description": "Indicates whether the issue can be auto-fixed by tooling."
},
"message": {
"type": "string",
"description": "Issue message presented to module maintainers."
},
"fixSuggestion": {
"type": "string",
"description": "Optional short hint or command describing how to resolve the issue."
},
"docsUrl": {
"type": "string",
"format": "uri",
"description": "Optional reference link with extra context."
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Arbitrary labels for grouping/filtering in the UI (e.g. ci, coding-style)."
},
"appliesTo": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"enum": [
"general",
"package-json",
"package-lock",
"readme",
"filesystem",
"external"
]
},
"uniqueItems": true,
"description": "Which artifacts the rule inspects."
},
"detection": {
"$ref": "#/$defs/detection",
"description": "Declarative definition of how the rule identifies findings."
},
"metadata": {
"type": "object",
"description": "Free-form key/value pairs for pipeline-internal use (e.g. owner, rollout notes).",
"additionalProperties": true
}
},
"required": [
"id",
"label",
"category",
"severity",
"message",
"appliesTo",
"detection"
]
},
"detection": {
"type": "object",
"title": "Detection",
"description": "Strategy the stage uses to discover rule violations.",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": ["text-match", "regex", "filesystem", "external"],
"description": "Detector engine leveraged by the rule."
},
"caseSensitive": {
"type": "boolean",
"default": false,
"description": "Indicates whether pattern matching is case-sensitive."
},
"allowPartialMatch": {
"type": "boolean",
"default": true,
"description": "If false, matches must align to whole tokens (implementation-defined)."
},
"patterns": {
"type": "array",
"description": "List of patterns evaluated by the detector (required for text-match and regex).",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"pattern": {
"type": "string",
"description": "Substring or regular expression depending on detection.type."
},
"flags": {
"type": "string",
"pattern": "^[gimsuy]*$",
"description": "Valid ECMAScript regex flags (only for regex detectors)."
},
"targetFiles": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Glob-like hints to narrow the search scope (e.g. README.md)."
}
},
"required": ["pattern"]
},
"minItems": 1
},
"script": {
"type": "string",
"description": "Identifier of an external helper invoked for filesystem/external detections."
}
},
"required": ["type"],
"allOf": [
{
"if": {
"properties": { "type": { "enum": ["text-match", "regex"] } },
"required": ["type"]
},
"then": {
"required": ["patterns"]
}
},
{
"if": {
"properties": { "type": { "enum": ["filesystem", "external"] } },
"required": ["type"]
},
"then": {
"required": ["script"]
}
}
]
}
}
}