2020-07-21 13:07:57 +00:00
|
|
|
# Default enabled cops
|
|
|
|
# https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
|
|
|
|
|
|
|
|
require:
|
2021-07-01 11:23:52 +00:00
|
|
|
- rubocop-faker
|
2020-07-21 13:07:57 +00:00
|
|
|
- rubocop-performance
|
|
|
|
- rubocop-rails
|
|
|
|
- rubocop-rspec
|
2020-08-03 08:35:43 +00:00
|
|
|
- ./rubocop_zammad.rb
|
2020-07-21 13:07:57 +00:00
|
|
|
|
|
|
|
inherit_from:
|
|
|
|
- todo.yml
|
|
|
|
- todo.rspec.yml
|
|
|
|
|
2021-07-19 12:24:09 +00:00
|
|
|
inherit_mode:
|
|
|
|
merge:
|
|
|
|
- Include
|
|
|
|
|
2020-07-21 13:07:57 +00:00
|
|
|
AllCops:
|
|
|
|
NewCops: enable
|
|
|
|
DisplayCopNames: true
|
2021-07-19 12:24:09 +00:00
|
|
|
Include:
|
|
|
|
- '.gitlab/**/*.rb'
|
|
|
|
- '.github/**/*.rb'
|
|
|
|
- '.rubocop/**/*.rb'
|
2020-07-21 13:07:57 +00:00
|
|
|
Exclude:
|
2021-06-23 11:35:27 +00:00
|
|
|
- 'bin/*'
|
2020-07-21 13:07:57 +00:00
|
|
|
- 'db/schema.rb'
|
|
|
|
- 'vendor/**/*'
|
|
|
|
- 'node_modules/**/*'
|
|
|
|
- 'public/assets/**/*'
|
|
|
|
- 'public/packs/**/*'
|
2020-11-24 16:20:57 +00:00
|
|
|
RSpec:
|
|
|
|
Include:
|
|
|
|
- "**/*_spec.rb"
|
|
|
|
- "**/*_examples.rb"
|
2020-07-21 13:07:57 +00:00
|
|
|
|
|
|
|
Rails:
|
|
|
|
Enabled: true
|
|
|
|
|
|
|
|
# Zammad StyleGuide
|
|
|
|
|
|
|
|
Style/FrozenStringLiteralComment:
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/LineLength:
|
|
|
|
Description: 'Limit lines to 80 characters.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/NegatedIf:
|
|
|
|
Description: >-
|
|
|
|
Favor unless over if for negative conditions
|
|
|
|
(or control flow or).
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/IfUnlessModifier:
|
|
|
|
Description: >-
|
|
|
|
Favor modifier if/unless usage when you have a
|
|
|
|
single-line body.
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/TrailingCommaInArrayLiteral:
|
|
|
|
Description: 'Checks for trailing comma in array literals.'
|
|
|
|
StyleGuide: '#no-trailing-array-commas'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/TrailingCommaInHashLiteral:
|
|
|
|
Description: 'Checks for trailing comma in hash literals.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/TrailingCommaInArguments:
|
|
|
|
Description: 'Checks for trailing comma in argument lists.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/RescueStandardError:
|
|
|
|
Description: 'Avoid rescuing without specifying an error class.'
|
|
|
|
Enabled: true
|
|
|
|
EnforcedStyle: implicit
|
|
|
|
|
|
|
|
Layout/SpaceInsideReferenceBrackets:
|
|
|
|
Description: 'Checks the spacing inside referential brackets.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/SpaceInsideArrayLiteralBrackets:
|
|
|
|
Description: 'Checks the spacing inside array literal brackets.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/DefWithParentheses:
|
|
|
|
Description: 'Use def with parentheses when there are arguments.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/HashAlignment:
|
|
|
|
Description: >-
|
|
|
|
Align the elements of a hash literal if they span more than
|
|
|
|
one line.
|
|
|
|
Enabled: true
|
|
|
|
EnforcedHashRocketStyle: table
|
|
|
|
EnforcedColonStyle: table
|
|
|
|
EnforcedLastArgumentHashStyle: always_inspect
|
|
|
|
|
|
|
|
Layout/EmptyLinesAroundClassBody:
|
|
|
|
Description: "Keeps track of empty lines around class bodies."
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/EmptyLinesAroundMethodBody:
|
|
|
|
Description: "Keeps track of empty lines around method bodies."
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/EmptyLinesAroundBlockBody:
|
|
|
|
Description: "Keeps track of empty lines around block bodies."
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/EmptyLinesAroundModuleBody:
|
|
|
|
Description: "Keeps track of empty lines around module bodies."
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Layout/ExtraSpacing:
|
|
|
|
Description: 'Do not use unnecessary spacing.'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- 'config/routes/**/*'
|
|
|
|
- 'db/migrate/20120101000001_create_base.rb'
|
|
|
|
- 'db/migrate/20120101000010_create_ticket.rb'
|
|
|
|
|
|
|
|
Style/MultilineBlockChain:
|
|
|
|
Description: 'Avoid multi-line chains of blocks.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Metrics/ClassLength:
|
|
|
|
Description: 'Avoid classes longer than 100 lines of code.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Metrics/MethodLength:
|
|
|
|
Description: 'Avoid methods longer than 10 lines of code.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/BlockComments:
|
|
|
|
Description: 'Do not use block comments.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Style/PerlBackrefs:
|
|
|
|
Description: 'Avoid Perl-style regex back references.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Rails/ApplicationRecord:
|
|
|
|
Exclude:
|
|
|
|
- 'app/models/application_model.rb'
|
|
|
|
- 'app/models/active_job_lock.rb'
|
|
|
|
|
|
|
|
Rails/BulkChangeTable:
|
|
|
|
Description: 'Check whether alter queries are combinable.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Rails/FindEach:
|
|
|
|
Description: 'Prefer all.find_each over all.find.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Rails/HasAndBelongsToMany:
|
|
|
|
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
|
|
|
# StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
|
|
|
|
Enabled: false
|
|
|
|
|
2020-09-30 09:07:01 +00:00
|
|
|
Rails/MatchRoute:
|
|
|
|
Description: >-
|
|
|
|
Don't use `match` to define any routes unless there is a need to map multiple request types
|
|
|
|
among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option.
|
|
|
|
StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes'
|
|
|
|
Enabled: false
|
|
|
|
|
2020-07-21 13:07:57 +00:00
|
|
|
Rails/SkipsModelValidations:
|
|
|
|
Description: >-
|
|
|
|
Use methods that skips model validations with caution.
|
|
|
|
See reference for more information.
|
|
|
|
Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- test/**/*
|
|
|
|
- "**/*_spec.rb"
|
|
|
|
- "**/*_examples.rb"
|
|
|
|
|
|
|
|
Style/ClassAndModuleChildren:
|
|
|
|
Description: 'Checks style of children classes and modules.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Naming/FileName:
|
|
|
|
Description: 'Use snake_case for source file names.'
|
|
|
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- 'script/websocket-server.rb'
|
|
|
|
|
|
|
|
Naming/VariableNumber:
|
|
|
|
Description: 'Use the configured style when numbering variables.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Naming/MethodParameterName:
|
|
|
|
Description: >-
|
|
|
|
Checks for method parameter names that contain capital letters,
|
|
|
|
end in numbers, or do not meet a minimal length.
|
|
|
|
Enabled: true
|
|
|
|
AllowedNames: e, id, _, ip, to
|
|
|
|
|
|
|
|
Lint/BooleanSymbol:
|
|
|
|
Description: 'Check for `:true` and `:false` symbols.'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- "db/seeds/object_manager_attributes.rb"
|
|
|
|
- "spec/requests/integration/object_manager_attributes_spec.rb"
|
|
|
|
- "test/integration/object_manager_test.rb"
|
|
|
|
|
|
|
|
Lint/InterpolationCheck:
|
|
|
|
Description: 'Raise warning for interpolation in single q strs'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- "test/unit/email_process_auto_response_test.rb"
|
|
|
|
- "test/unit/email_process_bounce_delivery_permanent_failed_test.rb"
|
|
|
|
- "test/unit/email_process_bounce_follow_test.rb"
|
|
|
|
- "test/unit/notification_factory_renderer_test.rb"
|
|
|
|
- "test/unit/notification_factory_template_test.rb"
|
|
|
|
- "test/unit/ticket_trigger_test.rb"
|
|
|
|
- "test/unit/ticket_trigger_recursive_disabled_test.rb"
|
|
|
|
|
2020-09-30 09:07:01 +00:00
|
|
|
Style/StringConcatenation:
|
|
|
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
|
|
|
StyleGuide: '#string-interpolation'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- "config/routes/**/*"
|
|
|
|
|
2021-05-12 11:37:44 +00:00
|
|
|
Style/RegexpLiteral:
|
2021-05-28 11:25:36 +00:00
|
|
|
Description: 'This cop enforces using // or %r around regular expressions.'
|
2021-05-12 11:37:44 +00:00
|
|
|
EnforcedStyle: percent_r
|
|
|
|
|
2021-05-28 11:25:36 +00:00
|
|
|
Style/RedundantBegin:
|
|
|
|
Description: 'This cop checks for redundant `begin` blocks.'
|
|
|
|
Enabled: false
|
|
|
|
|
|
|
|
Rails/EnvironmentVariableAccess:
|
|
|
|
Description: 'This cop looks for direct access to environment variables through the ENV variable within the application code.'
|
|
|
|
Enabled: true
|
|
|
|
AllowReads: true
|
|
|
|
|
2021-05-31 13:51:29 +00:00
|
|
|
Rails/Output:
|
|
|
|
Exclude:
|
|
|
|
- "lib/tasks/**/*"
|
2021-08-12 19:22:12 +00:00
|
|
|
Include:
|
|
|
|
- "**/*_spec.rb"
|
2021-05-31 13:51:29 +00:00
|
|
|
|
2020-07-21 13:07:57 +00:00
|
|
|
# RSpec tests
|
|
|
|
Style/NumericPredicate:
|
|
|
|
Description: >-
|
|
|
|
Checks for the use of predicate- or comparison methods for
|
|
|
|
numeric comparisons.
|
|
|
|
StyleGuide: '#predicate-methods'
|
|
|
|
# This will change to a new method call which isn't guaranteed to be on the
|
|
|
|
# object. Switching these methods has to be done with knowledge of the types
|
|
|
|
# of the variables which rubocop doesn't have.
|
|
|
|
AutoCorrect: false
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- "**/*_spec.rb"
|
|
|
|
|
|
|
|
Lint/AmbiguousBlockAssociation:
|
|
|
|
Description: >-
|
|
|
|
Checks for ambiguous block association with method when param
|
|
|
|
passed without parentheses.
|
|
|
|
StyleGuide: '#syntax'
|
|
|
|
Enabled: true
|
|
|
|
Exclude:
|
|
|
|
- "spec/support/*.rb"
|
|
|
|
- "**/*_spec.rb"
|
|
|
|
- "**/*_examples.rb"
|
|
|
|
|
|
|
|
Layout/MultilineMethodCallIndentation:
|
|
|
|
Description: >-
|
|
|
|
Checks the indentation of the method name part in method calls
|
|
|
|
that span more than one line.
|
|
|
|
EnforcedStyle: indented
|
|
|
|
Include:
|
|
|
|
- "**/*_spec.rb"
|
2020-08-18 13:01:18 +00:00
|
|
|
|
2020-08-05 13:48:41 +00:00
|
|
|
Lint/UnusedMethodArgument:
|
|
|
|
AllowUnusedKeywordArguments: true
|
|
|
|
|
2021-06-02 15:16:04 +00:00
|
|
|
RSpec/NestedGroups:
|
|
|
|
Max: 6
|
|
|
|
|
2021-07-09 13:13:27 +00:00
|
|
|
RSpec/Rails/AvoidSetupHook:
|
|
|
|
Exclude:
|
|
|
|
- "test/**/*"
|
|
|
|
|
2020-08-18 13:01:18 +00:00
|
|
|
Zammad/PreferNegatedIfOverUnless:
|
|
|
|
Exclude:
|
|
|
|
- 'bin/rspec'
|
2020-11-13 08:02:02 +00:00
|
|
|
|
|
|
|
Zammad/ExistsDateTimePrecision:
|
|
|
|
Include:
|
|
|
|
- "db/migrate/*.rb"
|
2020-11-23 09:08:28 +00:00
|
|
|
- "**/db/addon/**/*.rb"
|
2020-11-13 08:02:02 +00:00
|
|
|
|
|
|
|
Zammad/ExistsResetColumnInformation:
|
|
|
|
Include:
|
|
|
|
- "db/migrate/*.rb"
|
2020-11-23 09:08:28 +00:00
|
|
|
- "**/db/addon/**/*.rb"
|
2021-06-21 09:49:35 +00:00
|
|
|
Exclude:
|
|
|
|
- 'db/migrate/201*_*.rb'
|
|
|
|
- 'db/migrate/2020*_*.rb'
|
2021-09-20 07:14:27 +00:00
|
|
|
|
|
|
|
Zammad/ExistsDbStrategy:
|
|
|
|
Include:
|
|
|
|
- "spec/**/*.rb"
|
|
|
|
Exclude:
|
|
|
|
- spec/support/capybara/common_actions.rb
|