diff --git a/.rubocop.yml b/.rubocop.yml index 913b7a4b..f9ac9d04 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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: @@ -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. @@ -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 diff --git a/features/page_objects/back_office/registration_search_results_page.rb b/features/page_objects/back_office/registration_search_results_page.rb index 5f896133..e37a146c 100644 --- a/features/page_objects/back_office/registration_search_results_page.rb +++ b/features/page_objects/back_office/registration_search_results_page.rb @@ -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 diff --git a/features/page_objects/business_type_page.rb b/features/page_objects/business_type_page.rb index b0d6062a..68a3b3a2 100644 --- a/features/page_objects/business_type_page.rb +++ b/features/page_objects/business_type_page.rb @@ -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