From d3ba27baea26b8dd3388c8469f5943ac13b7df34 Mon Sep 17 00:00:00 2001 From: agroce Date: Tue, 20 Aug 2019 10:23:19 -0700 Subject: [PATCH 1/2] ignore naming convention restriction on echidna_ and crytic_ functions --- slither/detectors/naming_convention/naming_convention.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slither/detectors/naming_convention/naming_convention.py b/slither/detectors/naming_convention/naming_convention.py index f1f35507c..a4237e07b 100644 --- a/slither/detectors/naming_convention/naming_convention.py +++ b/slither/detectors/naming_convention/naming_convention.py @@ -10,6 +10,7 @@ class NamingConvention(AbstractDetector): Exceptions: - Allow constant variables name/symbol/decimals to be lowercase (ERC20) - Allow '_' at the beggining of the mixed_case match for private variables and unused parameters + - Ignore echidna properties (functions with names starting 'echidna_' or 'crytic_' """ ARGUMENT = 'naming-convention' @@ -97,6 +98,8 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 if not self.is_mixed_case(func.name): if func.visibility in ['internal', 'private'] and self.is_mixed_case_with_underscore(func.name): continue + if (func.name.find("echidna_") == 0) or (func.name.find("crytic_") == 0): + continue info = "Function '{}' ({}) is not in mixedCase\n" info = info.format(func.canonical_name, func.source_mapping_str) From 5468bc1bb1fedbbc3c32ef3d38cbed29756f18cc Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Wed, 21 Aug 2019 04:42:28 -0700 Subject: [PATCH 2/2] Change to startswith --- slither/detectors/naming_convention/naming_convention.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slither/detectors/naming_convention/naming_convention.py b/slither/detectors/naming_convention/naming_convention.py index a4237e07b..f19fad0fc 100644 --- a/slither/detectors/naming_convention/naming_convention.py +++ b/slither/detectors/naming_convention/naming_convention.py @@ -98,7 +98,7 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 if not self.is_mixed_case(func.name): if func.visibility in ['internal', 'private'] and self.is_mixed_case_with_underscore(func.name): continue - if (func.name.find("echidna_") == 0) or (func.name.find("crytic_") == 0): + if func.name.startswith("echidna_") or func.name.startswith("crytic_"): continue info = "Function '{}' ({}) is not in mixedCase\n" info = info.format(func.canonical_name, func.source_mapping_str)