Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Not in UPPER_CASE_WITH_UNDERSCORES' warning for public constant vars removed #1530

Merged
merged 5 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion slither/detectors/naming_convention/naming_convention.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def _detect(self): # pylint: disable=too-many-branches,too-many-statements
# 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 ",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
[]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
[]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
[]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contract A
{
uint256 public constant myVal = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
[]
]
20 changes: 20 additions & 0 deletions tests/test_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,26 @@ def id_test(test_item: Test):
"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",
Expand Down