Skip to content

Commit 4969e3f

Browse files
authored
Merge pull request #122 from publify/update-rubocop-configuration
Update RuboCop configuration and autocorrect new offenses
2 parents f77835f + f122010 commit 4969e3f

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

.rubocop.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ inherit_mode:
44
merge:
55
- Exclude
66

7-
require:
7+
plugins:
8+
- rubocop-capybara
9+
- rubocop-factory_bot
810
- rubocop-performance
911
- rubocop-rails
1012
- rubocop-rspec
13+
- rubocop-rspec_rails
1114

1215
AllCops:
1316
Exclude:
@@ -20,14 +23,19 @@ AllCops:
2023
Rails:
2124
Enabled: true
2225

23-
# We have duplication due to extra logic in the Gemfile
24-
Bundler/DuplicatedGem:
25-
Enabled: false
26+
# Require tests to specify whether an element is a link or a button
27+
Capybara/ClickLinkOrButtonStyle:
28+
EnforcedStyle: strict
29+
30+
# Match style of regular expectations
31+
Capybara/NegationMatcher:
32+
EnforcedStyle: not_to
2633

2734
# Put development dependencies in the gemspec so rubygems.org knows about them
2835
Gemspec/DevelopmentDependencies:
2936
EnforcedStyle: gemspec
3037

38+
# Make BeginEndAlignment behavior match EndAlignment
3139
Layout/BeginEndAlignment:
3240
EnforcedStyleAlignWith: begin
3341

@@ -103,6 +111,10 @@ Rails/SkipsModelValidations:
103111
Exclude:
104112
- 'spec/dummy/db/migrate/*'
105113

114+
# Spec type inference is disabled, so this cop must be disabled too.
115+
RSpecRails/InferredSpecType:
116+
Enabled: false
117+
106118
# Allow the use of 'and' 'or' in control structures.
107119
Style/AndOr:
108120
EnforcedStyle: conditionals
@@ -163,14 +175,6 @@ Style/StringLiteralsInInterpolation:
163175
Style/SymbolArray:
164176
EnforcedStyle: brackets
165177

166-
# Prefer consistent lines for multi-line arrays
167-
Style/TrailingCommaInArrayLiteral:
168-
EnforcedStyleForMultiline: comma
169-
170-
# Prefer consistent lines for multi-line hashes
171-
Style/TrailingCommaInHashLiteral:
172-
EnforcedStyleForMultiline: comma
173-
174178
# Allow small arrays of words with quotes
175179
Style/WordArray:
176180
MinSize: 4

publify_textfilter_code.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ Gem::Specification.new do |s|
2525
s.add_development_dependency "appraisal", "~> 2.3"
2626
s.add_development_dependency "rspec-rails", "~> 6.0"
2727
s.add_development_dependency "rubocop", "~> 1.80.2"
28+
s.add_development_dependency "rubocop-capybara", "~> 2.22.1"
29+
s.add_development_dependency "rubocop-factory_bot", "~> 2.27.1"
2830
s.add_development_dependency "rubocop-performance", "~> 1.25.0"
2931
s.add_development_dependency "rubocop-rails", "~> 2.33.3"
3032
s.add_development_dependency "rubocop-rspec", "~> 3.7.0"
33+
s.add_development_dependency "rubocop-rspec_rails", "~> 2.31.0"
3134
s.add_development_dependency "simplecov", "~> 0.22.0"
3235
s.add_development_dependency "sqlite3", "~> 1.4"
3336
s.metadata["rubygems_mfa_required"] = "true"

spec/dummy/config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
config.cache_store = :memory_store
2323
config.public_file_server.headers = {
24-
"Cache-Control" => "public, max-age=#{2.days.to_i}",
24+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
2525
}
2626
else
2727
config.action_controller.perform_caching = false

spec/dummy/config/environments/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Configure public file server for tests with Cache-Control for performance.
1818
config.public_file_server.enabled = true
1919
config.public_file_server.headers = {
20-
"Cache-Control" => "public, max-age=#{1.hour.to_i}",
20+
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
2121
}
2222

2323
# Show full error reports and disable caching.

0 commit comments

Comments
 (0)