-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path.rubocop.yml
132 lines (114 loc) · 3.21 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
---
Layout/LineLength:
Max: 120
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: true
# https://stackoverflow.com/questions/40934345/rubocop-25-line-block-size-and-rspec-tests
Metrics/BlockLength:
# Exclude DSLs
Exclude:
- 'Rakefile'
- '*.gemspec'
- '**/*.rake'
- 'spec/**/*.rb'
- 'feature/**/*.rb'
# I use keyword arguments for a poor man's dependency injection to cut
# down on the magic in my tests.
Metrics/ParameterLists:
CountKeywordArgs: false
Naming/HeredocDelimiterNaming:
Enabled: false
Naming/MethodParameterName:
Enabled: true
AllowedNames:
# I don't think things on this list are a terribly hard convention
# for folks to learn. bbatsov also doesn't care much for this
# check:
#
# https://github.com/rubocop-hq/rubocop/issues/3666
- e # exception
- x # cartesian coordinates
- y # cartesian coordinates
# by default (EnforcedStyle=NormalCase) this rule doesn't like
# things like check_1, check_2, etc and wants check1, check2, etc. I
# like the former.
#
# https://docs.rubocop.org/rubocop/cops_naming.html#namingvariablenumber
Naming/VariableNumber:
Enabled: true
EnforcedStyle: snake_case
# http://www.betterspecs.org/#single
#
# > in tests that are not isolated (e.g. ones that integrate with a
# > DB, an external webservice, or end-to-end-tests), you take a
# > massive performance hit to do the same setup over and over again,
# > just to set a different expectation in each test. In these sorts
# > of slower tests, I think it's fine to specify more than one
# > isolated behavior.
RSpec/MultipleExpectations:
Exclude:
- 'feature/**/*.rb'
# Bump this up a bit for now. I find useful, readable specs at level
# 4, for now at least.
#
# The logic here makes sense to me:
# https://github.com/datarockets/ruby-style/issues/36
RSpec/NestedGroups:
Max: 4
# Likewise
RSpec/MultipleMemoizedHelpers:
Max: 8
# Ensure we reference constants on classes in instance_double() so
# that a renamed class is caught and doubles are always actually
# verified.
RSpec/VerifiedDoubleReference:
Enabled: true
EnforcedStyle: constant
#
# Add 'XX X' to the standard list
#
Style/CommentAnnotation:
Keywords:
- "TOD\
O"
- "FIXM\
E"
- "OPTIMIZ\
E"
- "HAC\
K"
- "REVIE\
W"
- "XX\
X"
Style/StringLiterals:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
ConsistentQuotesInMultiline: true
# I like trailing commas in arrays and hashes. They let me insert new
# elements and see them as one line in a diff, not two.
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
# If I'm using one function name and returning the contents of an
# attribute, that's OK. The alternative would be this, which I find
# confusing and often not really what I mean:
#
# attr_reader :something_else
# alias_method :something, :something_else
Style/TrivialAccessors:
ExactNameMatch: true
AllCops:
NewCops: enable
TargetRubyVersion: 2.7
Exclude:
- 'bin/*'
- 'vendor/**/*'
require:
- rubocop-rake
- rubocop-rspec