-
Notifications
You must be signed in to change notification settings - Fork 11
/
.rubocop.yml
153 lines (117 loc) · 3.81 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
################################################################################
# Metrics
################################################################################
Metrics/LineLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
################################################################################
# Style
################################################################################
# Executables are conventionally named bin/foo-bar
Style/FileName:
Exclude:
- bin/**/*
# We don't (currently) document our code
Style/Documentation:
Enabled: false
# Always use double-quotes to keep things simple
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# Use a trailing comma to keep diffs clean when elements are inserted or removed
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
# We avoid GuardClause because it can result in "suprise return"
Style/GuardClause:
Enabled: false
# We avoid IfUnlessModifier because it can result in "suprise if"
Style/IfUnlessModifier:
Enabled: false
# We don't care about the fail/raise distinction
Style/SignalException:
EnforcedStyle: only_raise
Style/DotPosition:
EnforcedStyle: trailing
# Common globals we allow
Style/GlobalVars:
AllowedVariables:
- "$alt_mongo"
- "$statsd"
- "$mongo"
- "$rollout"
# Using english names requires loading an extra module, which is annoying, so
# we prefer the perl names for consistency.
Style/SpecialGlobalVars:
EnforcedStyle: use_perl_names
# We have common cases where has_ and have_ make sense
Style/PredicateName:
Enabled: true
NamePrefixBlacklist:
- is_
# We use %w[ ], not %w( ) because the former looks like an array
Style/PercentLiteralDelimiters:
PreferredDelimiters:
"%i": "[]"
"%I": "[]"
"%w": "[]"
"%W": "[]"
# Allow "trivial" accessors when defined as a predicate? method
Style/TrivialAccessors:
AllowPredicates: true
Style/Next:
Enabled: false
# We think it's OK to use the "extend self" module pattern
Style/ModuleFunction:
Enabled: false
# Disallow extra spacing for token alignment
Style/ExtraSpacing:
AllowForAlignment: false
# and/or in conditionals has no meaningful difference (only gotchas), so we
# disallow them there. When used for control flow, the difference in precedence
# can make for a less noisy expression, as in:
#
# x = find_x or raise XNotFound
#
Style/AndOr:
EnforcedStyle: conditionals
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
Style/MultilineOperationIndentation:
EnforcedStyle: indented
Style/AlignHash:
EnforcedLastArgumentHashStyle: ignore_implicit
# This has the behavior we want, but it has a bug in it which produces a lot of false positives
# https://github.com/bbatsov/rubocop/issues/3462
# MultilineMethodCallBraceLayout:
# EnforcedStyle: new_line
################################################################################
# Performance
################################################################################
Performance/RedundantMerge:
Enabled: false
################################################################################
# Rails - disable things because we're primarily non-rails
################################################################################
Rails/Delegate:
Enabled: false
Rails/TimeZone:
Enabled: false
################################################################################
# Specs - be more lenient on length checks and block styles
################################################################################
Metrics/ModuleLength:
Exclude:
- spec/**/*
Metrics/MethodLength:
Exclude:
- spec/**/*
Style/ClassAndModuleChildren:
Exclude:
- spec/**/*
Style/BlockDelimiters:
Exclude:
- spec/**/*