Skip to content

Commit

Permalink
Resolve issues with rubocop breaking build
Browse files Browse the repository at this point in the history
[Deppbot](https://www.deppbot.com/) has updated rubocop and this has caused a break in the build due to new errors being found.

The one cop we have had to disable is `Style/FormatStringToken` which was introduced in 0.49.0.

rubocop/rubocop#3438

The only issue its highlighting in the code is `strftime()`, and we feel the way we are using it is as expected so are choosing to disable this cop for now.
  • Loading branch information
Cruikshanks committed Dec 14, 2017
1 parent 5c740c3 commit 915f7d5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
79 changes: 43 additions & 36 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ AllCops:
# investigating what the fix may be.
DisplayStyleGuide: true

# When using Ruby >= 2.3, Rubocop wants to add a comment to the top of *.rb
# to aid migration to frozen literals in Ruby 3.0. We are not interested in
# modifying every file at this point, so this cop is disabled for now.
Style/FrozenStringLiteralComment:
Enabled: false

# As long as the team commit to using well named classes it should not be
# necessary to add top-level class documentation.
Style/Documentation:
Enabled: false

# We believe it looks cluttered/ugly not having the ability to add whitespace
# between for example the class declaration and first method.
Layout/EmptyLinesAroundModuleBody:
Expand All @@ -28,31 +17,6 @@ Layout/EmptyLinesAroundClassBody:
Layout/EmptyLinesAroundBlockBody:
Enabled: false

# There are no relative performance improvements using '' over "", therefore we
# believe there is more value in using "" for all strings irrespective of
# whether string interpolation is used
Style/StringLiterals:
EnforcedStyle: double_quotes

# Steps aren't like traditional methods and don't benefit from being broken
# down. Therefore we exclude them from the block length metric as they often can
# be long.
Metrics/BlockLength:
Exclude:
- "**/features/step_definitions/**/*_steps.rb"

# We believe the default of 10 lines for a method length is too restrictive and
# often quickly hit just because we need to specify the namesspace, class and
# method before then doing something with it.
Metrics/MethodLength:
Max: 30

# We believe the default 80 characters is too restrictive and that lines can
# still be readable and maintainable when no more than 120 characters. This also
# allows us to maximise our screen space.
Metrics/LineLength:
Max: 120

# We felt as a team that the default size of 15 was too low, and blocked what to
# us are sound methods which would not add any value if broken up. In this
# project we've agreed to up this to 30.
Expand All @@ -64,3 +28,46 @@ Metrics/AbcSize:
# project we've agreed to up this to 7.
Metrics/CyclomaticComplexity:
Max: 7

# We believe the default 80 characters is too restrictive and that lines can
# still be readable and maintainable when no more than 120 characters. This also
# allows us to maximise our screen space.
Metrics/LineLength:
Max: 120

# We believe the default of 10 lines for a method length is too restrictive and
# often quickly hit just because we need to specify the namesspace, class and
# method before then doing something with it.
Metrics/MethodLength:
Max: 30

# Steps aren't like traditional methods and don't benefit from being broken
# down. Therefore we exclude them from the block length metric as they often can
# be long.
Metrics/BlockLength:
Exclude:
- "**/features/step_definitions/**/*_steps.rb"

# As long as the team commit to using well named classes it should not be
# necessary to add top-level class documentation.
Style/Documentation:
Enabled: false

# This rule was added in version 0.49.0. We have nothing against the rule
# however the code we have it doesn't like is anything that uses strftime().
# We feel the way we are using that is as expected, so have taken the decision
# to turn off this cop. https://github.com/bbatsov/rubocop/issues/3438
Style/FormatStringToken:
Enabled: false

# When using Ruby >= 2.3, Rubocop wants to add a comment to the top of *.rb
# to aid migration to frozen literals in Ruby 3.0. We are not interested in
# modifying every file at this point, so this cop is disabled for now.
Style/FrozenStringLiteralComment:
Enabled: false

# There are no relative performance improvements using '' over "", therefore we
# believe there is more value in using "" for all strings irrespective of
# whether string interpolation is used
Style/StringLiterals:
EnforcedStyle: double_quotes
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class RegistrationSearchResultsPage < SitePrism::Page

def registration(registration_number)
registrations.each do |registration|
if registration.registration_number.text == registration_number
return registration
end
return registration if registration.registration_number.text == registration_number
end
nil
end
Expand Down
4 changes: 1 addition & 3 deletions features/page_objects/business_type_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ class BusinessTypePage < SitePrism::Page
element(:submit_button, "input[type='Submit']", visible: false)

def submit(args = {})
if args.key?(:org_type)
org_types.find { |btn| btn.value == args[:org_type] }.click
end
org_types.find { |btn| btn.value == args[:org_type] }.click if args.key?(:org_type)

submit_button.click
end
Expand Down

0 comments on commit 915f7d5

Please sign in to comment.