Skip to content

Commit

Permalink
Switch to rubocop-rails-omakase for styles
Browse files Browse the repository at this point in the history
And fix the few offenses detected.
  • Loading branch information
rosa committed Mar 21, 2024
1 parent d2d3790 commit 8a1613b
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 48 deletions.
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 1 addition & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 18 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions audits1984.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ["[email protected]"]
spec.authors = [ "Jorge Manrubia" ]
spec.email = [ "[email protected]" ]
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"
Expand All @@ -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
2 changes: 1 addition & 1 deletion test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/dummy/config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
4 changes: 2 additions & 2 deletions test/models/audits1984/filtered_sessions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 8a1613b

Please sign in to comment.