Skip to content

Commit 11ae21b

Browse files
authored
Rubocop rules (#40)
1 parent 81e8156 commit 11ae21b

File tree

9 files changed

+44
-31
lines changed

9 files changed

+44
-31
lines changed

.rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# Omakase Ruby styling for Rails
22
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
33

4+
Style/TrailingCommaInArguments:
5+
EnforcedStyleForMultiline: consistent_comma
6+
Style/TrailingCommaInArrayLiteral:
7+
EnforcedStyleForMultiline: consistent_comma
8+
Style/TrailingCommaInHashLiteral:
9+
EnforcedStyleForMultiline: consistent_comma
10+
Style/StringLiterals:
11+
Enabled: true
12+
EnforcedStyle: double_quotes
13+
Include:
14+
- "app/**/*"
15+
- "config/**/*"
16+
- "lib/**/*"
17+
- "spec/**/*"
18+
- "Gemfile"
19+
Bundler/OrderedGems:
20+
Enabled: true
21+
422
# Overwrite or add rules to create your own house style
523
#
624
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ gem "bcrypt", "~> 3.1.7"
2424
gem "tzinfo-data", platforms: %i[ windows jruby ]
2525

2626
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
27+
gem "solid_cable"
2728
gem "solid_cache"
2829
gem "solid_queue"
29-
gem "solid_cable"
3030

3131
# Reduces boot times through caching; required in config/boot.rb
3232
gem "bootsnap", require: false
@@ -46,17 +46,17 @@ group :development, :test do
4646

4747
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
4848
gem "brakeman", require: false
49+
gem "factory_bot_rails"
4950

5051
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
5152
gem "rubocop-rails-omakase", require: false
5253

5354
gem "rspec-rails"
54-
gem "factory_bot_rails"
5555
end
5656

5757
group :development do
58-
gem "hotwire-spark"
5958
gem "bullet"
59+
gem "hotwire-spark"
6060
gem "letter_opener"
6161
# Use console on exceptions pages [https://github.com/rails/web-console]
6262
gem "web-console"

config/initializers/filter_parameter_logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Use this to limit dissemination of sensitive information.
55
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
66
Rails.application.config.filter_parameters += [
7-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
7+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc,
88
]

spec/models/region_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
RSpec.describe Region, type: :model do
44
it { should validate_presence_of(:name) }

spec/rails_helper.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# This file is copied to spec/ when you run 'rails generate rspec:install'
2-
require 'spec_helper'
3-
ENV['RAILS_ENV'] ||= 'test'
4-
require_relative '../config/environment'
2+
require "spec_helper"
3+
ENV["RAILS_ENV"] ||= "test"
4+
require_relative "../config/environment"
55
# Prevent database truncation if the environment is production
66
abort("The Rails environment is running in production mode!") if Rails.env.production?
77
# Uncomment the line below in case you have `--require rails_helper` in the `.rspec` file
88
# that will avoid rails generators crashing because migrations haven't been run yet
99
# return unless Rails.env.test?
10-
require 'rspec/rails'
10+
require "rspec/rails"
1111
# Add additional requires below this line. Rails is not loaded until this point!
1212

1313
# Requires supporting ruby files with custom matchers and macros, etc, in
@@ -32,11 +32,11 @@
3232
rescue ActiveRecord::PendingMigrationError => e
3333
abort e.to_s.strip
3434
end
35-
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each(&method(:require))
35+
Dir[Rails.root.join("spec", "support", "**", "*.rb")].each(&method(:require))
3636
RSpec.configure do |config|
3737
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
3838
config.fixture_paths = [
39-
Rails.root.join('spec/fixtures')
39+
Rails.root.join("spec/fixtures"),
4040
]
4141

4242
# If you're not using ActiveRecord, or you'd prefer not to run each of your

spec/views/regions/edit.html.erb_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
RSpec.describe "regions/edit", type: :view do
44
let(:region) {
55
Region.create!(
6-
name: "MyString"
6+
name: "MyString",
77
)
88
}
99

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
RSpec.describe "regions/index", type: :view do
44
before(:each) do
5-
assign(:regions, [
6-
Region.create!(
7-
name: "Name"
8-
),
9-
Region.create!(
10-
name: "Name"
11-
)
12-
])
5+
assign(
6+
:regions,
7+
[
8+
Region.create!(name: "Name"),
9+
Region.create!(name: "Name"),
10+
],
11+
)
1312
end
1413

1514
it "renders a list of regions" do
1615
render
17-
cell_selector = 'table>tbody>tr'
16+
cell_selector = "table>tbody>tr"
1817
assert_select cell_selector, text: Regexp.new("Name".to_s), count: 2
1918
end
2019
end

spec/views/regions/new.html.erb_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
RSpec.describe "regions/new", type: :view do
44
before(:each) do
5-
assign(:region, Region.new(
6-
name: "MyString"
7-
))
5+
assign(:region, Region.new(name: "MyString"))
86
end
97

108
it "renders new region form" do

spec/views/regions/show.html.erb_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
RSpec.describe "regions/show", type: :view do
44
before(:each) do
5-
assign(:region, Region.create!(
6-
name: "Name"
7-
))
5+
assign(:region, Region.create!(name: "Name"))
86
end
97

108
it "renders attributes in <p>" do

0 commit comments

Comments
 (0)