Disable Metrics/LineLength for long URL lines in patches_spec.rb

- The final two `brew style` offenses were for Metrics/LineLength where
  parsing the GitHub diff URL as a regex took 119/118 lines.
- This disables the cop for each of those long, problematic lines, and
  re-enables them straight afterwards, else they'd apply to the whole file
  from the first occurrence onwards, which we probably don't want?
- I wondered about increasing the LineLength limit to 119 or 120, but
  it appears to have been set for a justifiable reason in 80d75bc0d8.
This commit is contained in:
Issy Long 2019-10-13 10:19:15 +01:00
parent 3570cb6e77
commit fed1bbe029
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -88,7 +88,9 @@ describe RuboCop::Cop::FormulaAudit::Patches do
line: 5,
column: 5,
source: source }]
# rubocop:disable Metrics/LineLength
elsif %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}.match?(patch_url)
# rubocop:enable Metrics/LineLength
[{ message:
<<~EOS,
use GitHub pull request URLs:
@ -223,7 +225,9 @@ describe RuboCop::Cop::FormulaAudit::Patches do
line: 5,
column: 9,
source: source }]
# rubocop:disable Metrics/LineLength
elsif %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}.match?(patch_url)
# rubocop:enable Metrics/LineLength
[{ message:
<<~EOS,
use GitHub pull request URLs: