`RuboCop::Cop::Airbnb::ModuleMethodInWrongFile` returns incorrect error message when defining a method inside singleton class
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với rubocop-airbnb/lib/rubocop/cop/airbnb/module_method_in_wrong_file.rb quanh dòng 88 và spec tại rubocop-airbnb/spec/rubocop/cop/airbnb/module_method_in_wrong_file_spec.rb quanh dòng 96. Chạy spec đó và kiểm tra normalize_module_name(node.parent_module_name). Được xem là hoàn tất khi trường hợp singleton-class báo cáo “Method baz should be defined in foo.rb” và spec kiểm tra nội dung của offense.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Ruby
- Star
- 3.9k
- Fork
- 757
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của airbnb/ruby
-
Warnings about rule namespaces for Capybara and FactoryBotCó thể đã có người làm @mitorez đã nhận 137 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
-
[bug] Update rubocop to 1.6.2Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
Issue tương tự
-
ETQ admin, le select de condition d'une annotation répétable liste les champs publics deux foisĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
demarche-numerique/demarche.numerique.gouv.fr#14301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs verification
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 6 ngày
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
dependabot/dependabot-core#16547 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Properties named open and close collide with query delimiter tokensCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 8 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày