Standardized constant-function detector output (all elements should have a source mapping, info moved to additional_fields field).

pull/226/head
David Pokora 6 years ago
parent 89b0dd417e
commit 625bff8ca2
No known key found for this signature in database
GPG Key ID: 3CED48D1BB21BDD7
  1. 9
      slither/detectors/attributes/const_functions.py

@ -58,10 +58,8 @@ All the calls to `get` revert, breaking Bob's smart contract execution.'''
attr = 'view' if f.view else 'pure'
info = '{}.{} ({}) is declared {} but contains assembly code\n'
info = info.format(f.contract.name, f.name, f.source_mapping_str, attr)
json = self.generate_json_result(info)
json = self.generate_json_result(info, {'contains_assembly': True})
self.add_function_to_json(f, json)
json['elements'].append({'type': 'info',
'contains_assembly' : True})
results.append(json)
variables_written = f.all_state_variables_written()
@ -73,12 +71,9 @@ All the calls to `get` revert, breaking Bob's smart contract execution.'''
info += '\t- {}.{}\n'.format(variable_written.contract.name,
variable_written.name)
json = self.generate_json_result(info)
json = self.generate_json_result(info, {'contains_assembly': False})
self.add_function_to_json(f, json)
self.add_variables_to_json(variables_written, json)
json['elements'].append({'type': 'info',
'contains_assembly' : False})
results.append(json)
return results

Loading…
Cancel
Save