-
Notifications
You must be signed in to change notification settings - Fork 15
ci: use pre-commit hooks to static code check #1173
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
b5e5abc
to
3cde441
Compare
be3f4d1
to
f01b11b
Compare
22d1720
to
e133680
Compare
e133680
to
14d3c1b
Compare
Closes #TNTP-2939
Pass Ruff rules to all Python files. Part of #TNTP-2939
Ensure all comments end with a period. Part of #TNTP-2932
Part of #TNTP-2939
Part of #TNTP-2939
Part of #TNTP-2939
14d3c1b
to
d8caa44
Compare
version: v1.63.4 | ||
args: --config=golangci-lint.yml --out-${NO_FUTURE}format colored-line-number | ||
skip-cache: true | ||
# FIXME: Enable golangci-lint-diff after PR #1173 is merged. |
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.
So, we need a one more PR?
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.
Yes, the problem is that in order to successfully pass the full
checks, several corrections were made to a number of source files. This, in turn, triggers the diff
check, and these checks are stricter. Therefore, the old files need to be merged with the strict checks turned off, and then turned on again. The second PR #1178 has been added to the chain for this.
force-case-trailing-whitespace: 2 | ||
allow-cuddle-used-in-block: true | ||
force-err-cuddling: true | ||
# wsl: |
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.
Why is it disabled?
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.
Using the wsl
linter conflicts with the gofumpt
formatter. At the same time, it is not possible to achieve compatibility through the linter settings. The formatter, on the other hand, does not allow you to adjust its behaviour at all — everything is hardcoded there.
When both are enabled, one formats the code in its own way, then the other reformats it differently, which causes the first one to generate an error again in the next pass. It's a cyclical dependency.
For example, I encountered the following problem: the formatter expects that after performing any action and subsequently checking the result for errors, there should be no empty lines. And it always finds such places correctly. At the same time, wsl
often makes mistakes and does not always find such places correctly. Issues arise in the code when the check is a bit different from the simple case if(err != nil){...}
, where there may be something more complex like if...else
or error
been checked for type. In such cases, the formatter still considers that this should go together without an extra empty line, while the linter move such a check in a separate logical block.
As workaround until `tail` library is fixed, increase the number of test retries. Part of #TNTP-2939
On
CI
github action uses scripts for static code checks frompre-commit
hooks.I didn't forget about (remove if it is not applicable):
Related issues:
Closes #TNTP-2939
PR goes in couple with #1178.