File tree Expand file tree Collapse file tree 3 files changed +76
-1
lines changed Expand file tree Collapse file tree 3 files changed +76
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ using namespace boost::json;
28
28
struct RuleProps {
29
29
int cweId;
30
30
std::string scRuleId;
31
+ std::string tool;
31
32
};
32
33
33
34
struct SarifTreeEncoder ::Private {
@@ -164,6 +165,12 @@ void SarifTreeEncoder::Private::serializeRules()
164
165
const bool haveScRule = !rp.scRuleId .empty ();
165
166
if (haveScRule)
166
167
sarifEncodeShellCheckRule (&rule, rp.scRuleId );
168
+ else if (!rp.tool .empty ()) {
169
+ // encode tool tag
170
+ array tags = { rp.tool };
171
+ object &props = rule[" properties" ].as_object ();
172
+ props[" tags" ] = std::move (tags);
173
+ }
167
174
168
175
if (rp.cweId )
169
176
sarifEncodeCweRule (&rule, rp.cweId , /* append =*/ haveScRule);
@@ -316,6 +323,10 @@ void SarifTreeEncoder::appendDef(const Defect &def)
316
323
result[" properties" ] = std::move (cweProp);
317
324
}
318
325
326
+ if (!def.tool .empty ())
327
+ // update tool for this rule
328
+ d->ruleMap [ruleId].tool = def.tool ;
329
+
319
330
// key event severity level
320
331
sarifEncodeLevel (&result, keyEvt.event );
321
332
Original file line number Diff line number Diff line change 12
12
{
13
13
"id": "ALLOC_FREE_MISMATCH: free",
14
14
"properties": {
15
+ "tags": [
16
+ "coverity"
17
+ ],
15
18
"cwe": [
16
19
"CWE-762"
17
20
]
23
26
{
24
27
"id": "CHECKED_RETURN: check_return",
25
28
"properties": {
29
+ "tags": [
30
+ "coverity"
31
+ ],
26
32
"cwe": [
27
33
"CWE-252"
28
34
]
34
40
{
35
41
"id": "CONSTANT_EXPRESSION_RESULT: pointless_expression",
36
42
"properties": {
43
+ "tags": [
44
+ "coverity"
45
+ ],
37
46
"cwe": [
38
47
"CWE-569"
39
48
]
45
54
{
46
55
"id": "CONSTANT_EXPRESSION_RESULT: result_independent_of_operands",
47
56
"properties": {
57
+ "tags": [
58
+ "coverity"
59
+ ],
48
60
"cwe": [
49
61
"CWE-569"
50
62
]
56
68
{
57
69
"id": "DEADCODE: dead_error_begin",
58
70
"properties": {
71
+ "tags": [
72
+ "coverity"
73
+ ],
59
74
"cwe": [
60
75
"CWE-561"
61
76
]
67
82
{
68
83
"id": "DEADCODE: dead_error_line",
69
84
"properties": {
85
+ "tags": [
86
+ "coverity"
87
+ ],
70
88
"cwe": [
71
89
"CWE-561"
72
90
]
78
96
{
79
97
"id": "DEADCODE: effectively_constant",
80
98
"properties": {
99
+ "tags": [
100
+ "coverity"
101
+ ],
81
102
"cwe": [
82
103
"CWE-561"
83
104
]
89
110
{
90
111
"id": "FORWARD_NULL: var_deref_model",
91
112
"properties": {
113
+ "tags": [
114
+ "coverity"
115
+ ],
92
116
"cwe": [
93
117
"CWE-476"
94
118
]
100
124
{
101
125
"id": "NEGATIVE_RETURNS: negative_returns",
102
126
"properties": {
127
+ "tags": [
128
+ "coverity"
129
+ ],
103
130
"cwe": [
104
131
"CWE-687"
105
132
]
111
138
{
112
139
"id": "OVERRUN: illegal_address",
113
140
"properties": {
141
+ "tags": [
142
+ "coverity"
143
+ ],
114
144
"cwe": [
115
145
"CWE-119"
116
146
]
122
152
{
123
153
"id": "OVERRUN: overrun-buffer-arg",
124
154
"properties": {
155
+ "tags": [
156
+ "coverity"
157
+ ],
125
158
"cwe": [
126
159
"CWE-119"
127
160
]
133
166
{
134
167
"id": "OVERRUN: overrun-local",
135
168
"properties": {
169
+ "tags": [
170
+ "coverity"
171
+ ],
136
172
"cwe": [
137
173
"CWE-125"
138
174
]
144
180
{
145
181
"id": "PRINTF_ARGS: invalid_type",
146
182
"properties": {
183
+ "tags": [
184
+ "coverity"
185
+ ],
147
186
"cwe": [
148
187
"CWE-686"
149
188
]
155
194
{
156
195
"id": "RESOURCE_LEAK: leaked_storage",
157
196
"properties": {
197
+ "tags": [
198
+ "coverity"
199
+ ],
158
200
"cwe": [
159
201
"CWE-404"
160
202
]
166
208
{
167
209
"id": "RESOURCE_LEAK: overwrite_var",
168
210
"properties": {
211
+ "tags": [
212
+ "coverity"
213
+ ],
169
214
"cwe": [
170
215
"CWE-404"
171
216
]
177
222
{
178
223
"id": "STRING_NULL: string_null",
179
224
"properties": {
225
+ "tags": [
226
+ "coverity"
227
+ ],
180
228
"cwe": [
181
229
"CWE-170"
182
230
]
188
236
{
189
237
"id": "STRING_OVERFLOW: fixed_size_dest",
190
238
"properties": {
239
+ "tags": [
240
+ "coverity"
241
+ ],
191
242
"cwe": [
192
243
"CWE-120"
193
244
]
199
250
{
200
251
"id": "TOCTOU: toctou",
201
252
"properties": {
253
+ "tags": [
254
+ "coverity"
255
+ ],
202
256
"cwe": [
203
257
"CWE-367"
204
258
]
Original file line number Diff line number Diff line change 7
7
"driver": {
8
8
"name": "csdiff",
9
9
"version": "",
10
- "informationUri": "https://github.com/csutils/csdiff"
10
+ "informationUri": "https://github.com/csutils/csdiff",
11
+ "rules": [
12
+ {
13
+ "id": "COMPILER_WARNING: warning",
14
+ "properties": {
15
+ "tags": [
16
+ "gcc"
17
+ ]
18
+ }
19
+ }
20
+ ]
11
21
}
12
22
},
13
23
"results": [
You can’t perform that action at this time.
0 commit comments