Add rubocop-rails-omakase gem

This commit is contained in:
Ryan W
2023-12-30 16:30:37 -08:00
parent 18e0822ee2
commit cfcebd12db
13 changed files with 31 additions and 19 deletions
+4
View File
@@ -2,6 +2,10 @@ require:
- rubocop-rails - rubocop-rails
- rubocop-rspec - rubocop-rspec
# Omakase Ruby styling for Rails
inherit_gem:
rubocop-rails-omakase: rubocop.yml
AllCops: AllCops:
TargetRubyVersion: 3.3.0 TargetRubyVersion: 3.3.0
TargetRailsVersion: 7.1.0 TargetRailsVersion: 7.1.0
+1
View File
@@ -55,6 +55,7 @@ group :development, :test do
gem "debug", platforms: %i[ mri windows ] gem "debug", platforms: %i[ mri windows ]
gem "rspec-rails" gem "rspec-rails"
gem "rubocop-rails" gem "rubocop-rails"
gem "rubocop-rails-omakase", require: false
gem "rubocop-rspec" gem "rubocop-rspec"
end end
+12
View File
@@ -257,11 +257,22 @@ GEM
rubocop (~> 1.41) rubocop (~> 1.41)
rubocop-factory_bot (2.24.0) rubocop-factory_bot (2.24.0)
rubocop (~> 1.33) rubocop (~> 1.33)
rubocop-minitest (0.34.2)
rubocop (>= 1.39, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-performance (1.20.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1) rubocop-rails (2.23.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0) rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0) rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rspec (2.25.0) rubocop-rspec (2.25.0)
rubocop (~> 1.40) rubocop (~> 1.40)
rubocop-capybara (~> 2.17) rubocop-capybara (~> 2.17)
@@ -330,6 +341,7 @@ DEPENDENCIES
redis (~> 5.0) redis (~> 5.0)
rspec-rails rspec-rails
rubocop-rails rubocop-rails
rubocop-rails-omakase
rubocop-rspec rubocop-rspec
selenium-webdriver selenium-webdriver
sprockets-rails sprockets-rails
+6 -8
View File
@@ -8,14 +8,12 @@
# this file is here to facilitate running it. # this file is here to facilitate running it.
# #
require 'pathname' ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path('bundle', __dir__) bundle_binstub = File.expand_path("bundle", __dir__)
if File.file?(bundle_binstub) if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub) load(bundle_binstub)
else else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
@@ -23,7 +21,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
end end
end end
require 'rubygems' require "rubygems"
require 'bundler/setup' require "bundler/setup"
load Gem.bin_path('rubocop', 'rubocop') load Gem.bin_path("rubocop", "rubocop")
+1 -1
View File
@@ -28,7 +28,7 @@ module Railsondocker
# Please, add to the `ignore` list any other `lib` subdirectories that do # Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded. # not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example. # Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks)) config.autoload_lib(ignore: %w[assets tasks])
# Configuration for the application, engines, and railties goes here. # Configuration for the application, engines, and railties goes here.
# #
+1 -1
View File
@@ -7,4 +7,4 @@
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE'] Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
-1
View File
@@ -13,7 +13,6 @@
# sticking to rails and rspec-rails APIs to keep things simple and stable. # sticking to rails and rspec-rails APIs to keep things simple and stable.
RSpec.describe "/articles", type: :request do RSpec.describe "/articles", type: :request do
# Article. As you add validations to Article, be sure to # Article. As you add validations to Article, be sure to
# adjust the attributes here as well. # adjust the attributes here as well.
let(:valid_attributes) { let(:valid_attributes) {
@@ -12,7 +12,6 @@ RSpec.describe "articles/edit", type: :view do
render render
assert_select "form[action=?][method=?]", article_path(@article), "post" do assert_select "form[action=?][method=?]", article_path(@article), "post" do
assert_select "input[name=?]", "article[title]" assert_select "input[name=?]", "article[title]"
# TODO: with rich_text, this is not a textarea # TODO: with rich_text, this is not a textarea
-1
View File
@@ -12,7 +12,6 @@ RSpec.describe "articles/new", type: :view do
render render
assert_select "form[action=?][method=?]", articles_path, "post" do assert_select "form[action=?][method=?]", articles_path, "post" do
assert_select "input[name=?]", "article[title]" assert_select "input[name=?]", "article[title]"
# TODO: with rich_text, this is not a textarea # TODO: with rich_text, this is not a textarea