-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.rubocop.yml
More file actions
161 lines (139 loc) · 3.56 KB
/
.rubocop.yml
File metadata and controls
161 lines (139 loc) · 3.56 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
inherit_from:
- .rubocop_todo.yml
plugins:
- rubocop-capybara
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-rspec_rails
AllCops:
Exclude:
- bin/**/*
- node_modules/**/*
- tmp/**/*
- vendor/**/*
NewCops: enable
Layout/LeadingCommentSpace:
AllowRBSInlineAnnotation: true
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Rails:
Enabled: true
# We're not actually using Rails methods here.
Rails/InverseOf:
Enabled: false
Rails/HasManyOrHasOneDependent:
Enabled: false
Rails/FindBy:
Enabled: false
Rails/FindByOrAssignmentMemoization:
Enabled: true # Using JSON-API method; the interface is similar to Rails find_by, so this cop is still useful
Style/ClassAndModuleChildren:
Enabled: false
# Only use shorthand hash syntax when all keys match the variables for better readability
Style/HashSyntax:
EnforcedShorthandSyntax: consistent
# Filter out all the DSLs
Metrics/BlockLength:
CountAsOne:
- array
- hash
- heredoc
AllowedMethods:
- describe
- context
- background
- scenario
- namespace
- task
- included
- shared_context
- shared_examples
- state_machine
- configure
- draw
- feature
- subject
- let
- let!
- factory
- define
- guard
- transient
- it
Exclude:
- config/robots.rb
Metrics/ClassLength:
CountAsOne:
- array
- hash
- heredoc
Metrics/MethodLength:
CountAsOne:
- array
- hash
- heredoc
# There is so much existing inconsistent code that it is not worth enforcing this cop
Naming/PredicateMethod:
Enabled: false
Naming/VariableNumber:
CheckSymbols:
false # Rubocop gets annoyed about our states. I'm disabling globally
# as I'm honestly not that bothered.
RSpec/ContextWording:
Prefixes:
- by
- for
- from
- if
- in
- unless
- when
- where
- which
- with
- without
RSpec/DescribeClass:
# Exclude files like exports that do not have a specific class.
Exclude:
- spec/factory_outputs/**/*.rb
- spec/views/**/*exports/**/*.rb
RSpec/DescribedClass:
EnforcedStyle: described_class
SkipBlocks: true # Addresses a known caveat with rspec-rails’s ‘controller` helper that runs its
# block in a different context
RSpec/ExampleLength:
inherit_mode:
merge:
- Exclude
CountAsOne:
- array
- hash
- heredoc
- method_call
# Disable for features, as we might want to step through long processes
Exclude:
- 'spec/features/**/*'
RSpec/IndexedLet:
Enabled: false # We have a lot of indexed lets in our specs, mostly based on wells or racked tubes
RSpec/LetBeforeExamples:
Enabled: false # It can be helpful to have the let variables just before the relevant example
RSpec/ScatteredLet:
Enabled: false # Disabling due to scattered lets not being such a big deal and the automated fix
# being unreliable (see https://github.com/rubocop/rubocop-rspec/issues/1167).
RSpec/MultipleMemoizedHelpers:
Enabled: false # We have a lot of memoized helpers in our specs, not sure how best to work around this, so disabling
RSpec/NestedGroups:
Max: 5 # Default is 3, but we have a lot of nested groups in our specs
RSpec/NamedSubject:
EnforcedStyle: named_only
# This cop doesn't always increase clarity
Style/CollectionQuerying:
Enabled: false
# The single-line syntax can be clearer than the multi-line version for multiple definitions
Style/EmptyClassDefinition:
Enabled: false
Style/EmptyMethod:
EnforcedStyle: expanded