1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00

Add RuboCop configuration

This is similar to the work Christian Bruckmayer is doing over on
factory_bot. I read that Hound doesn't support the
`inherited_from` key, so I put all of the todos
from the auto-generated `.rubocop_todo.yml` straight into the
`.rubocop.yml`.

fixup! Add RuboCop configuration
This commit is contained in:
Daniel Colson 2018-09-17 20:40:28 -04:00
parent 08fd922fbf
commit 29249b3751
4 changed files with 213 additions and 0 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ pkg
rdoc rdoc
test.db test.db
tmp tmp
.rubocop-https*

194
.rubocop.yml Normal file
View file

@ -0,0 +1,194 @@
inherit_from:
- https://raw.githubusercontent.com/thoughtbot/guides/master/style/ruby/.rubocop.yml
AllCops:
Exclude:
- "tmp/**/*"
# TODO:
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-09-17 20:19:38 -0400 using RuboCop version 0.54.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/OrderedGems:
Exclude:
- 'Gemfile'
- 'gemfiles/rails4.2.gemfile'
- 'gemfiles/rails5.0.gemfile'
- 'gemfiles/rails5.1.gemfile'
- 'gemfiles/rails5.2.gemfile'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
# Include: **/*.gemspec
Gemspec/OrderedDependencies:
Exclude:
- 'factory_bot_rails.gemspec'
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc:
Exclude:
- 'features/step_definitions/rails_steps.rb'
- 'lib/generators/factory_bot/model/model_generator.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Width, IgnoredPatterns.
Layout/IndentationWidth:
Exclude:
- 'lib/generators/factory_bot/model/model_generator.rb'
# Offense count: 7
Lint/AmbiguousRegexpLiteral:
Exclude:
- 'features/step_definitions/appraisal.rb'
- 'features/step_definitions/rails_steps.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'Rakefile'
- 'features/support/env.rb'
# Offense count: 2
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 40
# Offense count: 2
# Configuration parameters: Blacklist.
# Blacklist: END, (?-mix:EO[A-Z]{1})
Naming/HeredocDelimiterNaming:
Exclude:
- 'features/step_definitions/rails_steps.rb'
# Offense count: 1
Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/generators/factory_bot.rb'
# Offense count: 9
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/factory_bot_rails.rb'
- 'lib/factory_bot_rails/definition_file_paths.rb'
- 'lib/factory_bot_rails/generator.rb'
- 'lib/factory_bot_rails/generators/non_rspec_generator.rb'
- 'lib/factory_bot_rails/generators/null_generator.rb'
- 'lib/factory_bot_rails/generators/rspec_generator.rb'
- 'lib/factory_bot_rails/railtie.rb'
- 'lib/factory_bot_rails/reloader.rb'
- 'lib/generators/factory_bot/model/model_generator.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'lib/factory_bot_rails/generators/null_generator.rb'
# Offense count: 29
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
Exclude:
- 'Rakefile'
- 'gemfiles/rails4.2.gemfile'
- 'gemfiles/rails5.0.gemfile'
- 'gemfiles/rails5.1.gemfile'
- 'gemfiles/rails5.2.gemfile'
# Offense count: 1
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'features/support/env.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Exclude:
- 'factory_bot_rails.gemspec'
- 'features/step_definitions/rails_steps.rb'
# Offense count: 84
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
EnforcedStyle: "double_quotes"
Exclude:
- 'Appraisals'
- 'Gemfile'
- 'Rakefile'
- 'factory_bot_rails.gemspec'
- 'features/step_definitions/rails_steps.rb'
- 'features/support/env.rb'
- 'lib/factory_bot_rails.rb'
- 'lib/factory_bot_rails/generator.rb'
- 'lib/factory_bot_rails/generators/rspec_generator.rb'
- 'lib/generators/factory_bot.rb'
- 'lib/generators/factory_bot/model/model_generator.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiteralsInInterpolation:
Exclude:
- 'lib/generators/factory_bot/model/model_generator.rb'
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArguments:
Exclude:
- 'spec/factory_bot_rails/definition_file_paths_spec.rb'
- 'lib/generators/factory_bot/model/model_generator.rb'
# Offense count: 4
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Exclude:
- 'factory_bot_rails.gemspec'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 3
# Offense count: 11
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 133
# Offense count: 1
# Cop supports --auto-correct.
Performance/RegexpMatch:
Exclude:
- 'Rakefile'

View file

@ -18,3 +18,5 @@ gem 'therubyrhino', platforms: :jruby
gem 'jruby-openssl', platforms: :jruby gem 'jruby-openssl', platforms: :jruby
gem 'sqlite3', platforms: :ruby gem 'sqlite3', platforms: :ruby
gem "rubocop", "0.54", require: false

View file

@ -49,6 +49,7 @@ GEM
ffi (~> 1.9.10) ffi (~> 1.9.10)
rspec-expectations (>= 2.99) rspec-expectations (>= 2.99)
thor (~> 0.19) thor (~> 0.19)
ast (2.4.0)
builder (3.2.3) builder (3.2.3)
childprocess (0.9.0) childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
@ -99,7 +100,11 @@ GEM
nokogiri (1.8.4) nokogiri (1.8.4)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
nokogiri (1.8.4-java) nokogiri (1.8.4-java)
parallel (1.12.1)
parser (2.5.1.2)
ast (~> 2.4.0)
power_assert (1.1.3) power_assert (1.1.3)
powerpack (0.1.2)
rack (2.0.5) rack (2.0.5)
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
@ -114,6 +119,7 @@ GEM
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (12.3.1) rake (12.3.1)
rspec-core (3.7.1) rspec-core (3.7.1)
rspec-support (~> 3.7.0) rspec-support (~> 3.7.0)
@ -132,6 +138,14 @@ GEM
rspec-mocks (~> 3.7.0) rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0) rspec-support (~> 3.7.0)
rspec-support (3.7.1) rspec-support (3.7.1)
rubocop (0.54.0)
parallel (~> 1.10)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.0)
sqlite3 (1.3.13) sqlite3 (1.3.13)
test-unit (3.2.8) test-unit (3.2.8)
power_assert power_assert
@ -145,6 +159,7 @@ GEM
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.16) uglifier (4.1.16)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.0)
PLATFORMS PLATFORMS
java java
@ -162,6 +177,7 @@ DEPENDENCIES
jruby-openssl jruby-openssl
rake rake
rspec-rails rspec-rails
rubocop (= 0.54)
sqlite3 sqlite3
test-unit test-unit
therubyrhino therubyrhino