Fix incorrect json output format for ConstantPragma and IncorrectSolc

pull/179/head
Josselin 6 years ago
parent d6594f2f87
commit 982a0a63ab
  1. 5
      slither/detectors/attributes/constant_pragma.py
  2. 5
      slither/detectors/attributes/incorrect_solc.py

@ -37,8 +37,9 @@ class ConstantPragma(AbstractDetector):
json = self.generate_json_result(info)
# follow the same format than add_nodes_to_json
json['expressions'] = [{'expression': p.version,
'source_mapping': p.source_mapping} for p in pragma]
json['elements'] = [{'type': 'expression',
'expression': p.version,
'source_mapping': p.source_mapping} for p in pragma]
results.append(json)
return results

@ -93,8 +93,9 @@ We recommend avoiding complex pragma statement.'''
json = self.generate_json_result(info)
# follow the same format than add_nodes_to_json
json['expressions'] = [{'expression': p.version,
'source_mapping': p.source_mapping} for (reason, p) in disallowed_pragmas]
json['elements'] = [{'type': 'expression',
'expression': p.version,
'source_mapping': p.source_mapping} for (reason, p) in disallowed_pragmas]
results.append(json)
return results

Loading…
Cancel
Save