checkpatch: fix TYPO_SPELLING check for words with apostrophe
RFC PATCH 1/1 checkpatch: fix TYPO_SPELLING check for words with apostrophe
checkpatch reports a false warning for some words containing an apostrophe.
A false positive is "doesn't". Occurrence of the word causes checkpatch to emit the following warning:
"WARNING: 'doesn'' may be misspelled - perhaps 'doesn't'?"
Check if any word character is present after the word boundary in such cases. If present, it means a subpart of the word has been matched and a warning should not be emitted.
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -3106,7 +3106,7 @@ sub process { # Check for various typo / spelling mistakes if (defined($misspellings) && ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { - while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) { + while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b(?![a-z@]+)|$|[^a-z@])/gi) { my $typo = $1; my $typo_fix = $spelling_fix{lc($typo)}; $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
Signature · 6 lines
2.27.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 7 lines · Dwaipayan Ray
checkpatch reports a false warning for some words containing an apostrophe.
A false positive is "doesn't". Occurrence of the word causes checkpatch to emit the following warning:
Quoted 8 lines
"WARNING: 'doesn'' may be misspelled - perhaps 'doesn't'?"
Check if any word character is present after the word boundary in such cases. If present, it means a subpart of the word has been matched and a warning should not be emitted.
Reported-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>
Looks good to me; I am wondering if it is useful to point out to rewrite this to "does not" because commit messages are "formal content", and not so much spoken language.
Lukas
Quoted 18 lines
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/checkpatch.pl +1
-2@@ -3106,7 +3106,7 @@ sub process { # Check for various typo / spelling mistakes if (defined($misspellings) && ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { - while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) { + while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b(?![a-z@]+)|$|[^a-z@])/gi) { my $typo = $1; my $typo_fix = $spelling_fix{lc($typo)}; $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); --
Quoted 2 lines
2.27.0
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 15 lines · Lukas Bulwahn
Quoted 13 lines · Dwaipayan Ray
checkpatch reports a false warning for some words containing an apostrophe.
A false positive is "doesn't". Occurrence of the word causes checkpatch to emit the following warning:
"WARNING: 'doesn'' may be misspelled - perhaps 'doesn't'?"
Check if any word character is present after the word boundary in such cases. If present, it means a subpart of the word has been matched and a warning should not be emitted.
Quoted 7 lines
Quoted 2 lines
Reported-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>Looks good to me; I am wondering if it is useful to point out to rewrite this to "does not" because commit messages are "formal content", and not so much spoken language.
Yes, that's right. But I guess we could give the authors some freedom to choose their language style. Personally for me this kind of WARNING would be annoying. I think a CHECK might be possible, but don't know if we would be over restricting authors then.
Thanks,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 12 lines · Dwaipayan Ray
checkpatch reports a false warning for some words containing an apostrophe.
A false positive is "doesn't". Occurrence of the word causes checkpatch to emit the following warning:
"WARNING: 'doesn'' may be misspelled - perhaps 'doesn't'?"
Check if any word character is present after the word boundary in such cases. If present, it means a subpart of the word has been matched and a warning should not be emitted.
Quoted 5 lines
Reported-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks for fixing it! Glad to see checkpatch is happy :)
FWIW, the patch is:
Thanks,
Peilin Ye
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 20 lines · Peilin Ye
Quoted 12 lines · Dwaipayan Ray
checkpatch reports a false warning for some words containing an apostrophe.
A false positive is "doesn't". Occurrence of the word causes checkpatch to emit the following warning:
"WARNING: 'doesn'' may be misspelled - perhaps 'doesn't'?"
Check if any word character is present after the word boundary in such cases. If present, it means a subpart of the word has been matched and a warning should not be emitted.
Quoted 5 lines
Reported-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Thanks for fixing it! Glad to see checkpatch is happy :)
FWIW, the patch is:
Tested-by Peilin Ye <[email protected]>
Thanks for testing it Peilin!
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees