objectionary / objectionary/lints

`missed-obfuscation` incorrectly counts receiver `ρ` as a void leading to spurious defect reports

Open Beginner friendly
#1,461 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happens

missed-obfuscation counts the receiver ρ among the void attributes a formation is told to obfuscate. A formation whose only void is its own receiver gets a defect it cannot act on, because ρ is the receiver and there is nothing to rename it to.

On lints de102d68 with eo-parser 0.63.0:

+package foo
+version 0.0.0

[^] > thing
  ^.other > @
void: name=[ρ]   (U+03C1)
DEFECT line 4: The formation "thing" must obfuscate its void attributes before decorating another object

A formation with a real void gets the same message, which is the intended case:

[x] > thing
  x > @

and one with no voids at all is silent, as it should be.

Over eo-runtime/src/main/eo (objectionary/eo at 8655f8755e) the rule reports 706 defects, and in 92 of them the only void of the formation is ρ.

Why

The selector takes any void whose name is not prefixed cant- (design/missed-obfuscation.xsl):

<xsl:for-each select="//o[eo:abstract(.) and @name and o[@name='φ'] and o[@base='∅' and @name and not(starts-with(@name, 'cant-'))]]">

Writing the receiver down as [^] emits <o base="∅" name="ρ"/>, which matches. The motive talks only about attributes a caller provides:

A formation that decorates another object should obfuscate its void attributes. Otherwise, an attribute of the formation may shadow an attribute with the same name in the decoratee

ρ shadows nothing of the kind: it is the receiver every formation has, and eo-printer writes it as ^ rather than as a name a reader could confuse with an attribute of the decoratee.

This is the same shape as #1299, where many-void-attributes counts ρ against its cap of five. The fix there is the fix here.

How to fix

Leave the receiver out of the selector:

<xsl:for-each select="//o[eo:abstract(.) and @name and o[@name='φ'] and o[@base='∅' and @name and @name != 'ρ' and not(starts-with(@name, 'cant-'))]]">

A pack for it: [^] > thing with ^.other > @ must give defects: 0, while [^ x] > thing must still be reported for x.

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 in design/missed-obfuscation.xsl by reading the selector for void attributes and compare it with the handling described for #1299. Add or update a pack covering [^] > thing and [^ x] > thing; done means the receiver-only case reports zero defects while the real void x remains reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.