forked from rubocop/ruby-style-guide
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rubocop.yml
209 lines (185 loc) · 5.75 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
AllCops:
Exclude:
- bin/**/*
- config/deploy/*
- db/schema.rb
- node_modules/**/*
- vendor/**/*
- .git/**/*
- Rakefile
- db/migrate/*
- spec/spec_helper.rb
- spec/rails_helper.rb
StyleGuideBaseURL: https://github.com/Interfolio/ruby-style-guide
Rails:
Enabled: true
Layout/ClassStructure:
Enabled: false
Categories:
module_inclusion:
- extend
- include
- prepend
callbacks:
- before_validation
- after_validation
- before_save
- around_save
- before_create
- around_create
- after_create
- before_update
- around_update
- after_update
- after_save
- before_destroy
- around_destroy
- after_destroy
- after_commit
- after_rollback
- after_initialize
- after_find
mounted_uploaders:
- mount_uploader
attributes:
- attr_accessor
- attr_reader
- attr_writer
- serialize
associations:
- belongs_to
- has_one
- has_many
- has_and_belongs_to_many
- accepts_nested_attributes_for
validations:
- validation_flag
- validates
- validates_associated
- validates_with
- validates_each
delegations:
- delegate
scopes:
- scope
concerning_blocks:
- concerning
ExpectedOrder:
# - constants
- module_inclusion
- callbacks
- mounted_uploaders
- attributes
- associations
- validations
- delegations
- scopes
- public_class_methods
- initializer
- concerning_blocks
- public_methods
- predicates
- protected_methods
- private_methods
#################
# Overrides #
#################
# Enforce LF line endings
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_layout.md#layoutendofline
Layout/EndOfLine:
EnforcedStyle: lf
# Allow less whitespace in indentation
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_layout.md#layoutalignparameters
Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation
# Don't require empty lines between module and class lines
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_layout.md#layoutemptylinesaroundclassbody
Layout/EmptyLinesAroundClassBody:
EnforcedStyle: empty_lines_except_namespace
# Don't require empty lines between module and class lines
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_layout.md#layoutemptylinesaroundmodulebody
Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: empty_lines_except_namespace
Exclude:
- "lib/swagger_responses.rb"
# Allow multi-line methods to be indented instead of aligned
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_layout.md#layoutmultilinemethodcallindentation
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# This cop checks for ambiguous block association with method when param passed without parentheses
# However, the style of ambiguous block is standard in specs
# https://github.com/rubocop-hq/rubocop/issues/4222
Lint/AmbiguousBlockAssociation:
Exclude:
- "spec/**/*"
# Allows lengthy describes in specs
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_metrics.md#metricsblocklength
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
# Noise from longer lines
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_metrics.md#metricslinelength
Metrics/LineLength:
Max: 120
# Allow swagger response documentation blocks to be lengthy
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_metrics.md#metricsmethodlength
Metrics/MethodLength:
Exclude:
- "lib/swagger_responses.rb"
# Exclude deploy configurations from requiring snake_case filenames.
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_naming.md#namingfilename
Naming/FileName:
Exclude:
- 'config/deploy/*.rb'
# Allows the available environments to pass the Rails.env.{environment}? check
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsunknownenv
Rails/UnknownEnv:
Environments:
- production
- nonprod
- development
- test
- qa
- alpha
- sandbox
- beta
# Allows { { } } in specs
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#styleblockdelimiters
Style/BlockDelimiters:
Exclude:
- 'spec/**/*'
# Prefer compact style over exploded.
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#styleraiseargs
Style/RaiseArgs:
EnforcedStyle: compact
# Prefer double quotes.
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#stylestringliterals
Style/StringLiterals:
EnforcedStyle: double_quotes
# Prefer brackets to %i
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#stylesymbolarray
Style/SymbolArray:
EnforcedStyle: brackets
# Prefer brackets to %w
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#stylewordarray
Style/WordArray:
EnforcedStyle: brackets
#################
# Disabled cops #
#################
# Lean towards readable code over meaningless required code comments
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#styledocumentation
Style/Documentation:
Enabled: false
# Lean towards readable code over meaningless required code comments
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#styledocumentationmethod
Style/DocumentationMethod:
Enabled: false
# Quieting noise for now
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#stylefrozenstringliteralcomment
Style/FrozenStringLiteralComment:
Enabled: false
# Don't require 1000000 to be typed 1_000_000
# https://github.com/rubocop-hq/rubocop/blob/master/manual/cops_style.md#stylenumericliterals
Style/NumericLiterals:
Enabled: false