8000 ci: use pre-commit hooks to static code check by dmyger · Pull Request #1173 · tarantool/tt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

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

Merged
merged 7 commits into from
Jun 26, 2025

Conversation

dmyger
Copy link
Collaborator
@dmyger dmyger commented Jun 16, 2025

On CI github action uses scripts for static code checks from pre-commit hooks.

I didn't forget about (remove if it is not applicable):

  • Well-written commit messages (see documentation how to write a commit message)
    Related issues:

Closes #TNTP-2939

PR goes in couple with #1178.

@dmyger dmyger force-pushed the dmyger/tntp-2939_CI_pre-commit_hooks branch 9 times, most recently from b5e5abc to 3cde441 Compare June 16, 2025 17:03
@dmyger dmyger marked this pull request as ready for review June 16, 2025 17:34
@dmyger dmyger force-pushed the dmyger/tntp-2939_CI_pre-commit_hooks branch 2 times, most recently from be3f4d1 to f01b11b Compare June 17, 2025 10:43
@dmyger dmyger force-pushed the dmyger/tntp-2939_CI_pre-commit_hooks branch 2 times, most recently from 22d1720 to e133680 Compare June 23, 2025 14:47
@dmyger dmyger requested a review from oleg-jukovec June 23, 2025 14:51
@dmyger dmyger force-pushed the dmyger/tntp-2939_CI_pre-commit_hooks branch from e133680 to 14d3c1b Compare June 23, 2025 15:44
8000
@dmyger dmyger added the full-ci Enables full ci tests label Jun 23, 2025
dmyger added 6 commits June 23, 2025 19:11
Pass Ruff rules to all Python files.

Part of #TNTP-2939
Ensure all comments end with a period.

Part of #TNTP-2932
@dmyger dmyger force-pushed the dmyger/tntp-2939_CI_pre-commit_hooks branch from 14d3c1b to d8caa44 Compare June 23, 2025 16:12
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.
Copy link
Contributor

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?

Copy link
Collaborator Author
@dmyger dmyger Jun 24, 2025

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.

oleg-jukovec
force-case-trailing-whitespace: 2
allow-cuddle-used-in-block: true
force-err-cuddling: true
# wsl:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it disabled?

Copy link
Collaborator Author

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.

@dmyger dmyger requested a review from oleg-jukovec June 24, 2025 11:13
As workaround until `tail` library is fixed, increase the number of
test retries.

Part of #TNTP-2939
@dmyger dmyger merged commit 8b70301 into master Jun 26, 2025
24 checks passed
@dmyger dmyger deleted the dmyger/tntp-2939_CI_pre-commit_hooks branch June 26, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Enables full ci tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0