Skip to content

fix(#364): run only referenced lints in unlint-non-existing-defect - #1226

Closed
VasilevNStas wants to merge 1 commit into
objectionary:masterfrom
VasilevNStas:fix/issue-364-unlint-perf
Closed

fix(#364): run only referenced lints in unlint-non-existing-defect#1226
VasilevNStas wants to merge 1 commit into
objectionary:masterfrom
VasilevNStas:fix/issue-364-unlint-perf

Conversation

@VasilevNStas

@VasilevNStas VasilevNStas commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #364

Problem: The unlint-non-existing-defect lint is the slowest one, by an order of magnitude, according to the benchmark. The reason: for every document it ran defects() on all lints, even when the document had no +unlint metas at all.

Solution: The lint now collects the +unlint tails 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 +unlint metas are executed, instead of the full set.

Changes:

  • src/main/java/org/eolang/lints/LtUnlintNonExistingDefect.java: rewritten defects() to short-circuit on documents without +unlint; existing() filters lints by the referenced names before calling defects().
  • src/test/java/org/eolang/lints/LtUnlintNonExistingDefectTest.java: two new tests asserting that no lint runs when there are no +unlint metas 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.

@volodya-lombrozo

Copy link
Copy Markdown
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.

@VasilevNStas

Copy link
Copy Markdown
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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unlint-non-existing-defect is very slow

2 participants