forked from openSUSE/osem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
195 lines (147 loc) · 4.41 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
195
# Inherit style from another configuration
inherit_from: .rubocop_todo.yml
# Apply rule to all cops
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/schema.rb'
- 'vendor/bundle/**/*'
- 'bundle/**/*'
- 'config/**/*'
- 'bin/*'
#################### Style ###############################
# Align the elements of a hash literal if they span more than one line
Style/AlignHash:
Enabled: true
# Align the parameters of a method call if they span more than one line
Style/AlignParameters:
Enabled: true
# Use && instead of and, use || instead of or
Style/AndOr:
Enabled: true
# Avoid redundunt curly braces when it is obvious that hash is used
Style/BracesAroundHashParameters:
Enabled: true
# Avoid the use of the case equality operator `===`
Style/CaseEquality:
Enabled: true
# Use nested module/class definitions instead of compact style
Style/ClassAndModuleChildren:
Enabled: true
# Checks the . position in multi-line method calls.
Style/DotPosition:
Enabled: true
# Checks for uses of double negation (!!) to convert something to a boolean value.
Style/DoubleNegation:
Enabled: true
# Use one empty line between method definitions
Style/EmptyLineBetweenDefs:
Enabled: true
# There should be only one empty line in designated place
Style/EmptyLines:
Enabled: true
# Keep a blank line before and after private.
Style/EmptyLinesAroundAccessModifier:
Enabled: true
# Use hash literal {} instead of Hash.new
Style/EmptyLiteral:
Enabled: true
# Prefer `each` over `for i`
Style/For:
Enabled: true
# Use the new Ruby 1.9 hash syntax
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19
# Checks for uses of if with negated condition. Use unless instead
Style/NegatedIf:
Enabled: true
# Do not compare with nil. Use .nil? instead
Style/NilComparison:
Enabled: true
# Checks for redundant uses of self.
Style/RedundantSelf:
Enabled: true
# Checks that operators have space around them, except for ** which should not have surrounding space.
Style/SpaceAroundOperators:
Enabled: true
# Use single quotes unless there's string interpolation
Style/StringLiterals:
Enabled: true
# This cop checks for tabs where spaces should be used.
Style/Tab:
Enabled: true
# Avoid trailing blank lines
Style/TrailingBlankLines:
Enabled: true
# Avoid trailing whitespace
Style/TrailingWhitespace:
Enabled: true
# This cop checks for numeric comparisons that can be replaced by a predicate method.
Style/ZeroLengthPredicate:
Enabled: true
#################### Metrics ###############################
# Avoid deep blocks nesting
Metrics/BlockNesting:
Max: 4
# Avoid writing classes that are more than 300 lines
Metrics/ClassLength:
Max: 300
Exclude:
- 'app/models/conference.rb'
Metrics/BlockLength:
Exclude:
- 'spec/models/conference_spec.rb'
#################### Lint ###############################
# Wrap your assignment in condition if you mean it, otherwise it is most likely equality check
Lint/AssignmentInCondition:
Enabled: true
# Align blocks of code properly
Lint/BlockAlignment:
Enabled: true
# Things deprecated in current ruby API
Lint/DeprecatedClassMethods:
Enabled: true
# Do not use literal in conditions. We have it enabled for now
Lint/LiteralInCondition:
Enabled: false
# Prefer `Kernel#loop -> break` over `begin -> while`
Lint/Loop:
Enabled: true
# Do not put space before arguments when they are in parentheses
Lint/ParenthesesAsGroupedExpression:
Enabled: true
# Do not rescue Exceptions class itself
Lint/RescueException:
Enabled: true
# Do not shadow local variables in blocks, choose other name
Lint/ShadowingOuterLocalVariable:
Enabled: true
# Use _ or variable_name to explicitly mark variable as unused
Lint/UnusedBlockArgument:
Enabled: true
# Use _ or _argument_name to explicitly mark argument as unused
Lint/UnusedMethodArgument:
Enabled: true
# Avoid useless assignment
Lint/UselessAssignment:
Enabled: true
# Do not use variables in void context
Lint/Void:
Enabled: true
# Do not use duplicated keys in hash literals.
Lint/DuplicatedKey:
Enabled: true
#################### Rails ###############################
# Enforce Rails specific style
Rails:
Enabled: true
# Avoid use of old-style attribute validation
Rails/Validation:
Enabled: true
#################### Performance ###############################
# Identifies places where gsub can be replaced by tr or delete.
Performance/StringReplacement:
Enabled: true