-
-
Notifications
You must be signed in to change notification settings - Fork 725
/
.rubocop_styleguide.yml
156 lines (128 loc) · 3 KB
/
.rubocop_styleguide.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
# Our Open Food Network style guide.
#
# These are the rules we agreed upon and we work towards.
AllCops:
NewCops: enable
Exclude:
- bin/**/*
- db/**/*
- config/**/*
- script/**/*
- vendor/**/*
- node_modules/**/*
# Excluding: inadequate Naming/FileName rule rejects GemFile name with camelcase
- engines/web/Gemfile
Bundler/DuplicatedGem:
Enabled: false
Layout/LineLength:
Enabled: true
Max: 100
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
# Don't think this is a big issue, mostly picking up RPSEC scope definitions
# with lamdas and RSpec '.to change{}' blocks
Lint/AmbiguousBlockAssociation:
Enabled: false
Lint/MissingSuper:
Exclude:
- app/components/**/*
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
# Heaps of offences (> 100) in specs, mostly in situations where two or more
# instances of a model are required, but only one is referenced. Difficult to
# fix without making the spec look messy or rewriting it.
# Should definitely fix at some point.
Lint/UselessAssignment:
Exclude:
- spec/**/*
Metrics:
Enabled: true
Metrics/AbcSize:
Max: 30 # default 17
Metrics/BlockLength:
AllowedMethods: [
"class_eval",
"collection",
"configure",
"context",
"delete",
"describe",
"feature",
"get",
"it",
"member",
"namespace",
"path",
"post",
"put",
"resource",
"resources",
"response",
"scenario",
"shared_examples",
"shared_examples_for",
"xdescribe",
]
Metrics/MethodLength:
Enabled: true
Max: 25 # default 10
Metrics/ParameterLists:
CountKeywordArgs: false
Metrics/PerceivedComplexity:
Enabled: true
Max: 14 # default 8
Naming/PredicateName:
Enabled: false
Naming/VariableNumber:
AllowedIdentifiers:
- street_address_1
- street_address_2
AllowedPatterns:
- _v[\d]+
Rails/ApplicationRecord:
Exclude:
# Migrations should not contain application code:
- db/migrate/*.rb
# Allow many-to-many associations without explicit model.
# - It avoids the additional code of a model class.
# - It simplifies the declaration of the association.
# - Rails may know that there are no callbacks associated.
Rails/HasAndBelongsToMany:
Enabled: false
Rails/OutputSafety:
Exclude:
- spec/**/*
Rails/RedundantActiveRecordAllMethod:
AllowedReceivers:
- ActionMailer::Preview
- ActiveSupport::TimeZone
Rails/SkipsModelValidations:
AllowedMethods:
- touch
- touch_all
- update_all
- update_attribute
- update_column
- update_columns
Rails/UnknownEnv:
Environments:
- development
- production
- staging
- test
Rails/WhereExists:
EnforcedStyle: where # Cf. conversion https://github.com/openfoodfoundation/openfoodnetwork/pull/12363
Style/Documentation:
Enabled: false
Style/FormatStringToken:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys
Style/Send:
Enabled: true
Style/StringLiterals:
Enabled: false