-
Notifications
You must be signed in to change notification settings - Fork 8
/
.rubocop-https---bitbucket-org-rabidtech-rabid-dotfiles-raw-master--rubocop-yml
174 lines (150 loc) · 4.84 KB
/
.rubocop-https---bitbucket-org-rabidtech-rabid-dotfiles-raw-master--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
---
# Built-in config:
# https://github.com/bbatsov/rubocop/blob/master/config/default.yml
# We do not typically use/need class documentation
Documentation:
Enabled: false
# Run rails specific checks
# https://github.com/bbatsov/rubocop#rails
Rails:
Enabled: true
AllCops:
Include:
# Include important files that don't end in .rb
- "**/Rakefile"
- "**/config.ru"
- "**/Gemfile"
- "**/gems.rb"
Exclude:
# exclude files in /vendor because some CI systems put gems in here e.g.
# TravisCI
- "vendor/**/*"
# exclude the autogenerated schema file as we don't have any control over
# its format
- "db/schema.rb"
- "bin/**/*"
- "doc/**/*"
- "node_modules/**/*"
Metrics/LineLength:
Max: 120
Metrics/ModuleLength:
Exclude:
- "spec/**/*_spec.rb"
Metrics/BlockLength:
Exclude:
- "spec/**/*.rb"
- "config/routes.rb"
# We do not typically use/need class documentation
Documentation:
Enabled: false
# We generally don't want methods longer than 15 lines, except in migrations where it's probably okay.
Metrics/MethodLength:
Max: 15
Exclude:
- "db/migrate/**/*.rb"
# Rubocop doesn't like methods that start with `get_` or `set_`, however sometimes this is unavoidable
# when writing pundit policies (especially where jsonapi-resources is involved).
Naming/AccessorMethodName:
Exclude:
- "app/policies/**/*_policy.rb"
# Rubocop doesn't like using `post("/", {}, {})` and instead wants to use the keyword variant of these
# methods, but often brevity is more important than readability in specs.
Rails/HttpPositionalArguments:
Exclude:
- "spec/requests/**/*_spec.rb"
# Rubocop doesn't want us to use any methods which bypass validation in ActiveRecord, but it's quite
# reasonable to want to do this in a migration.
Rails/SkipsModelValidations:
Exclude:
- "db/migrate/**/*.rb"
# This cop complains when you have variables named things like:
# address_line_1
# address_line_2
# etc.
Naming/VariableNumber:
Enabled: false
# We prefer that you use `fail` unless you're explicitly re-raising an exception.
Style/SignalException:
EnforcedStyle: semantic
# We think that:
# {
# foo: :bar
# baz: :bip
# }
# Looks better than:
# { foo: :bar
# baz: :bip }
Layout/MultilineHashBraceLayout:
Enabled: false
# We think that:
# foo(
# bar: :baz,
# bip: :whizz
# )
# Looks better than:
# foo(bar: baz,
# bip: :whizz)
Layout/MultilineMethodCallBraceLayout:
Enabled: false
# Just always use double quotes and stop thinking about it.
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# Ruby 2.4+ has a magic comment that makes all strings frozen and Rubocop wants to put it
# at the top of every. single. file. We decided we didn't want that - for now.
Style/FrozenStringLiteralComment:
Enabled: false
# We usually don't want you to use semicolons in Ruby, except in specs where brevity is
# often more valued than readability.
Style/Semicolon:
Exclude:
- "spec/**/*.rb"
# Single line method definitions are totally fine, and often more readable, consider:
# class WidgetsPolicy
# def create?; false; end
# def index?; true; end
# def show?; true; end
# def update?; false; end
# def delete?; false; end
# end
Style/SingleLineMethods:
Enabled: false
# We want you to put a blank line between method definitions, the only exception being
# if you're defining a bunch of single-line methods as above.
Layout/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
Naming/FileName:
Exclude:
- "**/Gemfile"
- "**/Rakefile"
- "**/Berksfile"
# Disable preference for Ruby's new safe navigation operator `&.` because it
# usually comes at the cost of expressiveness in the simple case:
#
# - coupon_usage.destroy if coupon_usage
# + coupon_usage&.destroy
#
# And guides you towards Law of Demeter violations in the extreme case:
#
# result&.data&.attributes&.payments&.first&.payment_token
#
# Disabling this cop doesn't stop you from using it, but be prepared to defend
# it in code review if you do.
Style/SafeNavigation:
Enabled: false
# Ruby supports two styles of string template formatting.
# "annotated" - format("%<greeting>s", greeting: "Hello")
# "template" - format("%{greeting}", greeting: "Hello")
#
# While the annotated format is more descriptive, it also comes in a style that is
# significantly harder for a developer to parse. The template style is easy to read, understand,
# and is consistent with formatting with (for example), intepolation (#{}).
Style/FormatStringToken:
EnforcedStyle: template
# This syntax is a deliberate idiom in rspec
# bbatsov endorses disabling it for rspec
# https://github.com/bbatsov/rubocop/issues/4222#issuecomment-290722962
Lint/AmbiguousBlockAssociation:
Exclude:
- "spec/**/*"