nimble-code / Cobra

An interactive (fast) static source code analyzer
139 stars 31 forks source link

JSON output misses commas #45

Closed hammersbaldthegodofimpacience closed 2 years ago

hammersbaldthegodofimpacience commented 2 years ago

when processing code and producing a json output file, the json file misses the commas as separators between objects representing individual findings.

call:

cobra -f misra2012 -json+ -recursive '*.c'

result:

[
  { "type"  :   "(Required) The atof, atoi, atol and atoll fcts of <stdlib.h> shall not be used",
    "message"   :   "lines 268..268",
    "source"    :   "{  e->val = atoi(e->s);",
    "file"  :   "./cobra_array.c",
    "line"  :   268,
    "cobra" :   "1 6 0"
  }
]
[
  { "type"  :   "(Required) The memory allocation and deallocation fcts of <stdlib.h> shall not be used",
    "message"   :   "lines 751..751",
    "source"    :   "a->ht = (Arr_el **) emalloc(H_SIZE * sizeof(Arr_el *), 9);",
    "file"  :   "./cobra_array.c",
    "line"  :   751,
    "cobra" :   "1 10 0"
  }
  { "type"  :   "(Required) The memory allocation and deallocation fcts of <stdlib.h> shall not be used",
    "message"   :   "lines 748..748",
    "source"    :   "{  a = (Arr_var *) emalloc(sizeof(Arr_var), 8);",
    "file"  :   "./cobra_array.c",
    "line"  :   748,
    "cobra" :   "1 8 0"
  }
  { "type"  :   "(Required) The memory allocation and deallocation fcts of <stdlib.h> shall not be used",
    "message"   :   "lines 735..735",
    "source"    :   "{  statstring[i] = (char *) emalloc(512 * sizeof(char), 7); ",
    "file"  :   "./cobra_array.c",
    "line"  :   735,
    "cobra" :   "1 11 0"
  }
...
nimble-code commented 2 years ago

will check it out and fix

nimble-code commented 2 years ago

It will be fixed in the next update of Cobra (in a week or so)