Skip to content
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

refactor: update rubocop and co #463

Merged
merged 3 commits into from
Aug 10, 2023
Merged
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
54 changes: 32 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.4.3)
activesupport (7.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
ast (2.4.2)
concurrent-ruby (1.2.2)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.2)
minitest (5.18.0)
parallel (1.22.1)
parser (3.1.2.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
minitest (5.19.0)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
rack (3.0.6.1)
racc
racc (1.7.1)
rack (3.0.8)
rainbow (3.1.1)
regexp_parser (2.5.0)
rexml (3.2.5)
rubocop (1.31.2)
regexp_parser (2.8.1)
rexml (3.2.6)
rubocop (1.55.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
rubocop-performance (1.14.3)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-performance (1.18.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.15.2)
rubocop-rails (2.20.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.12.1)
rubocop (~> 1.31)
ruby-progressbar (1.11.0)
rubocop (>= 1.33.0, < 2.0)
rubocop-rspec (2.23.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.2.0)
unicode-display_width (2.4.2)

PLATFORMS
arm64-darwin-21
Expand Down
4 changes: 2 additions & 2 deletions variants/audit-logging/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
copy_file("variants/audit-logging/spec/services/audit_log_spec.rb", "spec/services/audit_log_spec.rb")

insert_into_file "app/controllers/application_controller.rb", after: /^ end/ do
<<-'RUBY'
<<-RUBY


##
Expand All @@ -24,7 +24,7 @@
end

insert_into_file "config/application.rb", before: /^ end/ do
<<-'RUBY'
<<-RUBY

if ENV["RAILS_LOG_TO_STDOUT"].present?
config.audit_logger = Logger.new($stdout, formatter: AuditLogLogFormatter.new)
Expand Down
4 changes: 2 additions & 2 deletions variants/backend-base/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

insert_into_file "config/application.rb", after: /^require_relative ['"]boot['"]/ do
# the empty line at the beginning of this string is required
<<~'RUBY'
<<~RUBY

require_relative '../app/middleware/http_basic_auth'
RUBY
end

insert_into_file "config/application.rb", before: /^ end/ do
# the empty line at the beginning of this string is required
<<-'RUBY'
<<-RUBY

config.middleware.insert_before Rack::Sendfile, HttpBasicAuth
config.action_dispatch.default_headers["Permissions-Policy"] = "interest-cohort=()"
Expand Down
2 changes: 1 addition & 1 deletion variants/backend-base/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

insert_into_file "config/environments/production.rb",
after: /.*config.cache_store = :mem_cache_store\n/ do
<<~'RUBY'
<<~RUBY
if ENV.fetch("RAILS_CACHE_REDIS_URL", nil)
config.cache_store = :redis_cache_store, {
url: ENV.fetch("RAILS_CACHE_REDIS_URL"),
Expand Down
2 changes: 1 addition & 1 deletion variants/backend-base/config/initializers/check_env.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen-string-literal: true
# frozen_string_literal: true

# RAILS_SECRET_KEY_BASE should be set to something other than its value in example.env

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "Content-Security-Policy HTTP Header", type: :request do
RSpec.describe "Content-Security-Policy HTTP Header" do
context "when the application receives a request" do
before do
get root_path
Expand Down
2 changes: 1 addition & 1 deletion variants/backend-base/spec/requests/health_checks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "rails_helper"

RSpec.describe "Automated health checks", type: :request do
RSpec.describe "Automated health checks" do
subject { response.body }

before { get "/healthchecks/all" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "HTTP Basic Auth Middleware", type: :request do
RSpec.describe "HTTP Basic Auth Middleware" do
context "with HTTP Basic Auth enabled" do
let(:username) { "Miles O'Brien" }
let(:password) { "Ow me shoulder again!" }
Expand Down
2 changes: 1 addition & 1 deletion variants/backend-base/spec/system/home_feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "Homepage", type: :system do
RSpec.describe "Homepage" do
before { visit root_path }

it "rendered page contains both base and application layouts" do
Expand Down
4 changes: 2 additions & 2 deletions variants/deploy_with_ackama_ec2_capistrano/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
copy_file "variants/deploy_with_ackama_ec2_capistrano/aws_ec2_environment.yml", "config/aws_ec2_environment.yml"

append_to_file("Gemfile") do
<<~'EO_RUBY'
<<~EO_RUBY

# Deployment
#
Expand Down Expand Up @@ -138,7 +138,7 @@
gsub_file("config/deploy.rb", old_generated_cap_config_snippet, new_ackama_cap_config_snippet)

insert_into_file "Capfile", after: /install_plugin Capistrano::SCM::Git/ do
<<~'EO_RUBY'
<<~EO_RUBY
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
Expand Down
4 changes: 2 additions & 2 deletions variants/deploy_with_capistrano/template.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TERMINAL.puts_header "Starting variant: deploy_with_capistrano"

append_to_file("Gemfile") do
<<~'EO_RUBY'
<<~EO_RUBY

# Deployment
#
Expand Down Expand Up @@ -116,7 +116,7 @@
gsub_file("config/deploy.rb", old_generated_cap_config_snippet, new_ackama_cap_config_snippet)

insert_into_file "Capfile", after: /install_plugin Capistrano::SCM::Git/ do
<<~'EO_RUBY'
<<~EO_RUBY
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
Expand Down
2 changes: 1 addition & 1 deletion variants/devise/spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe User, type: :model do
RSpec.describe User do
describe "User Factory" do
it "creates valid users" do
expect(FactoryBot.build(:user)).to be_valid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "Session cookies are expired immediately after logout", type: :request do
RSpec.describe "Session cookies are expired immediately after logout" do
let(:password) { SecureRandom.hex(16) }

let(:user) { FactoryBot.create(:user, password: password) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "Users can reset passwords", type: :system do
RSpec.describe "Users can reset passwords" do
describe "accessibility" do
before { visit new_user_password_path }

Expand Down
2 changes: 1 addition & 1 deletion variants/devise/spec/system/user_sign_in_feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "User sign-in", type: :system do
RSpec.describe "User sign-in" do
let(:user) { FactoryBot.create(:user, email: email, password: password) }
let(:password) { "aaaabbbbccccdddd" }
let(:email) { "miles.obrien@transporterrm3.enterprise.uss" }
Expand Down
2 changes: 1 addition & 1 deletion variants/devise/spec/system/user_sign_up_feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe "User sign-up", type: :system do
RSpec.describe "User sign-up" do
let(:too_short_password) { "aabbcc" }
let(:valid_password) { "aaaabbbbccccdddd" }
let(:invalid_email) { "miles.obrien@" }
Expand Down
2 changes: 1 addition & 1 deletion variants/devise/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

gsub_file "config/routes.rb",
"devise_for :users",
<<~'EO_DEVISE'
<<~EO_DEVISE
devise_for :users, controllers: {
sessions: "users/sessions"
}
Expand Down
4 changes: 2 additions & 2 deletions variants/frontend-base/sentry/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
prepend_to_file "app/frontend/packs/application.js", "import * as Sentry from '@sentry/browser';"

append_to_file "app/frontend/packs/application.js" do
<<~'EO_JS'
<<~EO_JS

// Initialize Sentry Error Reporting
//
Expand All @@ -33,7 +33,7 @@
end

prepend_to_file "app/frontend/packs/application.js" do
<<~'EO_JS'
<<~EO_JS
// The application.js pack is deferred by default which means that nothing imported
// in this file will begin executing until after the page has loaded. This helps to
// speed up page loading times, especially in apps that have large amounts of js.
Expand Down
2 changes: 1 addition & 1 deletion variants/sidekiq/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
copy_file "config/sidekiq.yml"

insert_into_file "config/application.rb", before: /^ end/ do
<<-'RUBY'
<<-RUBY

# Use sidekiq to process Active Jobs (e.g. ActionMailer's deliver_later)
config.active_job.queue_adapter = :sidekiq
Expand Down
Loading