Skip to content

Conversation

@davidgumberg
Copy link
Contributor

@davidgumberg davidgumberg commented Apr 25, 2024

This PR improves subtree exclusion by rewriting lint checks to reuse common exclusion logic. Most lint checks previously did not exclude crypto/ctaes, the locale linter did not exclude src/crc32

Makes the include guards lint check print all missing include guards before exiting.

Supercedes #29744

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 25, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30595 (kernel: Introduce initial C header API by TheCharlatan)
  • #30553 (lint: Find function calls in default arguments by maflcko)
  • #30462 (utils: replace boost::date_time usage with c++20 std::chrono by theuni)
  • #29119 (refactor: Use std::span over Span by maflcko)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@maflcko
Copy link
Member

maflcko commented Apr 26, 2024

The Win64 GHA test failure looks unrelated. If you want, you can split up 54b2115bb848e1aad8a86aae858de63a851235ce into its own pull request, as it is an independent improvement. But up to you.

@davidgumberg
Copy link
Contributor Author

I think I will leave it in here since the motivation for 54b2115 is mostly the increased number of lint checks only accessible through the lint test runner. But I will split it out if anyone has an objection, or if this PR stalls.

@davidgumberg
Copy link
Contributor Author

davidgumberg commented Apr 28, 2024

Windows CI appears to have timed out, rebased to get a fresh CI run.

@maflcko
Copy link
Member

maflcko commented May 20, 2024

Looks like the conflicting #30034 is close(r) to merge, if you want to review it

@fanquake
Copy link
Member

Looks like the conflicting #30034 is close(r) to merge, if you want to review it

This is now merged. Can you rebase here?

@davidgumberg
Copy link
Contributor Author

Rebased to address merge conflict

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 2, 2024

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/25703180537

@maflcko
Copy link
Member

maflcko commented Jun 3, 2024

Any thoughts on splitting the first commit out into a separate pull? Seems to be a requested feature by three people so far, but I am not sure about bundling it for review with the other changes here.

@davidgumberg
Copy link
Contributor Author

Any thoughts on splitting the first commit out into a separate pull? Seems to be a requested feature by three people so far, but I am not sure about bundling it for review with the other changes here.

You are right, split out the first commit into: #30219

achow101 added a commit that referenced this pull request Jun 12, 2024
0fcbfdb Support running individual lint checks (David Gumberg)

Pull request description:

  This PR was split out from  #29965:

  Adds support for running individual tests in the rust lint suite by passing `--lint=LINT_TO_RUN` to the lint runner. This PR also adds a corresponding help message.

  When running with `cargo run`, arguments after a double dash (`--`) are passed to the binary instead of the cargo command. For example, in order to run the linter check that tabs are not used as whitespace:

  ```console
  cd test/lint/test_runner && cargo run -- --lint=tabs_whitespace
  ```

ACKs for top commit:
  maflcko:
    ACK 0fcbfdb
  achow101:
    ACK 0fcbfdb
  marcofleon:
    Tested ACK 0fcbfdb. Ran `cargo run` with various of the individual tests and with bad input. Also ran it with no arguments. Everything works as expected and help message looks good.

Tree-SHA512: 48fe4aa9fbb2acef5f8e3c17382ae22e0e350ae6ad9aeeb1a3c0a9192de98809f98728e32b8db24a36906ace999e35626ebd6cb2ca05f74146d21e9b6fb14615
This makes all the lint checks written in rust exclude subtrees, and
refactors the exclusion lists into a separate file.
Make the include guard linter print all warnings before exiting, and
reuse common exclusion logic to improve subtree exclusion (crypto/ctaes
was previously not excluded)
Rewrites the 'includes' linter to make use of common exclusion logic,
improving subtree exclusion. (crypto/ctaes was previously not excluded)
This commit rewrites the spelling linter to reuse common
exclusion logic and improves subtree exclusion. ('crypto/ctaes' was
previously not excluded)
This commit rewrites the locale linter to reuse common
exclusion logic and improves subtree exclusion (src/crc32c was
previously not excluded)
Rewrites the python encoding lint check to make use of
common exclusion logic.
@davidgumberg davidgumberg changed the title Lint: support running individual rust linters and improve subtree exclusion Lint: improve subtree exclusion Jun 13, 2024
@davidgumberg
Copy link
Contributor Author

Rebased over master since #30219 was merged.

])
.args(["grep", "std::filesystem", "--"])
.args(["--", "./src"])
.args(exclude::get_pathspecs_exclude_std_filesystem())
Copy link
Member

@maflcko maflcko Aug 9, 2024

Choose a reason for hiding this comment

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

nit in 9d1423a: Not sure about moving a single string literal that is used in a single function to a new module into a new function.

args allows for chaining, so if you want to append more args to the existing ones, my recommendation would be to just call args one more time with the args that you want to append.

I think the lint tests can be easy to understand and pragmatic, and adding too many layers may not be useful to understand them.

(This will also make the diff smaller, and is thus easier to review)

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@maflcko
Copy link
Member

maflcko commented Sep 11, 2024

Are you still working on this?

@davidgumberg
Copy link
Contributor Author

Closing this for now, it's up for grabs, if I have a chance to work on this again soon I'll split into smaller PR's

@bitcoin bitcoin locked and limited conversation to collaborators Sep 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants