-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
189 lines (156 loc) · 4.76 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec
AllCops:
SuggestExtensions: false
TargetRubyVersion: 3.1.2
NewCops: enable
Exclude:
- ".git/**/*"
- ".idea/**/*"
- "init/*"
- "Rakefile"
- "*.gemspec"
- "spec/**/*"
- "vendor/**/*"
- "scratch*.rb"
# Align the elements of a hash literal if they span more than one line.
Layout/HashAlignment:
EnforcedLastArgumentHashStyle: always_ignore
# Alignment of parameters in multi-line method definition.
# The `with_fixed_indentation` style aligns the following lines with one
# level of indentation relative to the start of the line with the method
# definition.
#
# def my_method(a,
# b)
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
# Alignment of parameters in multi-line method call.
# The `with_fixed_indentation` style aligns the following lines with one
# level of indentation relative to the start of the line with the method call.
#
# my_method(a,
# b)
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
# a = case n
# when 0
# x * 2
# else
# y / 3
# end
Layout/CaseIndentation:
EnforcedStyle: end
# Enforces a configured order of definitions within a class body
Layout/ClassStructure:
Enabled: true
# Align `end` with the matching keyword or starting expression except for
# assignments, where it should be aligned with the LHS.
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
AutoCorrect: true
# The `consistent` style enforces that the first element in an array
# literal where the opening bracket and the first element are on
# seprate lines is indented the same as an array literal which is not
# defined inside a method call.
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
# The `consistent` style enforces that the first key in a hash
# literal where the opening brace and the first key are on
# seprate lines is indented the same as a hash literal which is not
# defined inside a method call.
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# Indent multi-line methods instead of aligning with periods
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# Allow `debug` in tasks for now
Lint/Debugger:
Exclude:
- "RakeFile"
# A calculated magnitude based on number of assignments, branches, and
# conditions.
# NOTE: This is temporarily disabled until we can eliminate existing Rubocop
# complaints
Metrics/AbcSize:
Enabled: false
# Avoid long blocks with many lines.
Metrics/BlockLength:
Exclude:
- "RakeFile"
- "db/seeds.rb"
- "spec/**/*.rb"
# Avoid classes longer than 100 lines of code.
# NOTE: This is temporarily disabled until we can eliminate existing Rubocop
# complaints
Metrics/ClassLength:
Max: 200
Exclude:
- "spec/**/*.rb"
# A complexity metric that is strongly correlated to the number of test cases
# needed to validate a method.
Metrics/CyclomaticComplexity:
Max: 9
# Limit lines to 80 characters
Layout/LineLength:
Exclude:
- "RakeFile"
- "spec/**/*.rb"
# Avoid methods longer than 15 lines of code.
Metrics/MethodLength:
Max: 20
AllowedMethods:
- swagger_path
- operation
# A complexity metric geared towards measuring complexity for a human reader.
Metrics/PerceivedComplexity:
Max: 10
# Naming/FileName:
# Exclude:
# - 'lib/file.rb'
# Allow `downcase == ` instead of forcing `casecmp`
Performance/Casecmp:
Enabled: false
# Require children definitions to be nested or compact in classes and modules
Style/ClassAndModuleChildren:
Enabled: false
# Document classes and non-namespace modules.
# (Disabled for now, may revisit later)
Style/Documentation:
Enabled: false
# Checks the formatting of empty method definitions.
Style/EmptyMethod:
EnforcedStyle: expanded
# Add the frozen_string_literal comment to the top of files to help transition
# to frozen string literals by default.
Style/FrozenStringLiteralComment:
EnforcedStyle: always
# Check for conditionals that can be replaced with guard clauses
Style/GuardClause:
Enabled: false
Style/MixinUsage:
Exclude:
- "RakeFile"
# Avoid multi-line method signatures.
Style/MultilineMethodSignature:
Enabled: true
# Don't use option hashes when you can use keyword arguments.
Style/OptionHash:
Enabled: true
# Use return instead of return nil.
Style/ReturnNil:
Enabled: true
# Allow code like `return x, y` as it's occasionally handy.
Style/RedundantReturn:
AllowMultipleReturnValues: true
# Prefer symbols instead of strings as hash keys.
Style/StringHashKeys:
Enabled: true
# Checks if configured preferred methods are used over non-preferred.
Style/StringMethods:
Enabled: true
# Checks for use of parentheses around ternary conditions.
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex