Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Don't complain about block length in tests #82

Merged
merged 1 commit into from Sep 14, 2017

Conversation

h-lame
Copy link
Contributor

@h-lame h-lame commented Sep 11, 2017

Many test frameworks use blocks for the entire test case in a file as well as for individual tests within the file. It's not unusual for a test case to be several lines longer than the upper limit of the BlockLength cop, and there's very little we can do to avoid that so there's no point running this cop on our tests.

See: alphagov/support@4d5bcbc and alphagov/specialist-publisher@1991ab9 where I've done this in .rubocop.yml for a couple of projects. There's bound to be more so this feels like something we should do in one place.

Many test frameworks use blocks for the entire test case in a file as well as for individual tests within the file.  It's not unusual for a test case to be several lines longer than the upper limit of the BlockLength cop, and there's very little we can do to avoid that so there's no point running this cop on our tests.
@fofr
Copy link
Contributor

fofr commented Sep 11, 2017

@floehopper floehopper self-requested a review September 14, 2017 15:10
Copy link
Contributor

@floehopper floehopper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also did this in Asset Manager.

I had hoped that adding rubocop-rspec would fix this for RSpec specs, but I've just done some more investigation and it doesn't. And in any case, it would still leave the problem for non-RSpec tests.

Thus I reckon this should be merged.

@h-lame h-lame merged commit 1560955 into master Sep 14, 2017
@h-lame h-lame deleted the dont-complain-about-block-lenght-in-tests branch September 14, 2017 15:27
floehopper added a commit to alphagov/asset-manager that referenced this pull request Sep 14, 2017
This is now taken care of by the `govuk-lint` gem itself [1].

[1]: alphagov/govuk-lint#82
fofr added a commit to alphagov/collections that referenced this pull request Sep 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants