Skip to content

Commit f7d6f5b

Browse files
committed
json: propagate per-checker "imp" attribute
1 parent 47519b4 commit f7d6f5b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

defect.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@ struct Defect {
9090
TEvtList events;
9191
unsigned keyEventIdx; ///< in range 0..(events.size()-1)
9292
int cwe; ///< CWE number, 0 means unused
93+
int imp; ///< "important" flag, bool for now
9394
int defectId; ///< used only by the JSON format
9495
std::string function; ///< used only by the JSON format
9596
std::string language; ///< used only by the JSON format
9697

9798
Defect():
9899
keyEventIdx(0U),
99100
cwe(0),
101+
imp(0),
100102
defectId(0)
101103
{
102104
}

json-parser.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ void SimpleTreeDecoder::readNode(
248248
// read "defect_id", "cwe", and "function" if available
249249
def->defectId = valueOf<int> (defNode, "defect_id", 0);
250250
def->cwe = valueOf<int> (defNode, "cwe" , 0);
251+
def->imp = valueOf<int> (defNode, "imp" , 0);
251252
def->function = valueOf<std::string>(defNode, "function", "");
252253
def->language = valueOf<std::string>(defNode, "language", "");
253254

json-writer.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ void appendDefectNode(PTree &dst, const Defect &def) {
8787
if (!def.annotation.empty())
8888
defNode.put<string>("annotation", def.annotation);
8989

90-
// write "defect_id", "cwe", and "function" if available
90+
// write "defect_id", "cwe", etc. if available
9191
if (0 < def.defectId)
9292
defNode.put<int>("defect_id", def.defectId);
9393
if (0 < def.cwe)
9494
defNode.put<int>("cwe", def.cwe);
95+
if (0 < def.imp)
96+
defNode.put<int>("imp", def.imp);
9597
if (!def.function.empty())
9698
defNode.put<string>("function", def.function);
9799
if (!def.language.empty())

0 commit comments

Comments
 (0)