excessive-visibility reports atom record types whose annotation lists field types

Open Beginner friendly
#1,871 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start with excessive-visibility.xsl and inspect how the types variable collects @atom and @type values before comparing them with @loc. Update the normalization so atom annotations with field type lists match the record type name. Run the excessive-visibility checks against the reported EO examples; done means these records are no longer falsely reported while ordinary visibility checks still work.

Written by the indexing model from the issue text.

Description

bug

excessive-visibility is meant to leave alone a formation that an atom names as its return type. It collects those names in excessive-visibility.xsl:

<xsl:variable name="types" select="(//o/@atom, for $t in //o/@type return replace($t, '\?$', ''))"/>
...
and not(@loc = $types)

In EO the atom annotation now also lists the types of the record's fields:

[] > readdir /Q.posix.dir-return(Q.number,Q.string)
[cde nme] > dir-return
  posix.dir-return > called

The parser keeps that whole annotation in @atom, as atom="Φ.posix.dir-return(Φ.number,Φ.string)", while the formation's @loc is Φ.posix.dir-return. They never compare equal, so every such record is reported:

posix:41 The attribute "dir-return" is public, but no unit test refers to it; obfuscate it with >> instead of > (excessive-visibility/S)

eo-runtime gets ten of these, dir-return, getenv-return, stat-return and status-return in posix.eo, plus those and search-return and time-return in win32.eo. Following the advice would break the build, since the runtime finds these records through their absolute names.

The type should be cut at the first ( before it is compared, as in replace($t, '\(.*$|\?$', '') applied to @atom as well as to @type.

Dominant language
Java
Stars
14
Forks
43
Avg merge
1d 20h
Merged PRs (30d)
166

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from objectionary/lints

All issues in objectionary/lints

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.