Configure RuboCop
This commit is contained in:
parent
2e826cf12c
commit
dc2abd5557
4 changed files with 77 additions and 3 deletions
39
.rubocop.yml
Normal file
39
.rubocop.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
AllCops:
|
||||
TargetRubyVersion: 2.5
|
||||
DisplayCopNames: true
|
||||
|
||||
Exclude:
|
||||
- 'bin/**/*'
|
||||
- 'db/schema.rb'
|
||||
- 'vendor/**/*'
|
||||
|
||||
Layout/AccessModifierIndentation:
|
||||
EnforcedStyle: outdent
|
||||
|
||||
Layout/EmptyLinesAroundArguments:
|
||||
Enabled: false
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
|
||||
Style/AndOr:
|
||||
EnforcedStyle: conditionals
|
||||
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
- 'app/**/*'
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
4
Gemfile
4
Gemfile
|
@ -37,6 +37,10 @@ group :development, :test do
|
|||
# Call 'byebug' anywhere in the code to stop execution
|
||||
# and get a debugger console.
|
||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||
|
||||
# Automatic Ruby code style checking tool.
|
||||
# Aims to enforce the community-driven Ruby Style Guide.
|
||||
gem 'rubocop', '~> 0.60.0'
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
|
18
Gemfile.lock
18
Gemfile.lock
|
@ -43,6 +43,7 @@ GEM
|
|||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (9.0.0)
|
||||
ast (2.4.0)
|
||||
bindex (0.5.0)
|
||||
bootsnap (1.3.2)
|
||||
msgpack (~> 1.0)
|
||||
|
@ -58,6 +59,7 @@ GEM
|
|||
activesupport (>= 4.2.0)
|
||||
i18n (1.1.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.1)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
|
@ -78,7 +80,11 @@ GEM
|
|||
nio4r (2.3.1)
|
||||
nokogiri (1.8.5)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
parallel (1.12.1)
|
||||
parser (2.5.3.0)
|
||||
ast (~> 2.4.0)
|
||||
pg (1.1.3)
|
||||
powerpack (0.1.2)
|
||||
pry (0.12.2)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
|
@ -112,10 +118,20 @@ GEM
|
|||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
rake (12.3.1)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
rubocop (0.60.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.5, != 2.5.1.1)
|
||||
powerpack (~> 0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (~> 1.4.0)
|
||||
ruby-progressbar (1.10.0)
|
||||
ruby_dep (1.5.0)
|
||||
sass (3.7.2)
|
||||
sass-listen (~> 4.0.0)
|
||||
|
@ -150,6 +166,7 @@ GEM
|
|||
thread_safe (~> 0.1)
|
||||
uglifier (4.1.20)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (1.4.0)
|
||||
web-console (3.7.0)
|
||||
actionview (>= 5.0)
|
||||
activemodel (>= 5.0)
|
||||
|
@ -170,6 +187,7 @@ DEPENDENCIES
|
|||
pry-rails (~> 0.3)
|
||||
puma (~> 3.11)
|
||||
rails (~> 5.2.1)
|
||||
rubocop (~> 0.60.0)
|
||||
sass-rails (~> 5.0)
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
|
|
19
Rakefile
19
Rakefile
|
@ -1,6 +1,19 @@
|
|||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require_relative 'config/application'
|
||||
|
||||
Rails.application.load_tasks
|
||||
|
||||
desc 'Run all checks (test, lint...)'
|
||||
task default: :lint
|
||||
|
||||
desc 'Run all code analysis tools (RuboCop...)'
|
||||
task lint: :rubocop
|
||||
|
||||
desc 'Fix code style (rubocop --auto-correct)'
|
||||
task fix: 'rubocop:auto_correct'
|
||||
|
||||
begin
|
||||
require 'rubocop/rake_task'
|
||||
RuboCop::RakeTask.new
|
||||
rescue LoadError
|
||||
nil
|
||||
end
|
||||
|
|
Reference in a new issue