From 8a1613be4b27af8f1a58bb2e741f2d0549397e32 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Thu, 21 Mar 2024 18:15:27 +0100 Subject: [PATCH] Switch to `rubocop-rails-omakase` for styles And fix the few offenses detected. --- .rubocop.yml | 6 ++- Gemfile | 7 +-- Gemfile.lock | 47 +++++++------------ audits1984.gemspec | 12 ++--- test/application_system_test_case.rb | 2 +- .../config/initializers/wrap_parameters.rb | 2 +- ...6_create_console1984_tables.console1984.rb | 2 +- .../audits1984/filtered_sessions_test.rb | 4 +- test/test_helper.rb | 2 +- 9 files changed, 36 insertions(+), 48 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 25dab14..8e8feb4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,9 +1,13 @@ -inherit_from: https://raw.githubusercontent.com/rails/rails/master/.rubocop.yml +inherit_gem: { rubocop-rails-omakase: rubocop.yml } Performance: Exclude: - 'test/**/*' +AllCops: + Exclude: + - 'test/dummy/db/*schema.rb' + Style/FrozenStringLiteralComment: Enabled: false diff --git a/Gemfile b/Gemfile index 1ebbe25..6e0e128 100644 --- a/Gemfile +++ b/Gemfile @@ -9,12 +9,7 @@ gem 'pg' gem 'mysql2' group :development do - gem 'rubocop', '>= 1.18.4' - gem 'rubocop-performance' - gem 'rubocop-minitest' - gem 'rubocop-md' - gem 'rubocop-packaging' - gem 'rubocop-rails' + gem 'rubocop-rails-omakase', require: false end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 226cc6e..089fc7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -107,7 +107,7 @@ GEM activesupport (>= 5.0) i18n (1.14.1) concurrent-ruby (~> 1.0) - json (2.6.3) + json (2.7.1) loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -136,13 +136,7 @@ GEM nokogiri (1.15.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.2-arm64-darwin) - racc (~> 1.4) - nokogiri (1.15.2-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.15.2-x86_64-linux) - racc (~> 1.4) - parallel (1.23.0) + parallel (1.24.0) parser (3.2.2.1) ast (~> 2.4.1) pg (1.5.3) @@ -183,7 +177,7 @@ GEM rainbow (3.1.1) rake (13.1.0) regexp_parser (2.8.0) - rexml (3.2.5) + rexml (3.2.6) rinku (2.0.6) rouge (4.2.0) rubocop (1.52.0) @@ -196,21 +190,24 @@ GEM rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-md (1.2.0) - rubocop (>= 1.0) - rubocop-minitest (0.31.0) + rubocop-minitest (0.34.5) rubocop (>= 1.39, < 2.0) - rubocop-packaging (0.5.2) - rubocop (>= 1.33, < 2.0) - rubocop-performance (1.18.0) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.19.1) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails-omakase (1.0.0) + rubocop + rubocop-minitest + rubocop-performance + rubocop-rails ruby-progressbar (1.13.0) sprockets (4.2.0) concurrent-ruby (~> 1.0) @@ -221,9 +218,6 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.6.3) mini_portile2 (~> 2.8.0) - sqlite3 (1.6.3-arm64-darwin) - sqlite3 (1.6.3-x86_64-darwin) - sqlite3 (1.6.3-x86_64-linux) thor (1.2.2) timeout (0.4.1) turbo-rails (2.0.4) @@ -232,7 +226,7 @@ GEM railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) webrick (1.8.1) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -256,12 +250,7 @@ DEPENDENCIES pg puma rails - rubocop (>= 1.18.4) - rubocop-md - rubocop-minitest - rubocop-packaging - rubocop-performance - rubocop-rails + rubocop-rails-omakase sprockets-rails sqlite3 diff --git a/audits1984.gemspec b/audits1984.gemspec index 25fb414..c1b6228 100644 --- a/audits1984.gemspec +++ b/audits1984.gemspec @@ -3,8 +3,8 @@ require_relative "lib/audits1984/version" Gem::Specification.new do |spec| spec.name = "audits1984" spec.version = Audits1984::VERSION - spec.authors = ["Jorge Manrubia"] - spec.email = ["jorge.manrubia@gmail.com"] + spec.authors = [ "Jorge Manrubia" ] + spec.email = [ "jorge.manrubia@gmail.com" ] spec.homepage = "https://github.com/basecamp/audits1984" spec.summary = "A simple auditing tool for console1984" spec.description = "Rails engine that implements a simple auditing tool for console1984 sessions" @@ -19,8 +19,8 @@ Gem::Specification.new do |spec| spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - spec.add_dependency 'rouge' - spec.add_dependency 'turbo-rails' - spec.add_dependency 'rinku' - spec.add_dependency 'console1984' + spec.add_dependency "rouge" + spec.add_dependency "turbo-rails" + spec.add_dependency "rinku" + spec.add_dependency "console1984" end diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index d01c29d..9fe5d3e 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -3,7 +3,7 @@ require "capybara/cuprite" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :cuprite, screen_size: [1440, 900], options: { headless: "new" } + driven_by :cuprite, screen_size: [ 1440, 900 ], options: { headless: "new" } include Audits1984::Engine.routes.url_helpers end diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb index bbfc396..6d55fe7 100644 --- a/test/dummy/config/initializers/wrap_parameters.rb +++ b/test/dummy/config/initializers/wrap_parameters.rb @@ -5,7 +5,7 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] + wrap_parameters format: [ :json ] end # To enable root element in JSON for ActiveRecord objects. diff --git a/test/dummy/db/migrate/20210813135816_create_console1984_tables.console1984.rb b/test/dummy/db/migrate/20210813135816_create_console1984_tables.console1984.rb index 248b171..62d3de0 100644 --- a/test/dummy/db/migrate/20210813135816_create_console1984_tables.console1984.rb +++ b/test/dummy/db/migrate/20210813135816_create_console1984_tables.console1984.rb @@ -14,7 +14,7 @@ def change t.string :username, null: false t.timestamps - t.index [:username] + t.index [ :username ] end create_table :console1984_commands do |t| diff --git a/test/models/audits1984/filtered_sessions_test.rb b/test/models/audits1984/filtered_sessions_test.rb index 2fb8a75..4642d1f 100644 --- a/test/models/audits1984/filtered_sessions_test.rb +++ b/test/models/audits1984/filtered_sessions_test.rb @@ -21,8 +21,8 @@ class Audits1984::FilteredSessionsTest < ActiveSupport::TestCase to = session_to.created_at assert_filtered_sessions included: [ session_from, session_to ], from: from, to: to - assert_filtered_sessions included: [ session_to ], excluded: [session_from ], from: to - assert_filtered_sessions included: [ session_from ], excluded: [session_to ], from: from, to: from + assert_filtered_sessions included: [ session_to ], excluded: [ session_from ], from: to + assert_filtered_sessions included: [ session_from ], excluded: [ session_to ], from: from, to: from end test "pending_session_after returns the next session considering those are sorted with newest first" do diff --git a/test/test_helper.rb b/test/test_helper.rb index 3c65306..d1be4e6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -5,7 +5,7 @@ require "console1984" -ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] +ActiveRecord::Migrator.migrations_paths = [ File.expand_path("../test/dummy/db/migrate", __dir__) ] require "rails/test_help"