Skip to content

Commit 9db80c7

Browse files
committed
Update rule package schema
This applies the following changes: - Add support for the standards CERT-C and MISRA-C 2012 - Stricter validation by rejected additional properties - Update the obligation enum set to match those defined by the standard.
1 parent bb26596 commit 9db80c7

File tree

1 file changed

+100
-5
lines changed

1 file changed

+100
-5
lines changed

schemas/rule-package.schema.json

Lines changed: 100 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"type": "string",
4646
"enum": [
4747
"required",
48-
"rule",
4948
"advisory"
5049
]
5150
}
@@ -67,6 +66,7 @@
6766
"type": "string"
6867
}
6968
},
69+
"additionalProperties": false,
7070
"required": [
7171
"properties",
7272
"queries",
@@ -85,6 +85,100 @@
8585
"type": "object",
8686
"patternProperties": {
8787
"^\\w+\\d+-CPP": {
88+
"description": "A coding standard rule",
89+
"type": "object",
90+
"properties": {
91+
"properties": {
92+
"type": "object",
93+
"properties": {
94+
"obligation": {
95+
"type": "string",
96+
"enum": [
97+
"rule"
98+
]
99+
}
100+
},
101+
"required": [
102+
"obligation"
103+
]
104+
},
105+
"queries": {
106+
"type": "array",
107+
"uniqueItems": true,
108+
"items": {
109+
"$ref": "#/$defs/query"
110+
}
111+
},
112+
"title": {
113+
"type": "string"
114+
}
115+
},
116+
"required": [
117+
"properties",
118+
"queries",
119+
"title"
120+
],
121+
"additionalProperties": false
122+
}
123+
},
124+
"minProperties": 1
125+
}
126+
}
127+
},
128+
{
129+
"properties": {
130+
"CERT-C": {
131+
"description": "Rules part of the CERT-C standard",
132+
"type": "object",
133+
"patternProperties": {
134+
"^\\w+\\d+-C": {
135+
"description": "A coding standard rule",
136+
"type": "object",
137+
"properties": {
138+
"properties": {
139+
"type": "object",
140+
"properties": {
141+
"obligation": {
142+
"type": "string",
143+
"enum": [
144+
"rule"
145+
]
146+
}
147+
},
148+
"required": [
149+
"obligation"
150+
]
151+
},
152+
"queries": {
153+
"type": "array",
154+
"uniqueItems": true,
155+
"items": {
156+
"$ref": "#/$defs/query"
157+
}
158+
},
159+
"title": {
160+
"type": "string"
161+
}
162+
},
163+
"required": [
164+
"properties",
165+
"queries",
166+
"title"
167+
],
168+
"additionalProperties": false
169+
}
170+
},
171+
"minProperties": 1
172+
}
173+
}
174+
},
175+
{
176+
"properties": {
177+
"MISRA-C-2012": {
178+
"description": "Rules part of the MISRA C 2012 standard",
179+
"type": "object",
180+
"patternProperties": {
181+
"^RULE-\\d+-\\d+": {
88182
"description": "A coding standard rule",
89183
"type": "object",
90184
"properties": {
@@ -95,8 +189,8 @@
95189
"type": "string",
96190
"enum": [
97191
"required",
98-
"rule",
99-
"advisory"
192+
"advisory",
193+
"mandatory"
100194
]
101195
}
102196
},
@@ -119,7 +213,8 @@
119213
"properties",
120214
"queries",
121215
"title"
122-
]
216+
],
217+
"additionalProperties": false
123218
}
124219
},
125220
"minProperties": 1
@@ -128,7 +223,7 @@
128223
}
129224
],
130225
"minProperties": 1,
131-
"maxProperties": 2,
226+
"maxProperties": 4,
132227
"$defs": {
133228
"query": {
134229
"$id": "/schemas/query",

0 commit comments

Comments
 (0)