Updates format_unused_state to use filename_absolute and apply only to variable types. test_unused_state_vars passes.

pull/238/head
rajeevgopalakrishna 6 years ago
parent c25649eda0
commit d271973965
  1. 3
      utils/slither_format/format_unused_state.py
  2. 2
      utils/slither_format/slither_format.py

@ -3,7 +3,8 @@ class FormatUnusedState:
@staticmethod
def format(slither, patches, elements):
for element in elements:
FormatUnusedState.create_patch(slither, patches, element['source_mapping']['filename'], element['source_mapping']['start'])
if element['type'] == "variable":
FormatUnusedState.create_patch(slither, patches, element['source_mapping']['filename_absolute'], element['source_mapping']['start'])
@staticmethod
def create_patch(slither, patches, in_file, modify_loc_start):

@ -127,6 +127,8 @@ def get_number_of_slither_results (detector_results):
for elem in result['elements']:
if (result['check'] == 'constant-function' and elem['type'] != "function"):
continue
if (result['check'] == 'unused-state' and elem['type'] != "variable"):
continue
number_of_slither_results += 1
return number_of_slither_results

Loading…
Cancel
Save