|
|
@ -42,7 +42,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
def detect(self): |
|
|
|
def detect(self): |
|
|
|
|
|
|
|
|
|
|
|
results = [] |
|
|
|
results = [] |
|
|
|
for contract in sorted(self.contracts, key=lambda c: c.name): |
|
|
|
for contract in self.contracts: |
|
|
|
|
|
|
|
|
|
|
|
if not self.is_cap_words(contract.name): |
|
|
|
if not self.is_cap_words(contract.name): |
|
|
|
info = "Contract '{}' is not in CapWords".format(contract.name) |
|
|
|
info = "Contract '{}' is not in CapWords".format(contract.name) |
|
|
@ -53,7 +53,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'contract': contract.name, |
|
|
|
'contract': contract.name, |
|
|
|
'sourceMapping': contract.source_mapping}) |
|
|
|
'sourceMapping': contract.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for struct in sorted(contract.structures, key=lambda x: x.name): |
|
|
|
for struct in contract.structures: |
|
|
|
if struct.contract != contract: |
|
|
|
if struct.contract != contract: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'struct': struct.name, |
|
|
|
'struct': struct.name, |
|
|
|
'sourceMapping': struct.source_mapping}) |
|
|
|
'sourceMapping': struct.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for event in sorted(contract.events, key=lambda x: x.name): |
|
|
|
for event in contract.events: |
|
|
|
if event.contract != contract: |
|
|
|
if event.contract != contract: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
@ -81,7 +81,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'event': event.name, |
|
|
|
'event': event.name, |
|
|
|
'sourceMapping': event.source_mapping}) |
|
|
|
'sourceMapping': event.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for func in sorted(contract.functions, key=lambda x: x.name): |
|
|
|
for func in contract.functions: |
|
|
|
if func.contract != contract: |
|
|
|
if func.contract != contract: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
@ -95,7 +95,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'function': func.name, |
|
|
|
'function': func.name, |
|
|
|
'sourceMapping': func.source_mapping}) |
|
|
|
'sourceMapping': func.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for argument in sorted(func.parameters, key=lambda x: x.name): |
|
|
|
for argument in func.parameters: |
|
|
|
if argument in func.variables_read_or_written: |
|
|
|
if argument in func.variables_read_or_written: |
|
|
|
correct_naming = self.is_mixed_case(argument.name) |
|
|
|
correct_naming = self.is_mixed_case(argument.name) |
|
|
|
else: |
|
|
|
else: |
|
|
@ -112,7 +112,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'argument': argument.name, |
|
|
|
'argument': argument.name, |
|
|
|
'sourceMapping': argument.source_mapping}) |
|
|
|
'sourceMapping': argument.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for var in sorted(contract.state_variables, key=lambda x: x.name): |
|
|
|
for var in contract.state_variables: |
|
|
|
if var.contract != contract: |
|
|
|
if var.contract != contract: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
@ -158,7 +158,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'variable': var.name, |
|
|
|
'variable': var.name, |
|
|
|
'sourceMapping': var.source_mapping}) |
|
|
|
'sourceMapping': var.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for enum in sorted(contract.enums, key=lambda x: x.name): |
|
|
|
for enum in contract.enums: |
|
|
|
if enum.contract != contract: |
|
|
|
if enum.contract != contract: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
@ -172,7 +172,7 @@ class NamingConvention(AbstractDetector): |
|
|
|
'enum': enum.name, |
|
|
|
'enum': enum.name, |
|
|
|
'sourceMapping': enum.source_mapping}) |
|
|
|
'sourceMapping': enum.source_mapping}) |
|
|
|
|
|
|
|
|
|
|
|
for modifier in sorted(contract.modifiers, key=lambda x: x.name): |
|
|
|
for modifier in contract.modifiers: |
|
|
|
if modifier.contract != contract: |
|
|
|
if modifier.contract != contract: |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|