|
|
|
@ -51,16 +51,14 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
def should_avoid_name(name): |
|
|
|
|
return re.search('^[lOI]$', name) is not None |
|
|
|
|
|
|
|
|
|
def detect(self): |
|
|
|
|
def _detect(self): |
|
|
|
|
|
|
|
|
|
results = [] |
|
|
|
|
all_info = '' |
|
|
|
|
for contract in self.contracts: |
|
|
|
|
|
|
|
|
|
if not self.is_cap_words(contract.name): |
|
|
|
|
info = "Contract '{}' ({}) is not in CapWords\n".format(contract.name, |
|
|
|
|
contract.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -78,7 +76,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not self.is_cap_words(struct.name): |
|
|
|
|
info = "Struct '{}.{}' ({}) is not in CapWords\n" |
|
|
|
|
info = info.format(struct.contract.name, struct.name, struct.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -95,7 +92,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not self.is_cap_words(event.name): |
|
|
|
|
info = "Event '{}.{}' ({}) is not in CapWords\n" |
|
|
|
|
info = info.format(event.contract.name, event.name, event.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -113,7 +109,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not self.is_mixed_case(func.name): |
|
|
|
|
info = "Function '{}.{}' ({}) is not in mixedCase\n" |
|
|
|
|
info = info.format(func.contract.name, func.name, func.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -135,7 +130,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
argument.function.contract.name, |
|
|
|
|
argument.function, |
|
|
|
|
argument.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -154,7 +148,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not self.is_upper_case_with_underscores(var.name): |
|
|
|
|
info = "Variable '{}.{}' ({}) used l, O, I, which should not be used\n" |
|
|
|
|
info = info.format(var.contract.name, var.name, var.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -173,7 +166,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not self.is_upper_case_with_underscores(var.name): |
|
|
|
|
info = "Constant '{}.{}' ({}) is not in UPPER_CASE_WITH_UNDERSCORES\n" |
|
|
|
|
info = info.format(var.contract.name, var.name, var.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -192,7 +184,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not correct_naming: |
|
|
|
|
info = "Variable '{}.{}' ({}) is not in mixedCase\n" |
|
|
|
|
info = info.format(var.contract.name, var.name, var.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -210,7 +201,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
if not self.is_cap_words(enum.name): |
|
|
|
|
info = "Enum '{}.{}' ({}) is not in CapWords\n" |
|
|
|
|
info = info.format(enum.contract.name, enum.name, enum.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -231,7 +221,6 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
info = info.format(modifier.contract.name, |
|
|
|
|
modifier.name, |
|
|
|
|
modifier.source_mapping_str) |
|
|
|
|
all_info += info |
|
|
|
|
|
|
|
|
|
json = self.generate_json_result(info) |
|
|
|
|
elem = dict() |
|
|
|
@ -242,7 +231,5 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 |
|
|
|
|
json['elements'] = [elem] |
|
|
|
|
results.append(json) |
|
|
|
|
|
|
|
|
|
if all_info != '': |
|
|
|
|
self.log(all_info) |
|
|
|
|
|
|
|
|
|
return results |
|
|
|
|