This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
211 lines (167 loc) · 5.24 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# make our hashes consistent
Layout/AlignHash:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
# `system` is a special case and aligns on second argument
Layout/AlignParameters:
Enabled: false
# favour parens-less DSL-style arguments
Lint/AmbiguousOperator:
Enabled: false
# this is a bit less "floaty"
Layout/CaseIndentation:
EnforcedStyle: end
# this is a bit less "floaty"
Layout/EndAlignment:
EnforcedStyleAlignWith: start_of_line
# conflicts with DSL-style path concatenation with `/`
Layout/SpaceAroundOperators:
Enabled: false
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
Layout/EmptyLineAfterGuardClause:
Enabled: false
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6258)
# and layout is not configurable (https://github.com/rubocop-hq/rubocop/issues/6254).
Layout/RescueEnsureAlignment:
Enabled: false
# favour parens-less DSL-style arguments
Lint/AmbiguousBlockAssociation:
Enabled: false
# so many of these in formulae and can't be autocorrected
# TODO: fix these as `ruby -w` complains about them.
Lint/AmbiguousRegexpLiteral:
Enabled: false
# assignment in conditions are useful sometimes
# TODO: add parentheses for these and remove
Lint/AssignmentInCondition:
Enabled: false
# we output how to use interpolated strings too often
Lint/InterpolationCheck:
Enabled: false
# so many of these in formulae and can't be autocorrected
Lint/ParenthesesAsGroupedExpression:
Enabled: false
# most metrics don't make sense to apply for formulae/taps
Metrics/AbcSize:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
# Metrics/ModuleLength:
# Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
Metrics/LineLength:
Max: 170
# ignore manpage comments and long single-line strings
IgnoredPatterns: ["#: ", ' url "', ' mirror "', " plist_options :"]
# our current conditional style is established
# TODO: enable this when possible
Style/ConditionalAssignment:
Enabled: false
# most of our APIs are internal so don't require docs
Style/Documentation:
Enabled: false
# we want to add this slowly and manually
# TODO: add to more files
Style/FrozenStringLiteralComment:
Enabled: false
# so many of these in formulae and can't be autocorrected
Style/GuardClause:
Enabled: false
# depends_on a: :b looks weird in formulae.
Style/HashSyntax:
EnforcedStyle: hash_rockets
# ruby style guide favorite
Style/StringLiterals:
EnforcedStyle: double_quotes
# consistency with above
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# make things a bit easier to read
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex
# messes with existing plist/caveats style
Style/TrailingBodyOnMethodDefinition:
Enabled: false
# a bit confusing to non-Rubyists but useful for longer arrays
Style/WordArray:
MinSize: 4
# Use `<<~` for heredocs.
Layout/IndentHeredoc:
EnforcedStyle: squiggly
# Not useful in casks and formulae.
Metrics/BlockLength:
Enabled: false
# Keyword arguments don't have the same readability
# problems as normal parameters.
Metrics/ParameterLists:
CountKeywordArgs: false
# Implicitly allow EOS as we use it everywhere.
Naming/HeredocDelimiterNaming:
Blacklist:
- END, EOD, EOF
# Allow dashes in filenames.
Naming/FileName:
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
# Both styles are used depending on context,
# e.g. `sha256` and `something_countable_1`.
Naming/VariableNumber:
Enabled: false
# Avoid leaking resources.
Style/AutoResourceCleanup:
Enabled: true
# This makes these a little more obvious.
Style/BarePercentLiterals:
EnforcedStyle: percent_q
# Use consistent style for better readability.
Style/CollectionMethods:
Enabled: true
# Prefer simple tokens without type annotations.
Style/FormatStringToken:
EnforcedStyle: template
# This often leads to lines longer than the maximum line length.
# https://github.com/rubocop-hq/rubocop/issues/6149
Style/IfUnlessModifier:
Enabled: false
# Only use this for numbers >= `1_000_000`.
Style/NumericLiterals:
MinDigits: 7
Strict: true
# Zero-prefixed octal literals are widely used and understood.
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
# Rescuing `StandardError` is an understood default.
Style/RescueStandardError:
EnforcedStyle: implicit
# Returning `nil` is unnecessary.
Style/ReturnNil:
Enabled: true
# We have no use for using `warn` because we
# are calling Ruby with warnings disabled.
Style/StderrPuts:
Enabled: false
# Use consistent method names.
Style/StringMethods:
Enabled: true
# An array of symbols is more readable than a symbol array
# and also allows for easier grepping.
Style/SymbolArray:
EnforcedStyle: brackets
# Trailing commas make diffs nicer.
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
# Does not hinder readability, so might as well enable it.
Performance/CaseWhenSplat:
Enabled: true
# Makes code less readable for minor performance increases.
Performance/Caller:
Enabled: false