Skip to content
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

odd Metrics/ClassLength behavior #33

Open
chazlarson opened this issue Mar 30, 2017 · 0 comments
Open

odd Metrics/ClassLength behavior #33

chazlarson opened this issue Mar 30, 2017 · 0 comments

Comments

@chazlarson
Copy link
Contributor

In 10-03. At this point:
In the file test/controllers/users_controller_test.rb, add the line "# rubocop:disable Metrics/ClassLength" to the very beginning of the file and the line "# rubocop:disable Metrics/ClassLength" to the very end of the file.

When I add those lines to the file, RuboCop throws an offense that their unneeded. When I remove them, I get an offense that there are too many lines in the class. I added this exclusion to .rubocop.yml instead.

no # rubocop lines in the file:

winner@2fc6a0f5360e:~/shared/generic-rails-2017-03-27-1756$ bundle exec rubocop -D
Inspecting 77 files
.................................................C...........................

Offenses:

test/controllers/users_controller_test.rb:5:1: C: Metrics/ClassLength: Class has too many lines. [116/100]
class UsersControllerTest < ActionController::TestCase ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

77 files inspected, 1 offense detected

Add them to the file:

winner@2fc6a0f5360e:~/shared/generic-rails-2017-03-27-1756$ bundle exec rubocop -D
Inspecting 77 files
.................................................W...........................

Offenses:

test/controllers/users_controller_test.rb:153:1: W: Lint/UnneededDisable: Unnecessary disabling of Metrics/ClassLength.
# rubocop:disable Metrics/ClassLength
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

77 files inspected, 1 offense detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant