-
Notifications
You must be signed in to change notification settings - Fork 650
/
.rubocop.yml
193 lines (152 loc) · 3.98 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
190
191
192
193
# Extends defaults from: https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
AllCops:
TargetRubyVersion: 2.5
Exclude:
- "vendor/**/*"
- "db/schema.rb"
- "bin"
- "coverage"
- "doc"
- "engines"
- "lib/assets"
- "lib/build"
- "log"
- "node_modules"
- "public"
- "script"
- "tmp"
- "vendor"
NewCops: disable
####################
# Layout
####################
Layout/LineLength:
Description: Checks that line length does not exceed the configured limit.
Max: 120
Layout/EmptyLinesAroundClassBody:
Description: Keeps track of empty lines around class bodies.
EnforcedStyle: empty_lines_except_namespace
Layout/EmptyLinesAroundModuleBody:
Description: Keeps track of empty lines around module bodies.
EnforcedStyle: empty_lines_except_namespace
####################
# Metrics
####################
Metrics/AbcSize:
Description: >-
A calculated magnitude based on number of assignments,
branches, and conditions.
Max: 35
Metrics/BlockLength:
Description: Avoid long blocks with many lines.
Max: 50
Exclude:
- '**/*.gemspec'
- spec/**/*_spec.rb
- lib/tasks/**/*.rake
Metrics/ClassLength:
Description: Avoid classes longer than 400 lines of code.
Max: 400
Metrics/CyclomaticComplexity:
Description: >-
A complexity metric that is strongly correlated to the number
of test cases needed to validate a method.
Max: 15
Metrics/MethodLength:
Description: Avoid methods longer than 100 lines of code.
Max: 100
Metrics/ModuleLength:
Description: Avoid modules longer than 400 lines of code.
Max: 400
Metrics/PerceivedComplexity:
Description: >-
A complexity metric geared towards measuring complexity for a
human reader.
Max: 15
####################
# Naming
####################
Naming/PredicateName:
ForbiddenPrefixes:
- is_
- have_
Naming/VariableNumber:
Description: Use the configured style when numbering variables.
Enabled: false
####################
# RSpec
####################
RSpec/AnyInstance:
Enabled: false
RSpec/ExampleLength:
Max: 50
# Incompatible until RSpec 3
RSpec/ImplicitExpect:
Enabled: false
RSpec/MessageSpies:
Enabled: false
RSpec/MultipleExpectations:
Max: 10
RSpec/MultipleMemoizedHelpers:
Max: 15
RSpec/NestedGroups:
Max: 5
RSpec/StubbedMock:
Enabled: false
RSpec/SubjectStub:
Enabled: false
####################
# Style
####################
Style/PercentLiteralDelimiters:
Description: Use `%`-literal delimiters consistently.
Enabled: false
Style/StringLiterals:
Description: Checks if uses of quotes match the configured preference.
EnforcedStyle: single_quotes
Style/Documentation:
Description: Document classes and non-namespace modules.
Enabled: false
Style/DoubleNegation:
Description: Checks for uses of double negation (!!).
Enabled: false
Style/FrozenStringLiteralComment:
Description: >-
Add the frozen_string_literal comment to the top of files
to help transition to frozen string literals by default.
Enabled: false
Style/GlobalVars:
# These variables were already defined when we set up the linter, so allow them for the time being
AllowedVariables:
- $api_credentials
- $geocoder_metrics
- $limits_metadata
- $redis_migrator_logs
- $tables_metadata
- $tables_metadata_secondary
- $users_metadata
- $users_metadata_secondary
Style/GuardClause:
Enabled: false
Style/SymbolArray:
Description: Use %i or %I for arrays of symbols.
Enabled: false
Style/WordArray:
Description: Use %w or %W for arrays of words.
Enabled: false
####################
# Rails
####################
Rails/CreateTableWithTimestamps:
Description: Create new tables with created_at and updated_at timestamps
Enabled: false
Rails/UnknownEnv:
Environments:
- development
- production
- staging
- test