-
Notifications
You must be signed in to change notification settings - Fork 37.1k
test: Refactor subtree exclusion in lint tests #29479
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
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
606a0f6
to
86aabbe
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
24dfffe
to
b4d7b7a
Compare
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.
This doesn't feel like much of an improvement as is. We are trading a tiny bit of deduplication for the txt parsing code that is much harder to reason about than the straightforward lists. Maybe there is a simpler way of doing this through a shared python module or so.
This would also need documentation so that people know where to add which dirs for exclusion if there are changes in the future.
94f44de
to
3df289a
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
@fjahr I have changed this to a python script as suggested which is relatively easy to import and is more straight forward
|
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.
Approach ACK, thanks, I like this a lot more.
3df289a
to
6e80169
Compare
utACK 6e80169 |
Concept ACK. |
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.
There is also fn get_pathspecs_exclude_subtrees() -> Vec<String>
. The changes here seem fine. However, an alternative might be to rewrite the 3 lint checks to rust, so that they can use the already existing function. No strong opinion, though.
test/lint/lint_ignore_dirs.py
Outdated
@@ -0,0 +1,5 @@ | |||
SHARED_EXCLUDED_DIRS = ["src/leveldb/", |
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.
I'd say this should be have "subtree" in the name, or is there a reason to globally exclude a folder that is not a subtree?
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.
updated the var to SHARED_EXCLUDED_SUBTREES
6e80169
to
ccf110c
Compare
ccf110c
to
80fa7da
Compare
@maflcko is the ultimate goal to run all lint checks from rust? |
re-ACK 80fa7da
Is there any other benefit to the rewrite, aside from reusing that function? These linters were just recently rewritten to Python and I think a rewrite to rust would be a step back in some regard because we have fewer contributors in the project that are familiar with it. |
lgtm ACK 80fa7da |
Rust is type-safe, so many issues that are found after code is written, reviewed, and merged just can not happen and will be caught, ideally before a pull is reviewed and merged. For example #29068 (comment) would have failed early in Rust ( |
I am aware of the general differences between Rust and Python. If there is consensus that rewriting Python programs to Rust is considered an improvement in general just because of the different language, then we should start with the functional test framework because that sees a lot more usage in terms of runs and code changes, no? But I was rather asking about other arguments that are specific to the linters as was discussed, like the reuse of the function mentioned already. |
This is just my opinion, but I think the benefit of rewriting existing python scripts to rust is limited. Obviously, when a shortcoming is detected, or code needs to be re-structured anyway for another reason, the author can decide to write it in rust, if they prefer. I mostly see it as a style-question, which are generally left up to each pull request author themselves. I am not sure about the benefits of rewriting the functional tests to rust. The review effort on a pull that changes 50'000+ lines of code would be impossible to gather.
I don't think there are other meaningful benefits, other than the benefits offered by the language or being able to re-use code. A programming language is just a tool to achieve a goal, so the choice of language shouldn't be a priority or blocker and more be seen as a style-question. In any case, this trivial refactoring pull request of the lint tests here seems ready to merge with 3 ACKs. |
Fixes #17413
Refactor subtree exclusion in lint tests to one place
Second attempt after PR: #24435