-
Notifications
You must be signed in to change notification settings - Fork 11
/
.rubocop.yml
184 lines (146 loc) · 5.17 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
#inherit_from: .rubocop_todo.yml
# check https://gist.github.com/jhass/a5ae80d87f18e53e7b56/84972ca6c0c5a59768ae07ee0a639d03cc72d375
Metrics/LineLength:
Max: 99
Enabled: false # as it complains about long comments too
Style/EmptyLinesAroundClassBody:
Enabled: false
Style/EmptyLinesAroundModuleBody:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/ExtraSpacing:
AllowForAlignment: true
Style/IndentationConsistency:
EnforcedStyle: rails
Style/AndOr:
Enabled: false # complains about "redirect_to ... and return" in Rails controllers
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
# The argument that fail should be used to abort the program is wrong too,
# there's Kernel#abort for that.
Style/SignalException:
EnforcedStyle: only_raise
Style/StringLiterals:
Enabled: false
# allow Rubymine "Continuation indent" of 4 characters:
Style/CaseIndentation:
IndentationWidth: 4
Style/FirstParameterIndentation:
IndentationWidth: 4
Style/IndentArray:
IndentationWidth: 4
Style/IndentAssignment:
IndentationWidth: 4
Style/IndentHash:
IndentationWidth: 4
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
IndentationWidth: 4
Style/MultilineOperationIndentation:
EnforcedStyle: indented
IndentationWidth: 4
# these are not continued (e.g. 'private'), so we keep them at 2 chars
Style/AccessModifierIndentation:
IndentationWidth: 2
Style/SpaceAroundOperators:
AllowForAlignment: true
# Most readable form.
Style/AlignHash:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
# Mixing the styles looks just silly.
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
# consider this to keep method parameters short
# No space makes the method definition shorter and differentiates
# from a regular assignment.
Style/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space
Rails:
Enabled: false
AllCops:
Include:
- '**/Rakefile'
Exclude:
- 'bin/**/*'
TargetRubyVersion:
2.2
# These are all the cops that are disabled in the default configuration.
Style/AutoResourceCleanup:
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
Enabled: true
Style/CollectionMethods:
Description: 'Preferred collection methods.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size'
Enabled: true
#Style/Encoding:
# Description: 'Use UTF-8 as the source file encoding.'
# StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#utf-8'
# Enabled: true
#Style/InlineComment:
# Description: 'Avoid inline comments.'
# Enabled: true
Style/FirstArrayElementLineBreak:
Description: >-
Checks for a line break before the first element in a
multi-line array.
Enabled: true
Style/FirstHashElementLineBreak:
Description: >-
Checks for a line break before the first element in a
multi-line hash.
Enabled: true
Style/FirstMethodArgumentLineBreak:
Description: >-
Checks for a line break before the first argument in a
multi-line method call.
Enabled: true
Style/FirstMethodParameterLineBreak:
Description: >-
Checks for a line break before the first parameter in a
multi-line method parameter definition.
Enabled: true
Style/MethodCalledOnDoEndBlock:
Description: 'Avoid chaining a method call on a do...end block.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
Enabled: true
Style/MissingElse:
Description: >-
Require if/case expressions to have an else branches.
If enabled, it is recommended that
Style/UnlessElse and Style/EmptyElse be enabled.
This will conflict with Style/EmptyElse if
Style/EmptyElse is configured to style "both"
Enabled: false
EnforcedStyle: both
SupportedStyles:
# if - warn when an if expression is missing an else branch
# case - warn when a case expression is missing an else branch
# both - warn when an if or case expression is missing an else branch
- if
- case
- both
#Style/MultilineAssignmentLayout:
# Description: 'Check for a newline after the assignment operator in multi-line assignments.'
# StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-conditional-assignment'
# Enabled: true
Style/MutableConstant:
Description: 'Do not assign mutable objects to constants.'
Enabled: true
Style/OptionHash:
Description: "Don't use option hashes when you can use keyword arguments."
Enabled: true
Style/Send:
Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#prefer-public-send'
Enabled: true
Style/StringMethods:
Description: 'Checks if configured preferred methods are used over non-preferred.'
Enabled: true
#Style/SymbolArray:
# Description: 'Use %i or %I for arrays of symbols.'
# StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-i'
# Enabled: true
Lint/LiteralInInterpolation:
Description: 'Avoid interpolating literals in strings'
AutoCorrect: true