objectionary / objectionary/lints
LtUnlintNonExistingDefect falsely warns for range +unlint that covers only part of the defects
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 14
- Forks
- 39
- Avg merge
- 22h 54m
- Merged PRs (30d)
- 90
Description
Problem
LtUnlintNonExistingDefect produces a false "doesn't make sense" warning when a line-range +unlint covers only part of the defects of a lint.
Root cause
src/main/java/org/eolang/lints/DefectMissing.java:50 uses allMatch:
missing = !lines.stream().allMatch(new UnlintInRange(unlint));
For +unlint foo:10-20 with foo defects on lines [5, 15], allMatch returns false → the whole unlint is reported as "doesn't make sense", even though line 15 is legitimately suppressed by the range.
Minimal example
EO program with +unlint ascii-only:1-10 where the ascii-only lint reports defects both inside and outside the range (e.g. two non-ASCII comments on lines 5 and 15).
Expected: no warning — line 5 is suppressed by the range, line 15 is not and is reported by the lint itself.
Actual: unlint-non-existing-defect warns "Suppressing 'ascii-only:1-10' doesn't make sense, because there are no defects with it" (well — a defect exists, on line 15, but the warning fires anyway).
Expected behavior
A range unlint makes sense if any defect of that lint falls into the range → use anyMatch (the same semantics LtUnlint uses via removeIf(inRange), see src/main/java/org/eolang/lints/LtUnlint.java:63).
Related
- #1232/#950 (line-specific
+unlinthandling) - The pack
unlint/allows-unlint-for-defects-in-the-line-range.yamlonly covers the all-inside case, so the partial case is untested.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/main/java/org/eolang/lints/DefectMissing.java:50 and compare its matching behavior with src/main/java/org/eolang/lints/LtUnlint.java:63. Add a regression case to the pack, alongside unlint/allows-unlint-for-defects-in-the-line-range.yaml, covering defects both inside and outside the range. Run the relevant linter tests and confirm that only the valid suppression is accepted without an unlint-non-existing-defect warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100