-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path.rubocop.yml
More file actions
286 lines (219 loc) · 6.24 KB
/
.rubocop.yml
File metadata and controls
286 lines (219 loc) · 6.24 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# Most of the maintainers of this code are professional engineers,
# not professional Rubyists. The style guide for this project
# has been modified accordingly, with explanations given below.
# Where a Cop is not listed, it uses the Rubocop defaults.
AllCops:
TargetRubyVersion: 2.5
NewCops: enable
Exclude:
- 'doc/**/*'
- 'gemfiles/**/gems/**/*'
- 'measures/**/*'
- 'python/**/*'
- 'test/**/*'
- 'update_eplus_compare/**/*'
- 'weatherdata/**/*'
- 'model/refbuildingtests/measures/**/*'
- 'convert_ruby_to_python.rb'
# inherit_from:
# - http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
# That rubocop.yml has an outdated use of Metrics/LineLength instead of Layout/LineLength, so pulling its content here directly
# Define the error reporting for each category
Layout:
Severity: error
Lint:
Severity: error
Metrics:
Severity: error
Naming:
Severity: warning
Style:
Severity: error
# ==================== Linters ====================
Lint/AmbiguousOperator:
Enabled: true
# Allow empty when branches to give
# a space to clearly document the
# reason that nothing is happening.
Lint/EmptyWhen:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Enabled: true
Lint/RequireParentheses:
Enabled: true
Lint/UnreachableCode:
Enabled: false
# Allow variable initialization to indicate
# what variable is going to be set by the next
# block of code.
Lint/UselessAssignment:
Enabled: false
Lint/UnusedBlockArgument:
Description: 'Checks for unused block arguments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
Enabled: false
Lint/UnusedMethodArgument:
Description: 'Checks for unused method arguments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
Enabled: false
# ==================== Metrics ====================
#Metrics/AbcSize:
#Max: 50
#Severity: warning
Metrics/BlockNesting:
Max: 5
#Metrics/BlockLength:
#Max: 50
#Severity: warning
#Metrics/ClassLength:
#Max: 500
#CountComments: false
#Severity: warning
Metrics/CollectionLiteralLength:
Enabled: false
Metrics/CyclomaticComplexity:
Max: 60
Severity: warning
# Allow long lines to encourage sufficiently
# detailed user-facing log messages.
#Metrics/LineLength:
# Max: 1200
# Severity: warning
Metrics/MethodLength:
Max: 600
CountComments: false
Severity: warning
Metrics/ModuleLength:
Max: 500
CountComments: false
Severity: warning
# Longer parameter list limits for methods that
# add HVAC systems
Metrics/ParameterLists:
Max: 15
Severity: warning
Metrics/PerceivedComplexity:
Max: 60
Severity: warning
# ==================== Styles ====================
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false
Style/ClassVars:
Enabled: false
# Don't force an if to a case
Style/CaseLikeIf:
Enabled: false
# Allow this syntax -- do not autocorrect.
# a = if true
# 1
# else
# 2
# end
Style/ConditionalAssignment:
Enabled: false
# Documentation will be covered by YARD.
Style/Documentation:
Enabled: false
Style/EachWithObject:
Enabled: false
# Allow for i in 0..3 loops
Style/For:
Enabled: false
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Enabled: false
# Disabled because in most of this codebase,
# the current approach is more readable.
Style/GuardClause:
Enabled: true
# Allow duplication inside conditional branches to keep
# code that does certain tasks more consolidated.
Style/IdenticalConditionalBranches:
Enabled: false
# Allow this type of nesting for logic clarity.
Style/IfInsideElse:
Enabled: false
# Do not force people to use one-line if statements.
Style/IfUnlessModifier:
Enabled: false
# Allow multiple comparisons via || for clarity
Style/MultipleComparison:
Enabled: false
# Allow negatives
# https://rubocop.readthedocs.io/en/latest/cops_style/#stylenegatedif
Style/NegatedIf:
Enabled: false
# Do not force people to use Next.
Style/Next:
Enabled: false
# Do not convert 10000 to 10_000
Style/NumericLiterals:
Description: 'Add underscores to large numeric literals to improve readability.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
Enabled: false
Style/NumericPredicate:
Description: 'Do not force using .zero?'
Enabled: false
# encourage explicit returns for clarity
Style/RedundantReturn:
Description: 'Do not use return where it is not required.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
Enabled: false
# Do NOT enable this because it appears $? is different than $CHILD_STATUS.
Style/SpecialGlobalVars:
Enabled: false
# Do not use %w, %W, %i, etc
# Prefer [:a, :b, :c] over %i[a b c]
Style/SymbolArray:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-i'
EnforcedStyle: brackets
# Do not use %w, %W, %i, etc
# Prefer ['a', 'b', 'c'] over %w[a b c]
Style/WordArray:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
EnforcedStyle: brackets
# ==================== Naming ====================
# Intentionally allow set_foo because these methods do not
# take have cooresponding getters.
Naming/AccessorMethodName:
Enabled: true
# Allow variables like coeff_1 for legibility
Naming/VariableNumber:
Enabled: false
# ==================== Layout ====================
Layout/BlockAlignment:
Enabled: true
# Need to allow indented case statements
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
Layout/CaseIndentation:
Enabled: false
Layout/MultilineMethodCallIndentation:
EnforcedStyle: aligned
Enabled: true
# =============== OpenStudio Resources Specific ===========
# Allow long lines to encourage sufficiently
# detailed user-facing log messages.
Layout/LineLength:
Max: 1200
Severity: warning
Layout/TrailingWhitespace:
Enabled: true
# Do not enforce snake_case
Naming/VariableName:
Enabled: false
Naming/FileName:
Enabled: false
Naming/MethodName:
Enabled: false
Naming/MethodParameterName:
Enabled: false
# I like to use _var for an Optional thing
Lint/UnderscorePrefixedVariableName:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/AbcSize:
Enabled: false