mirror of
https://github.com/redmine/redmine.git
synced 2025-12-15 21:10:27 +01:00
Add RuboCop to enforce some styles (#31509).
Patch by Marius BALTEANU and Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@18259 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
44
.rubocop.yml
Normal file
44
.rubocop.yml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
inherit_from: .rubocop_todo.yml
|
||||||
|
|
||||||
|
AllCops:
|
||||||
|
TargetRubyVersion: 2.3
|
||||||
|
TargetRailsVersion: 5.2
|
||||||
|
|
||||||
|
Exclude:
|
||||||
|
- '**/vendor/**/*'
|
||||||
|
- '**/tmp/**/*'
|
||||||
|
- '**/bin/**/*'
|
||||||
|
- '**/plugins/**/*'
|
||||||
|
- '**/extra/**/*'
|
||||||
|
- '**/lib/generators/**/templates/*'
|
||||||
|
- '**/lib/tasks/**/*'
|
||||||
|
- '**/files/**/*'
|
||||||
|
|
||||||
|
# Enable extensions
|
||||||
|
|
||||||
|
Rails:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# Rules for Redmine
|
||||||
|
|
||||||
|
Layout/SpaceBeforeBlockBraces:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/BulkChangeTable:
|
||||||
|
Exclude:
|
||||||
|
- 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
|
||||||
|
- 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'
|
||||||
|
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: always
|
||||||
|
Exclude:
|
||||||
|
- 'db/**/*.rb'
|
||||||
|
- 'Gemfile'
|
||||||
|
- 'Rakefile'
|
||||||
|
- 'config.ru'
|
||||||
|
- 'config/additional_environment.rb'
|
||||||
|
|
||||||
|
Style/HashSyntax:
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: no_mixed_keys
|
||||||
2208
.rubocop_todo.yml
Normal file
2208
.rubocop_todo.yml
Normal file
File diff suppressed because it is too large
Load Diff
2
Gemfile
2
Gemfile
@@ -84,6 +84,8 @@ group :test do
|
|||||||
gem 'puma', '~> 3.7'
|
gem 'puma', '~> 3.7'
|
||||||
gem "capybara", '~> 2.13'
|
gem "capybara", '~> 2.13'
|
||||||
gem "selenium-webdriver"
|
gem "selenium-webdriver"
|
||||||
|
# RuboCop
|
||||||
|
gem 'rubocop', '~> 0.71.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
|
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
|
||||||
|
|||||||
@@ -71,3 +71,12 @@ https://sites.google.com/a/chromium.org/chromedriver/
|
|||||||
|
|
||||||
Capybara tests can be run with:
|
Capybara tests can be run with:
|
||||||
`rails test:system`
|
`rails test:system`
|
||||||
|
|
||||||
|
Running RuboCop, a static code analyzer
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
RuboCop allows you to find out if the code violates the Ruby Style Guide.
|
||||||
|
Checking with RuboCop is recommended when you write patches.
|
||||||
|
|
||||||
|
You can run RuboCop with:
|
||||||
|
`bundle exec rubocop [file ...]`
|
||||||
|
|||||||
Reference in New Issue
Block a user