-
Notifications
You must be signed in to change notification settings - Fork 2
/
.rubocop.yml
156 lines (141 loc) · 2.98 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
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
AllCops:
NewCops: enable
# Align "end" with variable.
#
# # Bad
# variable = if thing
# end
#
# # Good
# variable = if thing
# end
#
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
# Indent parameters with two spaces only.
#
# # Bad
# call_this_long_method(
# with_inner_call(
# my_parameters
# )
# )
#
# # Good
# call_this_long_method(with_inner_call(
# my_parameters
# ))
#
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
# Indent array values with two spaces only.
#
# # Bad
# my_array = [ 1,
# 2,
# 3 ]
# # Good
# my_array = [
# 1,
# 2,
# 3
# ]
#
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
# Indent hash keys with two spaces only.
#
# # Bad
# my_hash = { "one" => 1,
# "two" => 2,
# "three" => 3 }
#
# # Good
# my_hash = {
# "one" => 1,
# "two" => 2,
# "three" => 3
# }
#
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# Max line length is 100 characters. The RuboCop default is 120; the Ruby Style Guide makes a good
# argument (https://rubystyle.guide/#max-line-length) for keeping this at 80, but to do so is a
# little limiting when there are multiple nested modules. We compromise at 100.
Layout/LineLength:
Max: 100
IgnoredPatterns:
- '(context|context|it|shared_examples_for)'
# Multi-line method calls are indented by two spaces only.
#
# # Bad
# MyClass.where(thing: true, another: 'yes')
# .order(:created_at)
# .limit(5)
#
# # Good
# MyClass.where(thing: true, another: 'yes')
# .order(:created_at).limit(5)
#
# # Good
# MyClass.where(thing: true, another: 'yes')
# .order(:created_at)
# .limit(5)
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
# Multi-line parameters should be indented by two spaces only.
#
# # Bad
# call_something(param_one,
# param_two,
# param_three)
#
# # Good
# call_something(
# param_one, param_two, param_three
# )
#
# # Acceptable, but not as readable
# call_something(param_one
# param_two, param_three)
#
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
# Prefer alias_method over alias
Style/Alias:
EnforcedStyle: prefer_alias_method
# Only suggest guard clauses when a block is three or more lines long.
Style/GuardClause:
MinBodyLength: 3 # Default is 1.
Style/MethodCallWithArgsParentheses:
Enabled: true
IgnoreMacros: true
IgnoredMethods:
- describe
- head
- not_to
- puts
- raise
- render
- require
- require_dependency
- require_relative
- shared_examples_for
- to
- yield
Exclude:
- Gemfile
Metrics:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/NamedSubject:
Enabled: false