Merge pull request #317 from crytic/special_case_echidna_properties

ignore naming convention restriction on echidna_ and crytic_ functions
pull/322/head
Feist Josselin 5 years ago committed by GitHub
commit 9922eb499a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      slither/detectors/naming_convention/naming_convention.py

@ -10,6 +10,7 @@ class NamingConvention(AbstractDetector):
Exceptions: Exceptions:
- Allow constant variables name/symbol/decimals to be lowercase (ERC20) - 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 - 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' 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 not self.is_mixed_case(func.name):
if func.visibility in ['internal', 'private'] and self.is_mixed_case_with_underscore(func.name): if func.visibility in ['internal', 'private'] and self.is_mixed_case_with_underscore(func.name):
continue continue
if func.name.startswith("echidna_") or func.name.startswith("crytic_"):
continue
info = "Function '{}' ({}) is not in mixedCase\n" info = "Function '{}' ({}) is not in mixedCase\n"
info = info.format(func.canonical_name, func.source_mapping_str) info = info.format(func.canonical_name, func.source_mapping_str)

Loading…
Cancel
Save