Skip to content

Conversation

nashif
Copy link
Member

@nashif nashif commented Sep 12, 2025

  • Detects #define statements with lowercase macro names
  • Detects enum labels starting with lowercase letters

Fixes #95679

Signed-off-by: Anas Nashif [email protected]

Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that it fixes the issue I raised.

I tried the patch with

#define DUM_DUM_val 5
#define dum_dum_val 5

and only dum_dum_val failed; i.e. it does not seem to catch DUM_DUM_val

- Detects #define statements with lowercase macro names
- Detects enum labels starting with lowercase letters

Fixes zephyrproject-rtos#95679

Signed-off-by: Anas Nashif <[email protected]>
@nashif nashif force-pushed the topic/cg/checkpatch_case branch from 7b34e4b to 9ed2be7 Compare September 12, 2025 11:49
Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest patch seem to give the expected result

WARNING : Test Checkpatch warning: 
MACRO_CASE: Macro name 'DUM_DUM_val' should be capitalized (names of macros defining constants should be capitalized)
File:include/zephyr/bluetooth/bluetooth.h
Line:49
WARNING : Test Checkpatch warning: 
MACRO_CASE: Macro name 'dum_dum_val' should be capitalized (names of macros defining constants should be capitalized)
File:include/zephyr/bluetooth/bluetooth.h
Line:50
WARNING : Test Checkpatch warning: 
ENUM_CASE: Enum label 'dummy_val' should be capitalized (names of labels in enums should be capitalized)
File:include/zephyr/bluetooth/bluetooth.h
Line:53

Copy link

@nashif nashif marked this pull request as ready for review September 12, 2025 12:04
@zephyrbot zephyrbot added the area: Coding Guidelines Coding guidelines and style label Sep 12, 2025
my $enum_name = $1;
my $in_enum = 0;
# Look back to see if we're inside an enum
for (my $ln = $linenr - 1; $ln >= $linenr - 20 && $ln >= 0; $ln--) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searching back 20 lines enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Coding Guidelines Coding guidelines and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI does not catch enums with non-capitalized letters
4 participants