Merge pull request #1530 from bart1e/no_uppercase_for_public_vars

'Not in UPPER_CASE_WITH_UNDERSCORES' warning for public constant vars removed
pull/1529/merge
Feist Josselin 2 years ago committed by GitHub
commit 2caf510909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      slither/detectors/naming_convention/naming_convention.py
  2. 4
      tests/detectors/naming-convention/0.4.25/no_warning_for_public_constants.sol
  3. 3
      tests/detectors/naming-convention/0.4.25/no_warning_for_public_constants.sol.0.4.25.NamingConvention.json
  4. 4
      tests/detectors/naming-convention/0.5.16/no_warning_for_public_constants.sol
  5. 3
      tests/detectors/naming-convention/0.5.16/no_warning_for_public_constants.sol.0.5.16.NamingConvention.json
  6. 4
      tests/detectors/naming-convention/0.6.11/no_warning_for_public_constants.sol
  7. 3
      tests/detectors/naming-convention/0.6.11/no_warning_for_public_constants.sol.0.6.11.NamingConvention.json
  8. 4
      tests/detectors/naming-convention/0.7.6/no_warning_for_public_constants.sol
  9. 3
      tests/detectors/naming-convention/0.7.6/no_warning_for_public_constants.sol.0.7.6.NamingConvention.json
  10. 20
      tests/test_detectors.py

@ -139,7 +139,8 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2
# For ERC20 compatibility
if var.name in ["symbol", "name", "decimals"]:
continue
if var.visibility == "public":
continue
if not self.is_upper_case_with_underscores(var.name):
info = [
"Constant ",

@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}

@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}

@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}

@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}

@ -609,6 +609,26 @@ ALL_TEST_OBJECTS = [
"naming_convention.sol",
"0.7.6",
),
Test(
all_detectors.NamingConvention,
"no_warning_for_public_constants.sol",
"0.4.25",
),
Test(
all_detectors.NamingConvention,
"no_warning_for_public_constants.sol",
"0.5.16",
),
Test(
all_detectors.NamingConvention,
"no_warning_for_public_constants.sol",
"0.6.11",
),
Test(
all_detectors.NamingConvention,
"no_warning_for_public_constants.sol",
"0.7.6",
),
Test(
all_detectors.ControlledDelegateCall,
"controlled_delegatecall.sol",

Loading…
Cancel
Save