Skip to content

Commit ed99fde

Browse files
committed
Remove prefix exception for constexpr constants
1 parent 15ed236 commit ed99fde

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

.clang-tidy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ CheckOptions:
44
- { key: readability-identifier-naming.ClassMemberPrefix, value: m }
55
- { key: readability-identifier-naming.ConceptCase, value: CamelCase }
66
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
7-
- { key: readability-identifier-naming.ConstexprVariableIgnoredRegexp, value: "^k[A-Z][a-zA-Z0-9]*$" } # Allow "k" prefix.
87
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
98
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
10-
- { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and underscores.
9+
- { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and non-trailing underscores in PDG names.
1110
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
1211
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
1312
- { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z][A-Z0-9_]*_$" } # Allow the trailing underscore in header guards.

Scripts/o2_linter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ class TestNameConstant(TestSpec):
989989

990990
name = "name/constexpr-constant"
991991
message = (
992-
'Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".'
992+
'Use UpperCamelCase for names of constexpr constants.'
993993
)
994994
rationale = rationale_names
995995
references = references_names
@@ -1013,8 +1013,6 @@ def test_line(self, line: str) -> bool:
10131013
return True
10141014
constant_name = match.group(4)
10151015
# The actual test comes here.
1016-
if constant_name.startswith("k") and len(constant_name) > 1: # exception for special constants
1017-
constant_name = constant_name[1:] # test the name without "k"
10181016
return is_upper_camel_case(constant_name)
10191017

10201018

0 commit comments

Comments
 (0)