Skip to content

Commit

Permalink
[ci] Split rubocop setup in rails and non-rails config
Browse files Browse the repository at this point in the history
Rubocop was not prepared to work with the previous set up and this was
breaking some cops, specially the Rails one.

Splitting the configuration up makes the setup simpler and better to
maintain.

Rubocop todo files were created with:
* rails conf:     rubocop --auto-gen-config --ignore-parent-exclusion
* non-rails conf: rubocop --auto-gen-config

Co-authored-by: Björn Geuken <bgeuken@suse.de>
Co-authored-by: Ana María Martínez Gómez <ammartinez@suse.de>
  • Loading branch information
3 people committed Jun 22, 2018
1 parent c32e16a commit 4341f34
Show file tree
Hide file tree
Showing 4 changed files with 1,478 additions and 1,212 deletions.
63 changes: 2 additions & 61 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
require: rubocop-rspec

inherit_from: .rubocop_todo.yml

AllCops:
UseCache: true
CacheRootDirectory: src/api/tmp/rubocop_cache
CacheRootDirectory: tmp/rubocop_cache_root_dir
MaxFilesInCache: 2000
Exclude:
- 'src/api/tmp/**/*'
- 'src/api/lib/templates/**/*'
- 'src/api/vendor/bundle/**/*'
- 'src/api/**/*'
- 'docs/api/restility/**/*'
- 'src/api/test/fixtures/backend/**/*'
- 'src/api/files/*'
- 'src/backend/**/*'
- 'src/api/db/data_schema.rb'
# These files are RPM spec files
- 'dist/obs-api-deps.spec'
- 'dist/obs-server.spec'
Expand Down Expand Up @@ -54,16 +47,6 @@ Style/CommandLiteral:
Style/Documentation:
Enabled: false

# We need to allow some variables related to rabbiMQ.
Style/GlobalVars:
AllowedVariables: ['$rabbitmq_conn', '$rabbitmq_exchange', '$rabbitmq_channel']

# Checks for chaining of a block after another block that spans multiple lines.
# We disabled this cop because of Rantly.
Style/MultilineBlockChain:
Exclude:
- 'src/api/spec/**/*'

# Checks for redundant `return` expressions
Style/RedundantReturn:
Enabled: false
Expand All @@ -76,10 +59,6 @@ Style/WordArray:

##################### Metrics ##################################

Metrics/BlockLength:
Exclude:
- 'src/api/config/routes.rb'

# Checks if the length a class exceeds some maximum value
Metrics/ClassLength:
Severity: refactor
Expand All @@ -92,41 +71,3 @@ Metrics/LineLength:
# Checks if the length a module exceeds some maximum value
Metrics/ModuleLength:
Severity: refactor

##################### Rails ##################################

Rails:
Enabled: true

# Actually is not possible to enable this cop because we have several overwritten methods.
Rails/DynamicFindBy:
Enabled: false

# Enforces that 'exit' calls are not used.
Rails/Exit:
Exclude:
- 'src/api/lib/memory_dumper.rb'

Rails/HasAndBelongsToMany:
Enabled: false

# FIXME: Disabled due to a bug in Rubocop. Once it is fixed in this PR (https://github.com/bbatsov/rubocop/pull/5707), it could be enabled again
Rails/HttpStatus:
Enabled: false

# Checks for the use of output calls like puts and print
Rails/Output:
Exclude:
- 'src/api/app/jobs/*'
- 'src/api/config/*'
- 'src/api/db/**/*'
- 'src/api/lib/**/*'

# Disabled due to a bug
Rails/BulkChangeTable:
Enabled: false

# Disabled as we currently violate it everywhere in spec/features directory
# we first need to discuss if we want to move this directory and then fix the violation
Capybara/FeatureMethods:
Enabled: false
Loading

0 comments on commit 4341f34

Please sign in to comment.