objectionary / objectionary/lints

`excluded` names in `LtUnlintNonExistingDefect` are always empty in production

Open
#1,484 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
14
Forks
39
Avg merge
22h 54m
Merged PRs (30d)
90

Description

LtUnlintNonExistingDefect carries an excluded collection (src/main/java/org/eolang/lints/LtUnlintNonExistingDefect.java:34) and passes it to DefectMissing at line 74, where it is consulted at DefectMissing.java:50, :64 and :82. The only production callers, PkMono.java:53 and MonoLints.java:40, both use the one-argument constructor, which sets excluded to new ListOf<>() at line 42. Outside of tests every !this.excluded.contains(name) is always true, and the two-argument constructor is reached only from LtUnlintNonExistingDefectTest and DefectMissingTest.

The list existed to skip WPA lint names (PkMono passed new ListOf<>(new WpaLintNames()) since f5aef525). 235cda2d removed WPA and switched PkMono to the one-argument constructor but kept the parameter. Since then, returnsFalseWhenRangeReferencesExcludedAbsentLint in DefectMissingTest.java:104 locks down behavior no caller can trigger, and the real exclusion path, WithoutLints in MonoWithout.java:28, has a dead twin next to it.

Dropping the excluded attribute from both classes together with the two-argument constructor, and moving the tests to the one-argument form, leaves production behavior unchanged.

@yegor256

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/main/java/org/eolang/lints/LtUnlintNonExistingDefect.java and DefectMissing.java, then inspect the production callers in PkMono.java and MonoLints.java. Run LtUnlintNonExistingDefectTest and DefectMissingTest, including the excluded-name case, and confirm the one-argument construction and existing production behavior remain covered without the unused exclusion path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.