-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.rubocop.yml
123 lines (95 loc) · 3.52 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# SEVERITY LEVELS
# In the GitHub CI/CD, we can only distinguish between "error" and "warning".
# In Rubocop this is much more granular: "info", "refactor", "convention",
# "warning", "error" and "fatal".
# From the docs: "The level is normally 'warning' for Lint and 'convention' for
# all the others, but this can be changed in user configuration."
# However, we don't want to set the severity for each cop individually, so instead
# we set the fatal level as "convention" in the CI/CD,
# i.e. severity: "convention" and up will be treated as an error on GitHub
# and below as warning such that the check will still pass (with a warning).
#
# Overview:
# | RuboCop | GitHub |
# error error -> check fails
# warning error -> check fails
# convention error -> check fails
# refactor warning -> check passes
# info warning -> check passes
#
# also see the RuboCop docs on severity
# https://docs.rubocop.org/rubocop/configuration.html#severity
# "Rubocop defaults" are by default required/included:
# https://github.com/rubocop/rubocop/blob/master/config/default.yml
require:
- rubocop-performance
- rubocop-rails
AllCops:
# While default cops are automatically included, they are not "configured"
# by default (only on each next major version of RuboCop). Therefore, we
# have to explicitly configure them here.
# see https://docs.rubocop.org/rubocop/configuration.html#defaults
# and https://docs.rubocop.org/rubocop/1.2/versioning.html#pending-cops
NewCops: enable
# Ruby version is determined automatically from the Gemfile.lock
#############################################
# Layout
#############################################
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
Layout/IndentationConsistency:
EnforcedStyle: indented_internal_methods
Layout/LineLength:
Max: 100
#############################################
# Metrics
#############################################
Metrics:
Enabled: false
Metrics/ParameterLists:
Enabled: true
#############################################
# Performance
#############################################
Performance:
Severity: refactor # a warning in CI/CD
Performance/FlatMap:
Severity: warning # an error in CI/CD
#############################################
# Rails
#############################################
Rails/HasManyOrHasOneDependent:
Enabled: false
Rails/SkipsModelValidations:
AllowedMethods: ["touch", "touch_all"]
Rails/UnknownEnv:
Environments: ["development", "test", "production", "docker_development"]
#############################################
# Style
#############################################
Style/Documentation:
Enabled: false
Style/EmptyMethod:
EnforcedStyle: expanded
Style/FrozenStringLiteralComment:
EnforcedStyle: never
Style/HashSyntax:
EnforcedShorthandSyntax: never
Style/MethodCallWithArgsParentheses:
Enabled: true
AllowedMethods: ["authorize!", "authorize", "can", "can?", "head", "import",
"include", "not_to", "puts", "render", "require", "to"]
AllowedPatterns: [^redirect_]
# Don't enforce in migrations, as we have methods like `add_column`,
# `change_column` etc. and parentheses would be very annoying there.
Exclude: ["db/**/*"]
Style/RedundantReturn:
AllowMultipleReturnValues: true
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Style/SymbolArray:
EnforcedStyle: brackets
Style/WordArray:
EnforcedStyle: brackets