excessive-visibility misses test calls on a literal, a void or a local bound to another expression

オープン
#1,870 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, xml
領域
tooling

調査の方向性

Read src/main/resources/org/eolang/lints/design/excessive-visibility.xsl and follow how $used matches test-call bases, comparing folded calls with postfix calls. Check existing lint tests for these receiver forms, then add coverage for literal, void, and locally bound receivers. Done means calls whose attribute name is the last segment or the segment before a further dispatch count as references, and the false reports are gone.

索引モデルが issue の本文から書いたものです。

説明

bug

excessive-visibility in src/main/resources/org/eolang/lints/design/excessive-visibility.xsl accepts a test that chains a dotted call onto any expression, such as (phrase "x").multi-words, whatever the receiver is. The parser gives that a .multi-words base, and $used matches it by the attribute name alone. When the receiver is a plain name instead of an expression, the parser folds the call into the base, and the lint then wants the receiver to be the object itself, or a local bound to the object's @loc (#1799). Calls on any other receiver are missed, so these reports from eo-runtime are false, because each method has a test:

# bool.eo, reported: The attribute "or" is public, but no unit test refers to it
true.or false ++> can-disjoin-true-with-false
# chunk.eo, reported for "put" and "get"
eq. ++> can-put-and-get
  malloc.of
    8
    seq * > [c]
      c.put 42
      c.get
  42.as-bytes
# directory.eo, reported for "retried"
mktemp.tmpfile.deleted.as-path.as-dir.made > parent
...
parent.retried
  parent.path
  42

The bases are Φ.true.or, ξ.v🌵c.put, ξ.v🌵c.get and ξ.parent.retried. true decorates bool, c is a void, and parent is bound to a dispatch chain, so none of them is Φ.bool, Φ.chunk or Φ.directory by name. file.path is reported the same way through ξ.temp.path.

The fix is to treat a folded call the way the lint already treats the postfix one. A base in a test whose last segment, or the segment before a further dispatch, is the attribute name should count as a reference whatever comes before it. The lint is already that lenient with (expr).name, so this only removes the difference between two spellings of the same call.

主要言語
Java
スター
14
フォーク
43
平均マージ
1日 20時間
マージ済み PR(30日)
166

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

objectionary/lints のほかの issue

objectionary/lints の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。