Skip to content

Swap rubocop #635

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# .rubocop.yml
# Omakase Ruby styling for Rails
inherit_gem:
rubocop-govuk:
- config/default.yml
- config/rails.yml
- config/rspec.yml
rubocop-rails-omakase: rubocop.yml

inherit_mode:
merge:
- Exclude

# **************************************************************
# TRY NOT TO ADD OVERRIDES IN THIS FILE
#
# This repo is configured to follow the RuboCop GOV.UK styleguide.
# Any rules you override here will cause this repo to diverge from
# the way we write code in all other GOV.UK repos.
#
# See https://github.com/alphagov/rubocop-govuk/blob/main/CONTRIBUTING.md
# **************************************************************


Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[mri mingw x64_mingw]
gem "rspec-rails", "~> 7.1.1"
gem "rubocop-govuk", require: false
gem "rubocop-rails-omakase", require: false

# For security auditing gem vulnerabilities. RUN IN CI
gem "bundler-audit", "~> 0.9.2"
Expand Down
28 changes: 13 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -288,24 +288,22 @@ GEM
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-govuk (5.0.8)
rubocop (= 1.70.0)
rubocop-ast (= 1.37.0)
rubocop-capybara (= 2.21.0)
rubocop-rails (= 2.28.0)
rubocop-rake (= 0.6.0)
rubocop-rspec (= 3.3.0)
rubocop-rails (2.28.0)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.29.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
ruby-progressbar (1.13.0)
rubyzip (2.4.1)
securerandom (0.4.1)
Expand Down Expand Up @@ -387,7 +385,7 @@ DEPENDENCIES
puma (~> 6.6)
rails (~> 8.0.1)
rspec-rails (~> 7.1.1)
rubocop-govuk
rubocop-rails-omakase
selenium-webdriver
sentry-rails
sentry-ruby
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def append_info_to_payload(payload)

def user_ip(forwarded_for = "")
first_ip_string = forwarded_for.split(",").first
Regexp.union([Resolv::IPv4::Regex, Resolv::IPv6::Regex]).match(first_ip_string) && first_ip_string
Regexp.union([ Resolv::IPv4::Regex, Resolv::IPv6::Regex ]).match(first_ip_string) && first_ip_string
end
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def govuk_assets_path
end

def page_title(separator = " – ")
[content_for(:title), "GOV.UK Forms"].compact.join(separator)
[ content_for(:title), "GOV.UK Forms" ].compact.join(separator)
end

def set_page_title(title)
Expand Down
2 changes: 1 addition & 1 deletion app/services/zendesk_ticket_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create!(comment:, **params)
private

def authorization
basic_encoded = ["#{Settings.zendesk.api_user}/token:#{Settings.zendesk.api_token}"].pack("m0")
basic_encoded = [ "#{Settings.zendesk.api_user}/token:#{Settings.zendesk.api_token}" ].pack("m0")
"Basic #{basic_encoded}"
end

Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Application < Rails::Application
config.lograge.custom_options = Lograge::CustomOptions

# Configure previews for ViewComponent
config.view_component.preview_paths = [Rails.root.join("spec/components")]
config.view_component.preview_paths = [ Rails.root.join("spec/components") ]
config.view_component.preview_route = "/preview"
config.view_component.preview_controller = "ComponentPreviewController"
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/sentry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
config.environment = Settings.sentry.environment

filter = ActiveSupport::ParameterFilter.new(
[EmailParameterFilterProc.new(mask: Settings.sentry.filter_mask)],
[ EmailParameterFilterProc.new(mask: Settings.sentry.filter_mask) ],
mask: Settings.sentry.filter_mask,
)
config.before_send = lambda do |event, _hint|
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/deploy.rake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ def push_commit_to_dev(git_hash)
end

def sh_aws(*cmd)
all_args = ["gds", "aws", "forms-deploy-support", "--", *cmd]
all_args = [ "gds", "aws", "forms-deploy-support", "--", *cmd ]
system({ **ENV, "AWS_VAULT" => nil }, *all_args, exception: true)
end
2 changes: 1 addition & 1 deletion lib/tasks/pause_pipelines.rake
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace :pipeline do

paused_transitions = pipeline_definition.stage_states.filter_map do |stage|
unless stage.inbound_transition_state.enabled
[stage.stage_name, "inbound", stage.inbound_transition_state.disabled_reason]
[ stage.stage_name, "inbound", stage.inbound_transition_state.disabled_reason ]
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/form_objects/support_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

expect(ZendeskTicketService).to have_received(:create!).with(
hash_including(
tags: [tag],
tags: [ tag ],
),
)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/email_parameter_filter_proc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe EmailParameterFilterProc do
let(:email_parameter_filter) do
ActiveSupport::ParameterFilter.new(
[described_class.new],
[ described_class.new ],
)
end

Expand All @@ -29,7 +29,7 @@

let(:email_parameter_filter) do
ActiveSupport::ParameterFilter.new(
[described_class.new(mask:)], mask:
[ described_class.new(mask:) ], mask:
)
end

Expand Down