Skip to content

Conversation

@vignesh-aerlync
Copy link
Contributor

@vignesh-aerlync vignesh-aerlync commented Nov 8, 2025

Fix checkpatch not warning when blank line after declaration
is removed. Updated regexes to also handle context lines,
ensuring consistent detection.

Fixes: #98976

@Thalley
Copy link
Contributor

Thalley commented Nov 10, 2025

@vignesh-aerlync I tried cherry-picking the offending commit from #98406 that caused me to create the reference issue, and then cherry-picked your commit here, but checkpatch.pl still does not fail. How did you test your changes?

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.

Does not seem to fix the issue

@vignesh-aerlync
Copy link
Contributor Author

@vignesh-aerlync I tried cherry-picking the offending commit from #98406 that caused me to create the reference issue, and then cherry-picked your commit here, but checkpatch.pl still does not fail. How did you test your changes?

I tested it by modifying an existing source file in Zephyr and creating a dummy commit to verify that checkpatch.pl correctly reports the missing blank line warning.

zephyr_fork/zephyr$ git show | ./scripts/checkpatch.pl 
-:18: WARNING:LINE_SPACING: Missing a blank line after declarations
#18: FILE: samples/sensor/lis2dh/src/main.c:83:
 		int rc;
 		trig.type = SENSOR_TRIG_DATA_READY;

@Thalley Thalley dismissed their stale review November 10, 2025 12:49

False negative

Thalley
Thalley previously approved these changes Nov 10, 2025
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 PR seems to fix the issue (after doing proper testing). Not sure whether the changes are valid though, so someone who is more familiar with this should review

@vignesh-aerlync
Copy link
Contributor Author

@vignesh-aerlync I tried cherry-picking the offending commit from #98406 that caused me to create the reference issue, and then cherry-picked your commit here, but checkpatch.pl still does not fail. How did you test your changes?

Thanks for pointing that out . I tested in #98406 ,my patch missed handling that particular case you mentioned. I’ll update my change accordingly.

Fix checkpatch not warning when blank line after declaration
is removed. Updated regexes to also handle context lines,
ensuring consistent detection.

Fixes: zephyrproject-rtos#98976

Signed-off-by: Vignesh Pandian <vignesh@aerlync.com>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

checkpatch: Missing line after declaration not enforced if line is removed

4 participants