-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
114 lines (97 loc) · 3.01 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
# Rules defined there are of course debatable.
# If you want to modify them:
# - discuss this with sre-core members
# - submit the change in the code_generator
AllCops:
TargetRubyVersion: 2.3
# This requires to alphabetically sort Gem's requirements
Bundler/OrderedGems:
Enabled: false
# This requires to add a comment inside nearly all file which could be
# considered as toil without value
Style/FrozenStringLiteralComment:
Enabled: false
### Disable line length constraint
Metrics/LineLength:
Max: 180
# Because we're not in the 80s anymore.
# Based on data from http://sideeffect.kr/popularconvention#ruby
#
### Comma after each line in a list
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
# It is very common to add key/value pairs to hashes in Chef attributes. Making
# sure each line has a comma diminishes the chance of someone making an error
# when adding a new pair. It also makes the code look more consistent. There is
# also a good explanation on why this is enabled by default in Puppet
# (see: http://www.puppetcookbook.com/posts/trailing-commas.html).
#
# Instead of writing:
# default['cookbook']['attribute'] = {
# a: 'a',
# b: 'b'
# }
# you should write:
# default['cookbook']['attribute'] = {
# a: 'a',
# b: 'b',
# }
#
### Align hashes as a table
Layout/AlignHash:
EnforcedColonStyle: table
EnforcedHashRocketStyle: key
# When dealing with long key names, it is easier to read hashes in colon
# notation aligned as tables. However, the same does not seem to hold true
# for hashes in rocket notation due to strange alignment rules.
#
# Instead of writing:
# default['cookbook']['attribute'] = {
# a: 'a',
# bb: 'b',
# ccc: 'c',
# }
# you should write:
# default['cookbook']['attribute'] = {
# a: 'a',
# bb: 'b',
# ccc: 'c',
# }
#
Metrics/ModuleLength:
Max: 200
# In general, developers should follow the single responsibility principle, but
# the bbatsov guide's 10-line limit seems rather arbitrary.
# Based on: https://www.mediawiki.org/wiki/Manual:Coding_conventions/Ruby
Metrics/MethodLength:
Max: 40
# This rule generates many false positive
Style/VariableNumber:
Enabled: false
# This metric is hard to grasp but let's avoid delirious code
Metrics/AbcSize:
Max: 60
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: consistent_comma
Metrics/BlockLength:
Max: 70
Style/StringLiterals:
ConsistentQuotesInMultiline: true
Style/FormatString:
EnforcedStyle: percent
# Really practical. Use with moderation though for readability
Style/MultilineBlockChain:
Enabled: false
# We ain't serving subseconds requests. Forcing to use tr instead of gsub will
# be annoying without much value
Performance/StringReplacement:
Enabled: false
# We don't write documentation there at the moment
Style/Documentation:
Enabled: false
# Filename forces snake case for file names, we just want consistency for now
Style/FileName:
Enabled: false
# We don't want CRLF for ruby files, even on windows!
Layout/EndOfLine:
EnforcedStyle: lf