Add rubocop-rails-omakase gem
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
@@ -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")
|
||||||
|
|||||||
@@ -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.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Rails.application.configure do
|
|||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
|
|
||||||
# Allow access when running in docker
|
# Allow access when running in docker
|
||||||
config.web_console.allowed_ips = ["172.16.0.0/12", "192.168.0.0/16"]
|
config.web_console.allowed_ips = [ "172.16.0.0/12", "192.168.0.0/16" ]
|
||||||
|
|
||||||
# Enable server timing
|
# Enable server timing
|
||||||
config.server_timing = true
|
config.server_timing = true
|
||||||
|
|||||||
@@ -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"]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
ActiveSupport.on_load(:action_controller) do
|
ActiveSupport.on_load(:action_controller) do
|
||||||
wrap_parameters format: [:json]
|
wrap_parameters format: [ :json ]
|
||||||
end
|
end
|
||||||
|
|
||||||
# To enable root element in JSON for ActiveRecord objects.
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
|
|||||||
@@ -52,6 +52,6 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|||||||
setting = config.options[config.orm][:primary_key_type]
|
setting = config.options[config.orm][:primary_key_type]
|
||||||
primary_key_type = setting || :primary_key
|
primary_key_type = setting || :primary_key
|
||||||
foreign_key_type = setting || :bigint
|
foreign_key_type = setting || :bigint
|
||||||
[primary_key_type, foreign_key_type]
|
[ primary_key_type, foreign_key_type ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ class CreateActionTextTables < ActiveRecord::Migration[6.0]
|
|||||||
setting = config.options[config.orm][:primary_key_type]
|
setting = config.options[config.orm][:primary_key_type]
|
||||||
primary_key_type = setting || :primary_key
|
primary_key_type = setting || :primary_key
|
||||||
foreign_key_type = setting || :bigint
|
foreign_key_type = setting || :bigint
|
||||||
[primary_key_type, foreign_key_type]
|
[ primary_key_type, foreign_key_type ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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,10 +12,9 @@ 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
|
||||||
# assert_select "textarea[name=?]", "article[content]"
|
# assert_select "textarea[name=?]", "article[content]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,10 +12,9 @@ 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
|
||||||
# assert_select "textarea[name=?]", "article[content]"
|
# assert_select "textarea[name=?]", "article[content]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user