diff --git a/tests/e2e/detectors/snapshots/detectors__detector_NamingConvention_0_6_11_no_warning_for_public_constants_with_override_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_NamingConvention_0_6_11_no_warning_for_public_constants_with_override_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_NamingConvention_0_7_6_no_warning_for_public_constants_with_override_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_NamingConvention_0_7_6_no_warning_for_public_constants_with_override_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/test_data/naming-convention/0.6.11/no_warning_for_public_constants_with_override.sol b/tests/e2e/detectors/test_data/naming-convention/0.6.11/no_warning_for_public_constants_with_override.sol new file mode 100644 index 0000000000..10b667fed7 --- /dev/null +++ b/tests/e2e/detectors/test_data/naming-convention/0.6.11/no_warning_for_public_constants_with_override.sol @@ -0,0 +1,15 @@ +// Regression coverage for https://github.com/crytic/slither/issues/930 +// +// A public constant that overrides an interface getter must NOT be flagged +// by the naming-convention detector for failing UPPER_CASE_WITH_UNDERSCORES. +// The behavior is already covered by the public-constant branch in +// slither/detectors/naming_convention/naming_convention.py, but the existing +// no_warning_for_public_constants.sol fixture does not exercise the `override` +// variant. This file locks that in. +interface I { + function version() external view returns (uint256); +} + +contract C is I { + uint256 public constant override version = 1; +} diff --git a/tests/e2e/detectors/test_data/naming-convention/0.7.6/no_warning_for_public_constants_with_override.sol b/tests/e2e/detectors/test_data/naming-convention/0.7.6/no_warning_for_public_constants_with_override.sol new file mode 100644 index 0000000000..10b667fed7 --- /dev/null +++ b/tests/e2e/detectors/test_data/naming-convention/0.7.6/no_warning_for_public_constants_with_override.sol @@ -0,0 +1,15 @@ +// Regression coverage for https://github.com/crytic/slither/issues/930 +// +// A public constant that overrides an interface getter must NOT be flagged +// by the naming-convention detector for failing UPPER_CASE_WITH_UNDERSCORES. +// The behavior is already covered by the public-constant branch in +// slither/detectors/naming_convention/naming_convention.py, but the existing +// no_warning_for_public_constants.sol fixture does not exercise the `override` +// variant. This file locks that in. +interface I { + function version() external view returns (uint256); +} + +contract C is I { + uint256 public constant override version = 1; +} diff --git a/tests/e2e/detectors/test_detectors.py b/tests/e2e/detectors/test_detectors.py index 7bd6e34600..dc1b6e1f2d 100644 --- a/tests/e2e/detectors/test_detectors.py +++ b/tests/e2e/detectors/test_detectors.py @@ -639,6 +639,16 @@ def id_test(test_item: Test): "no_warning_for_public_constants.sol", "0.7.6", ), + Test( + all_detectors.NamingConvention, + "no_warning_for_public_constants_with_override.sol", + "0.6.11", + ), + Test( + all_detectors.NamingConvention, + "no_warning_for_public_constants_with_override.sol", + "0.7.6", + ), Test( all_detectors.ControlledDelegateCall, "controlled_delegatecall.sol",