-
Notifications
You must be signed in to change notification settings - Fork 7.4k
scripts: update checkpatch based on current linux kernel version #27469
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
Conversation
.checkpatch.conf
Outdated
@@ -1,7 +1,7 @@ | |||
--emacs | |||
--summary-file | |||
--show-types | |||
--max-line-length=80 | |||
--max-line-length=100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be discussed, I am fine with that. I also think we should decide if we keep following the linux style with changes or if we should establish our own based on a list of rules (from Linux and others) and grow from there. Changes that happen to Linux should not be automatically adopted into Zephyr, thats why we have a few exceptions already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember seeing the LKML discussion about this and as someone who uses a text editor with multiple columns I would not be thrilled with this change to the coding style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If accepted, we need to update .editorconfig
to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember thinking about this, but apparently didn't do it. Done now: all line length checks updated in one combined commit.
@@ -3105,7 +3159,7 @@ sub process { | |||
$comment = '/*'; | |||
} elsif ($realfile =~ /\.(c|dts|dtsi)$/) { | |||
$comment = '//'; | |||
} elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc)$/) { | |||
} elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc|yaml)$/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would introduce a license check against .yaml files in the Zephyr tree, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably. AFAIK we were already requiring that, it just (maybe) wasn't being checked.
Also see #27058 on clang-format and #21392 which is the motivating driver for a lot of this effort. I will say I hate some of what clang-format does. But I'd rather have an objective standard against which style conformance can be measured than the "This way is right", "no this way is right" we have now. |
I would not say clang-format is a standard, you make your own standard and enable/disable based on your needs, clang-format is just a tool |
yes, I was referring to what |
881ef58
to
bd1310b
Compare
I don't want to hold up this whole patch but can we separate out the line length policy change into its own PR? |
agree, I would just keep the 80 in the dot file, because this one has nothing to do with the script changes and syncing with upstream, we will need to decide on moving to 100 in a different thread... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding -1 until column policy change is separated out
This squashes and applies the Linux diffs to scripts/checkpatch.pl between Linux commit 16fbf79b0f83bc75 ("Linux 5.6-rc7") and 9123e3a74ec7b93 ("Linux 5.9-rc1") except for commits identified below. The last 1000 commits to Zephyr master were compared for checkpatch output differences between the previous Zephyr version and this version. One new diagnostic about function declarations with an empty parameter-list was introduced (FUNCTION_WITHOUT_ARGS). The text of an existing diagnostic was changed (DT_SPLIT_BINDING_PATCH). The text of LONG_LINE diagnostics was enhanced to provide the actual line length. Linux commit dfa05c28ca7ffc0a ("checkpatch: remove email address comment from email address comparisons") was removed because differences in the scripts resulted in false signed-off-by check diagnostics when a full name included characters not in Basic Latin, due to changes in how the author name was extracted. Earlier upstream changes not integrated into Zephyr may be required. Linux commit b95692f8b3000166 ("checkpatch: prefer fallthrough; over fallthrough comments") was removed because Zephyr doesn't support the upstream pseudo keyword. Linux commit bdc48fa11e46f867 ("checkpatch/coding-style: deprecate 80-column warning") was edited to not actually change the 80-column maximum line limit as this change has not been mooted for Zephyr. Linux commit ced69da1db0b57bb ("checkpatch: fix CONST_STRUCT when const_structs.checkpatch is missing") was edited to the CONST_STRUCT file as that's not supported in Zephyr. Signed-off-by: Peter A. Bigot <[email protected]>
A new check in Linux checks for repeated words, which spews false positives from text like: * @param param the parameter * @param device device instance Signed-off-by: Peter A. Bigot <[email protected]>
bd1310b
to
b2f44f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks LGTM!
The maximum line length changes have been separated out and are tracked in https://github.com/pabigot/zephyr/tree/pabigot/20200810a%2Bll so they're easy to apply later. I've added six more changes that were added in Linux since I opened this 10 days ago. I've disabled one of those in a separate commit. The PR description has been updated to note the disposition of some of those additions, and remove reference to the line length change. However, there's a problem with the logic of removing a specific policy change from this update. Everybody should be fully aware that as long as we're using Linux checkpatch we're adopting Linux policy, even if we don't see the effect in the test of the last 1000 commits. There are 26 distinct changes to checkpatch aggregated into this squashed commit. Nobody here can tell what they do because we're discarding the commit messages in the squash. I have some idea because I read them all, but I'm not editing them for non-technical reasons. One visible change I think is good while another is perhaps problematic, but it was already present in an equally problematic way anyway. They're mentioned in the updated description. If the consensus is we don't want checkpatch-monitored policy changes from Linux to be adopted into Zephyr, then we should stop updating this script. There's a lot of activity happening up there related to this script, and maybe it's time to stop trying to follow Linux style and codify one for Zephyr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This squashes and applies the Linux diffs to scripts/checkpatch.pl between Linux commit 16fbf79b0f83bc75 ("Linux 5.6-rc7") and 9123e3a74ec7b93 ("Linux 5.9-rc1") except for commits identified below.
The last 1000 commits to Zephyr master were compared for checkpatch output differences between the previous Zephyr version and this version. One new diagnostic about function declarations with an empty parameter-list was introduced (FUNCTION_WITHOUT_ARGS). The text of an existing diagnostic was changed (DT_SPLIT_BINDING_PATCH). The text of LONG_LINE diagnostics was enhanced to provide the actual line length.
Linux commit dfa05c28ca7ffc0a ("checkpatch: remove email address comment from email address comparisons") was removed because differences in the scripts resulted in false signed-off-by check diagnostics when a full name included characters not in Basic Latin, due to changes in how the author name was extracted. Earlier upstream changes not integrated into Zephyr may be required.
Linux commit b95692f8b3000166 ("checkpatch: prefer fallthrough; over fallthrough comments") was removed because Zephyr doesn't support the upstream pseudo keyword.
Linux commit bdc48fa11e46f867 ("checkpatch/coding-style: deprecate 80-column warning") was edited to not actually change the 80-column maximum line limit as this change has not been mooted for Zephyr.
Linux commit ced69da1db0b57bb ("checkpatch: fix CONST_STRUCT when const_structs.checkpatch is missing") was edited to the CONST_STRUCT file as that's not supported in Zephyr.
Also, separately, the new REPEATED_WORD diagnostic was disabled.