`RuboCop::Cop::Airbnb::ModuleMethodInWrongFile` returns incorrect error message when defining a method inside singleton class
まだ誰も着手していません。
評価
調査の方向性
rubocop-airbnb/lib/rubocop/cop/airbnb/module_method_in_wrong_file.rb の88行目付近と、rubocop-airbnb/spec/rubocop/cop/airbnb/module_method_in_wrong_file_spec.rb の96行目付近から始めます。その spec を実行し、normalize_module_name(node.parent_module_name) を調べます。singleton-class のケースが “Method baz should be defined in foo.rb” と報告し、spec が offense のテキストを確認すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When developing PR #189, tests were changed to use new rspec-rubocop syntax which also checks that the message generated is correct. After doing this, the spec that checks that an error is returned when using "<<" static methods and a non-matching name failed with an incorrect message:
Method baz should be defined in foo/foo.rb
When the expected message was:
Method baz should be defined in foo.rb
After digging a little about it to understand what was happening, we realized that this incorrect message is also present on master – but there are no assertions respecting the offense's text, thus the test succeeds.
The issue seems to be caused by the method normalize_module_name(node.parent_module_name) (on module_method_in_wrong_file.rb#L88) which returns Foo::Foo instead of just Foo.
- 主要言語
- Ruby
- スター
- 3.9k
- フォーク
- 757
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
airbnb/ruby のほかの issue
-
Warnings about rule namespaces for Capybara and FactoryBot対応中かも @mitorez が 137 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
we-promise/sure#4199 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
scanaislop/aislop#482 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
forem/forem#23963 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 8 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信