-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
195 lines (164 loc) · 4.35 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
## Rubocop configuration file
require: rubocop-rspec
RSpec/DescribeClass:
Enabled: false
RSpec/FilePath:
Enabled: false
# Common configuration.
AllCops:
TargetRubyVersion: 2.4
# Include common Ruby source files.
Include:
- '**/*.gemspec'
- '**/*.rake'
- '**/Gemfile'
- '**/Rakefile'
Exclude:
- '.rubocop.yml'
# Cop names are not displayed in offense messages by default. Change behavior
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
# option.
DisplayCopNames: false
# Style guide URLs are not displayed in offense messages by default. Change
# behavior by overriding DisplayStyleGuide, or by giving the
# -S/--display-style-guide option.
DisplayStyleGuide: false
# Additional cops that do not reference a style guide rule may be enabled by
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
# the --only-guide-cops option.
StyleGuideCopsOnly: false
Documentation:
Enabled: false
##################### Metrics ##################################
Metrics/AbcSize:
Severity: warning
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
# a Float.
Max: 25
Metrics/BlockNesting:
Max: 3
Metrics/ClassLength:
CountComments: false
Max: 100
Metrics/ModuleLength:
CountComments: false
Max: 100
Metrics/CyclomaticComplexity:
Max: 6
Metrics/LineLength:
Max: 120
# To make it possible to copy or click on URIs in the code, we allow lines
# contaning a URI to be longer than Max.
AllowURI: true
URISchemes:
- http
- https
Metrics/MethodLength:
Severity: warning
CountComments: false
Max: 20
Metrics/ParameterLists:
Max: 3
CountKeywordArgs: true
Metrics/PerceivedComplexity:
Max: 6
##################### Style ##################################
Style/ClassAndModuleChildren:
Enabled: false
# Checks the style of children definitions at classes and modules.
#
# Basically there are two different styles:
#
# `nested` - have each child on a separate line
# class Foo
# class Bar
# end
# end
#
# `compact` - combine definitions as much as possible
# class Foo::Bar
# end
#
# The compact style is only forced, for classes / modules with one child.
EnforcedStyle: compact
SupportedStyles:
- nested
- compact
Style/PredicateName:
Description: Check the names of predicate methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
Enabled: true
NamePrefix:
- is_
- has_
- have_
NamePrefixBlacklist:
- is_
Exclude:
- spec/**/*
Style/StringLiterals:
Description: Checks if uses of quotes match the configured preference.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
Enabled: true
EnforcedStyle: double_quotes
SupportedStyles:
- single_quotes
- double_quotes
Style/StringLiteralsInInterpolation:
Description: Checks if uses of quotes inside expressions in interpolated strings match the configured preference.
Enabled: true
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
Style/ClassCheck:
EnforcedStyle: is_a?
SupportedStyles:
- is_a?
- kind_of?
# Align with the style guide.
Style/CollectionMethods:
# Mapping from undesired method to desired_method
# e.g. to use `detect` over `find`:
#
# CollectionMethods:
# PreferredMethods:
# find: detect
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
find: 'detect'
find_all: 'select'
reduce: 'inject'
# Checks formatting of special comments
Style/CommentAnnotation:
Keywords:
- TODO
- FIXME
- OPTIMIZE
- HACK
- REVIEW
###################### Layout ##################################
# Multi-line method chaining should be done with leading dots.
Layout/DotPosition:
EnforcedStyle: leading
SupportedStyles:
- leading
- trailing
Layout/MultilineOperationIndentation:
Description: Checks indentation of binary operations that span multiple lines.
Enabled: true
EnforcedStyle: indented
###################### Lint ##################################
Lint/EndAlignment:
EnforcedStyleAlignWith: variable
##################### RSpec ##################################
RSpec/NestedGroups:
Enabled: false
Metrics/ModuleLength:
Exclude:
- "**/*_spec.rb"
Metrics/BlockLength:
Exclude:
- "**/*_spec.rb"