-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
68 lines (58 loc) · 1.56 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
# Style/RegexpLiteral:
# Enabled: false
AllCops:
TargetRubyVersion: 2.7.1
NewCops: enable # remove if this causes problems
Metrics/BlockLength:
Exclude:
- "spec/**/*.rb"
# add indent after access modifier e.g. private
Layout/IndentationConsistency:
EnforcedStyle: indented_internal_methods # previously rails style
# Use double quotes by default, common in large projects including rails
# https://anti-pattern.com/always-use-double-quoted-strings-in-ruby
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Style/ColonMethodCall:
Enabled: false
# use %r for long expressions e.g shared_constants acronym_regex
Style/RegexpLiteral:
Enabled: false
# prefer parens for method calls with args
# exceptions for Gmefile, spec, require, etc. type methods
Style/MethodCallWithArgsParentheses:
Enabled: true
IgnoredMethods:
- expect
- gem
- include
- load
- require
- require_relative
- raise
- ruby
- source
- to
- to_not
- not_to
- be
- eq
- have_title
- have_css
- have_xpath
- match
# don't like .zero? instead of == 0
Style/NumericPredicate:
Enabled: false
# preferred method aliases
Style/CollectionMethods:
Enabled: true
PreferredMethods:
collect: map
collect!: map!
inject: reduce
detect: find
find_all: select
# TODO: prefer length / size to count when no args ar present for performance (count O(n), length o(1))
# https://stackoverflow.com/questions/53480273/are-there-performance-reasons-to-prefer-size-over-length-or-count-in-ruby