Re: False-positive in Checkpatch
From: Lukas Bulwahn
Date: Wed Aug 17 2022 - 07:21:00 EST
On Wed, Aug 17, 2022 at 10:29 AM Matthias May <matthias.may@xxxxxxxxxxxx> wrote:
>
> Hi Checkpatch Maintainers
>
> The selftest patch at
> https://lore.kernel.org/netdev/20220817073649.26117-1-matthias.may@xxxxxxxxxxxx/T/#u
> claims too long lines.
> However this seems to be a misinterpretation of the indention before the printf split over 2
> lines to exactly not have too long lines.
> The false positive checkpatch results are also on the netdev patchwork:
> https://patchwork.kernel.org/project/netdevbpf/patch/20220817073649.26117-1-matthias.may@xxxxxxxxxxxx/
>
Hi Matthias,
Thanks for reporting. I tried checkpatch on this referred patch and
can confirm that it reports:
WARNING: line length of 132 exceeds 100 columns
#413: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:359:
+printf "┌────────┬───────┬───────┬──────────────┬"
WARNING: line length of 107 exceeds 100 columns
#414: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:360:
+printf "──────────────┬───────┬────────┐\n"
WARNING: line length of 148 exceeds 100 columns
#420: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:366:
+ printf "├────────┼───────┼───────┼──────────────┼"
WARNING: line length of 123 exceeds 100 columns
#421: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:367:
+ printf "──────────────┼───────┼────────┤\n"
WARNING: line length of 156 exceeds 100 columns
#425: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:371:
+ printf "├────────┼───────┼───────┼──────────────┼"
WARNING: line length of 131 exceeds 100 columns
#426: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:372:
+ printf "──────────────┼───────┼────────┤\n"
WARNING: line length of 132 exceeds 100 columns
#439: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:385:
+printf "└────────┴───────┴───────┴──────────────┴"
WARNING: line length of 107 exceeds 100 columns
#440: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:386:
+printf "──────────────┴───────┴────────┘\n"
In my editor (vim), these lines are rather short but it seems the real
line number is much larger.
For example, in line 420, vim states "420,135-66" at the end of the
line. So, there are clearly different ways of counting the number of
characters this line has. I think that at least explains it, I really
do not know which way of counting is the best, though.
Lukas