New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metrics/ClassLength
is double reporting on class with singleton class
#12291
Labels
Comments
This is where the behavior changed |
rubocop v1.56 behaves like this let(:cop_config) { { 'Max' => 5, 'CountComments' => false } }
it 'rejects a class with more than 5 lines including its singleton class' do
expect_offense(<<~RUBY)
class Test
class << self
^^^^^^^^^^^^^ Class has too many lines. [6/5]
a = 1
a = 2
a = 3
a = 4
a = 5
a = 6
end
end
RUBY
end |
koic
added a commit
to koic/rubocop
that referenced
this issue
Oct 18, 2023
Fixes rubocop#12291. This PR fixes a false positive for `Metrics/ClassLength` when a class with a singleton class definition.
8 tasks
koic
added a commit
that referenced
this issue
Oct 19, 2023
…class_length [Fix #12291] Fix a false positive for `Metrics/ClassLength`
bmwiedemann
pushed a commit
to bmwiedemann/openSUSE
that referenced
this issue
Nov 1, 2023
https://build.opensuse.org/request/show/1121572 by user dancermak + dimstar_suse - updated to version 1.57.2 ## 1.57.2 (2023-10-26) ### Bug fixes * [#12274](rubocop/rubocop#12274): Fix a false positive for `Lint/Void` when `each`'s receiver is an object of `Enumerator` to which `filter` has been applied. ([@koic][]) * [#12291](rubocop/rubocop#12291): Fix a false positive for `Metrics/ClassLength` when a class with a singleton class definition. ([@koic][]) * [#12293](rubocop/rubocop#12293): Fix a false positive for `Style/RedundantDoubleSplatHashBraces` when using double splat hash braces with `merge` and method chain. ([@koic][]) * [#12298](rubocop/rubocop#12298): Fix a false positive for `Style/RedundantParentheses` when using a parenthesized hash literal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a class uses
class << self
to define class methods, rubocop reports an offense on both theclass << self
and the parent class.Expected behavior
Actual behavior
RuboCop version
The text was updated successfully, but these errors were encountered: