-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.rubocop.yml
172 lines (171 loc) · 3.73 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
---
require:
- rubocop-rspec
- rubocop-rails
- rubocop-factory_bot
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
Include:
- "**/Rakefile"
- "**/config.ru"
- "**/*.rb"
Exclude:
- "bin/**/*"
TargetRubyVersion: 3.2.2
NewCops: enable
# Bug in rubocop-rspec config merge: https://github.com/rubocop/rubocop-rspec/pull/1163
# https://github.com/rubocop/rubocop-rspec/blob/master/config/default.yml
RSpec:
Language:
ExampleGroups:
Regular:
# rswag example group aliases
- path
# our multistep test module
- stepwise
# our permissions helpers
- ensures
- the_users
- the_user
Examples:
Regular:
# custom dsl for permissions tests
- the_users
- the_user
- ensures
# our multistep test module
- step
# rswag 'examples'
- get
- push
- post
- delete
Expectations:
# rswag test helper that runs expect
- run_test!
- run_test
# Customized options
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Layout/LineLength:
Max: 120
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/EndOfLine:
EnforcedStyle: lf
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# We sometimes leave commented out code in the code base
Layout/LeadingCommentSpace:
Enabled: false
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
Metrics/ClassLength:
Max: 300
Metrics/CyclomaticComplexity:
Max: 10
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Metrics/BlockLength:
AllowedMethods:
- resource
- describe
- example_group
- shared_examples_for
- shared_examples
- shared_context
- context
- it
- group
- namespace
- task
- draw
- setup
- configure
- draw
- define
- factory
- path
- Async
- aasm
- stepwise
- included
- class_eval
Metrics/MethodLength:
Max: 30
AllowedMethods:
- filter_settings
Metrics/ModuleLength:
Max: 150
Metrics/AbcSize:
Max: 60
Rails/Output:
Exclude:
# the rails logger isn't available when patches are running
- '**/patches/**'
# https://github.com/rubocop/rubocop-rspec/issues/795
RSpec/DescribedClass:
EnforcedStyle: explicit
RSpec/ExampleLength:
Max: 200
RSpec/ExpectInHook:
# https://github.com/rubocop/rubocop-rspec/pull/445
Enabled: false
RSpec/ImplicitSubject:
EnforcedStyle: single_statement_only
RSpec/MultipleExpectations:
Max: 6
RSpec/NestedGroups:
Max: 4
RSpec/MultipleMemoizedHelpers:
Max: 10
RSpec/VariableName:
AllowedPatterns:
# Variable named after http header required by rswag
- ^Authorization$
RSpec/NamedSubject:
# referring to subject explicitly is referring to a named variable - named subject
# I disagree with this style rule.
Enabled: false
Style/AsciiComments:
# emoji are useful
Enabled: false
Style/BlockDelimiters:
EnforcedStyle: semantic
AllowBracesOnProceduralOneLiners: true
AllowedMethods:
- its
- it
Style/ExponentialNotation:
Enabled: true
EnforcedStyle: scientific
Style/HashEachMethods:
Enabled: true
AutoCorrect: false
Style/HashTransformKeys:
Enabled: true
AutoCorrect: false
Style/HashTransformValues:
Enabled: true
AutoCorrect: false
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Style/SymbolArray:
EnforcedStyle: brackets
Style/WordArray:
EnforcedStyle: brackets