Skip to content
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

Lint add warnings instead of check failure #2250

Conversation

Snorch
Copy link
Member

@Snorch Snorch commented Aug 24, 2023

There are multiple cases where good human readable code block is
converted to an unreadable mess by clang-format, so we don't want to
rely on clang-format completely. Also there is no way, as far as I can
see, to make clang-format only fix what we want it to fix without
breaking something.

So let's just display hints inline where clang-format is unhappy. When
reviewer sees such a warning it's a good sign that something is broken
in codding style around this warning.

@Snorch
Copy link
Member Author

Snorch commented Aug 24, 2023

It looks like that:

image

Please remove draft/test: introduce some codding style errors to test new approach when merging this PR, this commit is needed just to illustrate the concept.

@Snorch Snorch force-pushed the lint-add-warnings-instead-of-check-failure branch from 584515d to 557c116 Compare August 24, 2023 08:36
@Snorch Snorch requested review from adrianreber and avagin August 24, 2023 08:37
@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2023

Codecov Report

Patch coverage: 84.61% and project coverage change: +0.06% 🎉

Comparison is base (5fedcaa) 70.62% compared to head (6ce24a5) 70.68%.
Report is 14 commits behind head on criu-dev.

❗ Current head 6ce24a5 differs from pull request most recent head 99d878b. Consider uploading reports for the commit 99d878b to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           criu-dev    #2250      +/-   ##
============================================
+ Coverage     70.62%   70.68%   +0.06%     
============================================
  Files           133      133              
  Lines         33322    33328       +6     
============================================
+ Hits          23532    23557      +25     
+ Misses         9790     9771      -19     
Files Changed Coverage Δ
criu/proc_parse.c 68.54% <50.00%> (-0.03%) ⬇️
criu/memfd.c 82.77% <85.71%> (+1.00%) ⬆️
compel/src/lib/infect.c 54.67% <100.00%> (+0.18%) ⬆️
criu/files-reg.c 75.38% <100.00%> (+0.02%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

criu/mount.c Outdated Show resolved Hide resolved
@Snorch Snorch force-pushed the lint-add-warnings-instead-of-check-failure branch 2 times, most recently from bd2e675 to 09980dc Compare August 29, 2023 04:44
@Snorch
Copy link
Member Author

Snorch commented Aug 29, 2023

I've added changes to CONTRIBUTING.md with bad clang-formating examples to PR and a link from warnings to CONTRIBUTING.md, so that it would be easier to understand how this warning should be handled.

@Snorch Snorch force-pushed the lint-add-warnings-instead-of-check-failure branch 4 times, most recently from f027924 to f005eb2 Compare August 29, 2023 05:11
scripts/github-indent-warnings.py Fixed Show fixed Hide fixed
scripts/github-indent-warnings.py Fixed Show fixed Hide fixed
@Snorch Snorch force-pushed the lint-add-warnings-instead-of-check-failure branch 2 times, most recently from df89fdb to 69b68e9 Compare August 29, 2023 05:20
Snorch added 3 commits August 29, 2023 13:21
Ctags is mentioned in the beginning of the "Edit the source code" which
is really confusing: Do you need ctags to edit CRIU code? - No. It is
just one helpful tool to browse the code, and we do not want to enforce
it. So, what is it doing in contribution guide? People who really need
it should be able to find it in Makefile or just write oneliner of their
own to collect tags...

Signed-off-by: Pavel Tikhomirov <[email protected]>
This is highlight that code readability is the real goal of all the
coding-style rules. We should not do coding-style just for coding-style,
e.g. when clang-format suggests crazy formating we should not follow it
if we feel it is bad.

Signed-off-by: Pavel Tikhomirov <[email protected]>
There are multiple cases where good human readable code block is
converted to an unreadable mess by clang-format, so we don't want to
rely on clang-format completely. Also there is no way, as far as I can
see, to make clang-format only fix what we want it to fix without
breaking something.

So let's just display hints inline where clang-format is unhappy. When
reviewer sees such a warning it's a good sign that something is broken
in coding-style around this warning.

We add special script which parses diff generated by indent and
generates warning for each hunk.

Signed-off-by: Pavel Tikhomirov <[email protected]>
@Snorch Snorch force-pushed the lint-add-warnings-instead-of-check-failure branch from 69b68e9 to 1a5d201 Compare August 29, 2023 05:26
@Snorch Snorch requested review from rst0git and avagin August 30, 2023 02:44
@Snorch Snorch force-pushed the lint-add-warnings-instead-of-check-failure branch from 1a5d201 to 99d878b Compare August 30, 2023 03:52
@Snorch
Copy link
Member Author

Snorch commented Aug 30, 2023

I've removed test commit to trigger warnings (it works), so it's now ready to merge.

@avagin avagin merged commit 03541c0 into checkpoint-restore:criu-dev Aug 31, 2023
35 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants