fix(#364): run only referenced lints in unlint-non-existing-defect - #1226
Closed
VasilevNStas wants to merge 1 commit into
Closed
fix(#364): run only referenced lints in unlint-non-existing-defect#1226VasilevNStas wants to merge 1 commit into
VasilevNStas wants to merge 1 commit into
Conversation
Member
|
Appreciate the fix! The commits here aren't signed, which rultor requires for merging — details on signing commits are here: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits. Closing for now; feel free to reopen with signed commits. |
Contributor
Author
|
@volodya-lombrozo, fixed — commits are now SSH-signed (verified by GitHub). Since the closed PR can't be reopened after a force-push, I've recreated it as #1233 (same change, signed commits). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #364
Problem: The
unlint-non-existing-defectlint is the slowest one, by an order of magnitude, according to the benchmark. The reason: for every document it randefects()on all lints, even when the document had no+unlintmetas at all.Solution: The lint now collects the
+unlinttails first and, if the document has none, returns an empty result without touching any lint. Otherwise, only the lints whose names are referenced by the+unlintmetas are executed, instead of the full set.Changes:
src/main/java/org/eolang/lints/LtUnlintNonExistingDefect.java: rewrittendefects()to short-circuit on documents without+unlint;existing()filterslintsby the referenced names before callingdefects().src/test/java/org/eolang/lints/LtUnlintNonExistingDefectTest.java: two new tests asserting that no lint runs when there are no+unlintmetas and that unreferenced lints are not invoked (a lint that explodes when called would fail the test).Tests:
mvn clean install -Pqulice— 580 tests, all green.