-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
177 lines (125 loc) · 3.21 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
require:
- rubocop-rails
- rubocop-rspec
- rubocop-capybara
- rubocop-performance
AllCops:
Exclude:
- db/schema.rb
- 'node_modules/**/*'
- 'vendor/**/*'
- bin/*
- tmp/**/*
NewCops: enable
SuggestExtensions: false
Bundler/OrderedGems:
Enabled: false # allow grouping gems of related functionality
Layout/EmptyLinesAroundClassBody:
Enabled: false
Layout/FirstArrayElementIndentation: # results in overly long lines
EnforcedStyle: consistent
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: false
# Metrics
Metrics/AbcSize:
Max: 20
Metrics/BlockLength:
Max: 30
Exclude:
- '**/*.gemspec'
- 'spec/**/*'
Metrics/MethodLength:
Max: 15
CountAsOne: ['array', 'heredoc', 'method_call', 'hash']
Naming/BlockForwarding:
Enabled: false # no performance or readability improvement from this rule
# Rails
Rails/FilePath:
Enabled: false # does not improve readability
Rails/MatchRoute:
Enabled: false # does not improve readability
Rails/NegateInclude:
Enabled: false
Rails/Pluck:
Enabled: true
Rails/PluckInWhere:
Enabled: true
Rails/RakeEnvironment:
Enabled: false
Rails/ReadWriteAttribute:
Enabled: false # too many issues: https://github.com/rubocop/rails-style-guide/issues/155
Rails/ShortI18n:
Enabled: false # allow more descriptive syntax when helpful
# RSpec
RSpec/BeNil: # both read equally well
Enabled: false
RSpec/Capybara/FeatureMethods:
Enabled: true
RSpec/ContextWording:
Prefixes:
- when
- with
- without
- if
- unless
- for
- after
- before
- and
- but
RSpec/ExampleLength:
Enabled: false
RSpec/ExpectChange:
Enabled: false
RSpec/HookArgument:
Enabled: false
RSpec/ImplicitExpect: # this 'should' form does not rely on monkeypatching
Enabled: false
# For unit tests only. For large functional or integration tests where setup time is costly, disable this rule.
RSpec/MultipleExpectations:
Max: 3
Exclude:
- 'spec/features/**/*'
RSpec/MultipleMemoizedHelpers:
Enabled: false
RSpec/NotToNot:
Enabled: false
RSpec/NestedGroups:
Max: 6
RSpec/Rails/InferredSpecType:
Enabled: false
# Style
Style/AutoResourceCleanup:
Enabled: true
Style/BlockDelimiters:
EnforcedStyle: braces_for_chaining
Style/Documentation: # MVC & Rails conventions are sufficient documentation for these classes
Exclude:
- app/mailers/**/*
- app/models/**/*
- app/controllers/**/*
- app/helpers/**/*
- config/**/*
- db/**/*
Style/EmptyMethod:
Enabled: false
Style/HashSyntax:
EnforcedShorthandSyntax: either
Style/PreferredHashMethods:
Enabled: false
Style/PercentQLiterals:
Enabled: false # undetectable performance difference, at the cost of decreased understanding
Style/StringLiterals:
Enabled: false # no performance difference these days, only preference and frustration
Style/SymbolArray:
Enabled: false # reduces readability especially for those who've spent less time in ruby
Style/WordArray:
Enabled: true
MinSize: 6 # the traditional [""] is easier to understand, but there is a typing improvement with large sets
inherit_from:
- .rubocop.local_customs.yml
inherit_mode:
merge:
- Exclude