-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
138 lines (117 loc) · 4.08 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
133
134
135
136
137
138
# To make it easier to find descriptions and add exceptions
AllCops:
TargetRubyVersion: 2.4
DisplayCopNames: true
Exclude:
- 'bin/**/*'
- 'vendor/**/*'
- 'db/schema.rb'
- 'tmp/**/*'
- 'node_modules/**/*'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Layout/IndentHash
# To make reasonable use of whitespace
Layout/IndentHash:
EnforcedStyle: 'consistent'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Layout/IndentArray
# To make reasonable use of whitespace
Layout/IndentArray:
EnforcedStyle: 'consistent'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Layout/DotPosition
# To match this rule for JS
Layout/DotPosition:
EnforcedStyle: 'leading'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Lint/AmbiguousBlockAssociation
# It looks perfectly fine for asserting change
Lint/AmbiguousBlockAssociation:
Exclude:
- '**/*_spec.rb'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/AbcSize
# Lets be reasonable about it
# It is common to exceed AbcSize in migrations
Metrics/AbcSize:
Max: 17
Exclude:
- 'db/migrate/**/*'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/BlockLength
# It is common to have long blocks in routes, specs, matchers,
# factories and configuration files
Metrics/BlockLength:
Exclude:
- 'config/routes.rb'
- 'spec/spec_helper.rb'
- 'spec/**/*_factory.rb'
- 'spec/support/matchers/*.rb'
- '**/*_spec.rb'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/LineLength
# To fit Github review window
# Migration names tend to be long
Metrics/LineLength:
Max: 100
Exclude:
- 'db/migrate/**/*'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/MethodLength
# 12 does not seem too restrictive
# Long methods are common to migrations and seeds
Metrics/MethodLength:
Max: 12
Exclude:
- 'db/migrate/**/*'
- 'db/seeds/**/*'
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/ModuleLength
# Large modules are totally fine in rspec
Metrics/ModuleLength:
Exclude:
- '**/*_spec.rb'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/AccessorMethodName
# It is common to expose `get_` like interface in wrappers
Naming/AccessorMethodName:
Exclude:
- 'app/wrappers/**/*.rb'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/VariableNumber
# More readable
Naming/VariableNumber:
EnforcedStyle: 'snake_case'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/Alias
# To keep it consistent. `alias` does not work for all cases (i.e. aliasing at runtime)
Style/Alias:
EnforcedStyle: 'prefer_alias_method'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/BlockDelimiters
# It is common to use {} blocks for `expect`
Style/BlockDelimiters:
Exclude:
- '**/*_spec.rb'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/DateTime
# We do not care about it that much, and sometimes we need it
Style/DateTime:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/Documentation
# We prefer everything to be self-explanatory
Style/Documentation:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
# The shortest syntax
Style/FormatString:
EnforcedStyle: 'percent'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FrozenStringLiteralComment
# We do not care
Style/FrozenStringLiteralComment:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/GuardClause
# Sometimes using explicit condition is more readable
Style/GuardClause:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/MutableConstant
# Seriously this has never been a problem and it looks weird
Style/MutableConstant:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/NumericLiterals
# It looks awkward for custom ids
Style/NumericLiterals:
Exclude:
- '**/*_spec.rb'
- '**/*_factory.rb'
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/SymbolArray
# Common way to describe indices
Style/SymbolArray:
Exclude:
- 'db/migrate/**/*'