Skip to content

feat(#1100): add broad-scope lint - #1238

Open
VasilevNStas wants to merge 1 commit into
objectionary:masterfrom
VasilevNStas:fix/issue-1100-broad-scope
Open

feat(#1100): add broad-scope lint#1238
VasilevNStas wants to merge 1 commit into
objectionary:masterfrom
VasilevNStas:fix/issue-1100-broad-scope

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Fixes #1100.

Problem

A private attribute (local) may have an excessively broad scope: it is used only inside a single nested object, while it is declared at a much higher level. This should lead to a lint warning.

Solution / What

New XSLT lint broad-scope modeled after redundant-object: it finds private attributes referenced (via ^ξ(?:\.ρ)*\. base prefixes) exclusively within a single object different from the declaration site, and warns that the scope is too broad.

Changes

  • src/main/resources/org/eolang/lints/design/broad-scope.xsl — the new lint.
  • src/main/resources/org/eolang/motives/design/broad-scope.md — motivation.
  • src/test/resources/org/eolang/lints/packs/single/broad-scope/ — 3 test packs.

Tests

  • catches-broad-scope
  • allows-used-on-top-level
  • allows-used-in-multiple-objects

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 @volodya-lombrozo plz review

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.

'private' attribute a has excessively broad scope necessitating new lint rule

1 participant