-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
169 lines (156 loc) · 3.44 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
inherit_gem:
rubocop-rails-omakase: rubocop.yml
rswag-specs: .rubocop_rspec_alias_config.yml
# Customizations
require:
- rubocop-rake
- rubocop-rspec
- rubocop-rspec_rails
- rubocop-factory_bot
- rubocop-thread_safety
- rubocop-ordered_methods
- rubocop-capybara
AllCops:
SuggestExtensions: true
NewCops: enable
TargetRubyVersion: 3.2
ExtraDetails: true
Exclude:
- 'db/schema.rb'
- 'app/components/railsboot/**/*'
# Bundler
Bundler/OrderedGems:
Enabled: true
Bundler/GemComment:
Enabled: true
OnlyFor: [ "github", "restrictive_version_specifiers", "source", "gist", "git" ]
Bundler/InsecureProtocolSource:
Enabled: true
# FactoryBot
FactoryBot:
Enabled: true
# Layout
Layout/ClassStructure:
Enabled: true
Categories:
association:
- has_many
- has_one
attribute_macros:
- attr_accessor
- attr_reader
- attr_writer
macros:
- validates
- validate
module_inclusion:
- include
- prepend
- extend
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: true
EnforcedStyle: no_space
EnforcedStyleForEmptyBrackets: no_space
# Lint
Lint/SymbolConversion:
Enabled: true
Lint/RedundantCopDisableDirective:
Enabled: true
# Metrics Cops
Metrics/ClassLength:
Enabled: false
Metrics/ModuleLength:
Description: "Avoid modules longer than 100 lines of code."
Max: 100
Enabled: true
Metrics/ParameterLists:
Description: "Pass no more than four parameters into a method."
Max: 4
Enabled: true
# Naming
Naming/BlockForwarding:
Enabled: true
# Ordered Methods
Layout/OrderedMethods:
EnforcedStyle: alphabetical
IgnoredMethods:
- initialize
- index
- show
- new
- edit
- create
- update
- destroy
Layout/MultilineMethodCallBraceLayout:
Enabled: true
EnforcedStyle: symmetrical
#Layout/LineLength:
# Enabled: true
# Max: 120
Layout/HashAlignment:
Enabled: true
EnforcedColonStyle: key
Layout/ArrayAlignment:
Enabled: true
EnforcedStyle: with_fixed_indentation
# Rails
Rails:
Enabled: true
Rails/HasAndBelongsToMany:
Enabled: false
Rails/I18nLocaleTexts: # At some point, we should enable this cop
Enabled: false
Rails/ReversibleMigration: # I don't see a circumstance where we'd want to require reversible migrations
Enabled: false
Rails/SkipsModelValidations:
Enabled: true
Exclude:
- 'db/migrate/*active_storage*.rb' # Rails 7.2 built-in migrations use update_all, which is not reversible
# RSpec
RSpec:
Enabled: true
RSpec/MultipleMemoizedHelpers:
Enabled: false
RSpec/NestedGroups:
Enabled: false # This cop causes issues with RSwag
RSpec/ExampleLength:
Max: 20
Enabled: true
RSpec/MultipleExpectations:
Max: 5 # The default is 1, but we're a bit more lenient due to the nature of RSwag requests
Enabled: true
RSpec/MetadataStyle:
Enabled: false
# Security
Security/IoMethods:
Enabled: true
# Style
Style/FrozenStringLiteralComment:
Enabled: true
Style/SignalException:
Enabled: true
Style/NumericPredicate:
Enabled: true
Style/SymbolArray:
Enabled: true
Style/Lambda:
Enabled: true
Style/RedundantConstantBase:
Enabled: true
Style/GuardClause:
Enabled: true
# Performance
Performance/AncestorsInclude:
Enabled: true
Performance/ArraySemiInfiniteRangeSlice:
Enabled: true
Performance/BigDecimalWithNumericArgument:
Enabled: true
Performance/CaseWhenSplat:
Enabled: true
Performance/CollectionLiteralInLoop:
Enabled: true
MinSize: 3
Performance/IoReadlines:
Enabled: true