From f28f3704c4c505c3f904899d8a3f0ca3939b390e Mon Sep 17 00:00:00 2001 From: Josselin Date: Fri, 26 Oct 2018 16:52:25 +0100 Subject: [PATCH] NamingConvention: Clean code --- .../naming_convention/naming_convention.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/slither/detectors/naming_convention/naming_convention.py b/slither/detectors/naming_convention/naming_convention.py index 02aafd4c8..f3312c1f0 100644 --- a/slither/detectors/naming_convention/naming_convention.py +++ b/slither/detectors/naming_convention/naming_convention.py @@ -44,7 +44,7 @@ class NamingConvention(AbstractDetector): results = [] for contract in self.contracts: - if self.is_cap_words(contract.name) is False: + if not self.is_cap_words(contract.name): info = "Contract '{}' is not in CapWords".format(contract.name) self.log(info) @@ -57,7 +57,7 @@ class NamingConvention(AbstractDetector): if struct.contract != contract: continue - if self.is_cap_words(struct.name) is False: + if not self.is_cap_words(struct.name): info = "Struct '{}' is not in CapWords, Contract: '{}' ".format(struct.name, contract.name) self.log(info) @@ -71,7 +71,7 @@ class NamingConvention(AbstractDetector): if event.contract != contract: continue - if self.is_cap_words(event.name) is False: + if not self.is_cap_words(event.name): info = "Event '{}' is not in CapWords, Contract: '{}' ".format(event.name, contract.name) self.log(info) @@ -85,7 +85,7 @@ class NamingConvention(AbstractDetector): if func.contract != contract: continue - if self.is_mixed_case(func.name) is False: + if not self.is_mixed_case(func.name): info = "Function '{}' is not in mixedCase, Contract: '{}' ".format(func.name, contract.name) self.log(info) @@ -97,10 +97,10 @@ class NamingConvention(AbstractDetector): for argument in func.parameters: if argument in func.variables_read_or_written: - incorrect_naming = self.is_mixed_case(argument.name) is False + correct_naming = self.is_mixed_case(argument.name) else: - incorrect_naming = self.is_mixed_case_with_underscore(argument.name) is False - if incorrect_naming: + correct_naming = self.is_mixed_case_with_underscore(argument.name) + if not correct_naming: info = "Parameter '{}' is not in mixedCase, Contract: '{}', Function: '{}'' " \ .format(argument.name, argument.name, contract.name) self.log(info) @@ -117,7 +117,7 @@ class NamingConvention(AbstractDetector): continue if self.should_avoid_name(var.name): - if self.is_upper_case_with_underscores(var.name) is False: + if not self.is_upper_case_with_underscores(var.name): info = "Variable '{}' l, O, I should not be used, Contract: '{}' " \ .format(var.name, contract.name) self.log(info) @@ -133,7 +133,7 @@ class NamingConvention(AbstractDetector): if var.name in ['symbol', 'name', 'decimals']: continue - if self.is_upper_case_with_underscores(var.name) is False: + if not self.is_upper_case_with_underscores(var.name): info = "Constant '{}' is not in UPPER_CASE_WITH_UNDERSCORES, Contract: '{}' " \ .format(var.name, contract.name) self.log(info) @@ -145,10 +145,10 @@ class NamingConvention(AbstractDetector): 'sourceMapping': var.source_mapping}) else: if var.visibility == 'private': - incorrect_naming = self.is_mixed_case_with_underscore(var.name) is False + correct_naming = self.is_mixed_case_with_underscore(var.name) else: - incorrect_naming = self.is_mixed_case(var.name) is False - if incorrect_naming: + correct_naming = self.is_mixed_case(var.name) + if not correct_naming: info = "Variable '{}' is not in mixedCase, Contract: '{}' ".format(var.name, contract.name) self.log(info) @@ -162,7 +162,7 @@ class NamingConvention(AbstractDetector): if enum.contract != contract: continue - if self.is_cap_words(enum.name) is False: + if not self.is_cap_words(enum.name): info = "Enum '{}' is not in CapWords, Contract: '{}' ".format(enum.name, contract.name) self.log(info) @@ -176,7 +176,7 @@ class NamingConvention(AbstractDetector): if modifier.contract != contract: continue - if self.is_mixed_case(modifier.name) is False: + if not self.is_mixed_case(modifier.name): info = "Modifier '{}' is not in mixedCase, Contract: '{}' ".format(modifier.name, contract.name) self.log(info)