-
Notifications
You must be signed in to change notification settings - Fork 62
/
.rubocop.yml
194 lines (153 loc) · 3.54 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
194
require:
- rubocop-rails
# Disable defaults
AllCops:
# Enable future cops not specified here.
NewCops: enable
Exclude:
- "bin/**/*"
- "db/schema.rb"
- "script/**/*"
- "tmp/**/*"
- "uploads/**/*"
- "vendor/**/*"
- "node_modules/**/*"
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/CaseIndentation:
EnforcedStyle: end
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Layout/LineLength:
Enabled: true
Max: 120
IgnoredPatterns:
# Test descriptors
- ^\s*(describe|it|context|scenario) ".+" do$
Lint/RedundantCopDisableDirective:
Enabled: false
Lint/UnusedMethodArgument:
# Otherwise we have to remove named args from the method signature altogether which seems to reduce
# clarity of the code.
AllowUnusedKeywordArguments: true
Metrics/BlockLength:
Enabled: true
Exclude:
- db/migrate/*
- config/routes.rb
- spec/**/*
Metrics/CyclomaticComplexity:
Enabled: false
Exclude:
- db/migrate/*
Metrics/MethodLength:
Max: 20
Exclude:
- db/migrate/*
Metrics/AbcSize:
Max: 30
Exclude:
- db/migrate/*
Metrics/PerceivedComplexity:
Max: 10
Exclude:
- db/migrate/*
Metrics/ModuleLength:
Exclude:
- spec/**/*
Metrics/ParameterLists:
CountKeywordArgs: false
Naming/MethodParameterName:
AllowedNames:
- _
- a
- b
- i
- n
- k
- v
- x
- y
- id
- op
- to
- tz
Style/AsciiComments:
Enabled: false
Style/CommentAnnotation:
Keywords: # Only care about these, the other defaults like "NOTE" are annoying.
- "TODO"
Style/Documentation:
Exclude:
- "app/controllers/**/*"
- "app/decorators/**/*"
- "app/serializers/**/*"
- db/migrate/*
Style/EmptyMethod:
EnforcedStyle: expanded
Style/MethodCallWithArgsParentheses:
Enabled: true
IgnoredMethods:
- to
- not_to
- require
- raise
- puts
- validates # Sometimes this is called in a with_options block, confusing the cop.
- class_eval
Exclude:
- Gemfile
- db/migrate/*
Style/NestedTernaryOperator:
Enabled: false
Style/StringLiterals:
EnforcedStyle: double_quotes
# Minor performance increase but doesn't work everywhere.
Style/HashEachMethods:
Enabled: false
Bundler:
Enabled: true
Rails:
Enabled: true
# Helpers are deprecated so this only ever fires for legacy code, which we don't want to spend time
# refactoring to get around this cop.
Rails/HelperInstanceVariable:
Enabled: false
Rails/Blank:
# This harms readability in many cases.
UnlessPresent: false
# This is annoying to do and doesn't really help in most cases.
Rails/BulkChangeTable:
Enabled: false
Rails/Output:
Enabled: true
Exclude:
- db/migrate/**/*
Rails/SkipsModelValidations:
Enabled: false
# This is generally bad advice, defaults are often set in code.
Rails/NotNullColumn:
Enabled: false
# This would be lovely but it breaks our custom ODK wrapper.
Rails/ContentTag:
Enabled: false
# This seems unnecessary to me and kind of ugly.
Rails/SquishedSQLHeredocs:
Enabled: false
# Important to see errors on save!
Rails/SaveBang:
Enabled: true