-
Notifications
You must be signed in to change notification settings - Fork 45
/
.rubocop.yml
156 lines (125 loc) · 3.33 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
inherit_gem:
rubocop-gem_dev: 'config/rubocop.yml'
inherit_mode:
merge:
- Exclude
require:
- rubocop-md
- rubocop-minitest
- rubocop-performance
- rubocop-rake
AllCops:
Exclude:
- 'alba.gemspec'
- 'benchmark/**/*.rb'
- 'docs/**/*'
- 'script/**/*.rb'
NewCops: enable
EnabledByDefault: true
TargetRubyVersion: 3.0
Bundler/GemComment:
Exclude:
- 'benchmark/**/*'
# Items in Gemfile is dev dependencies and we don't have to specify versions.
Bundler/GemVersion:
Enabled: false
# Test class is a class, but not really
Layout/ClassStructure:
Exclude:
- 'test/**/*'
# LineLength 80 comes from restrictions in good old days.
Layout/LineLength:
Max: 160
# We'd like to write something like:
# assert_equal(
# expected,
# actual
# )
Layout/RedundantLineBreak:
Exclude:
- 'test/**/*'
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Layout/MultilineAssignmentLayout:
EnforcedStyle: same_line
Lint/ConstantResolution:
Enabled: false
# In test code we don't care about the metrics!
Metrics:
Exclude:
- 'test/**/*.rb'
# `Resource` module is a core module and its length tends to be long...
# `Alba` main module is also long because it has all parts of configuration
Metrics/ClassLength:
Exclude:
- 'lib/alba/resource.rb'
- 'lib/alba.rb'
- 'test/**/*.rb' # Neec to specify this
Metrics/ModuleLength:
Exclude:
- 'lib/alba/resource.rb'
- 'lib/alba.rb'
# Resource class includes DSLs, which tend to accept long list of parameters
Metrics/ParameterLists:
Max: 7
Exclude:
- 'test/**/*.rb'
# Putting extra empty line is not valuable in test
# We prefer shorter test code
Minitest/EmptyLineBeforeAssertionMethods:
Enabled: false
# By nature of that test
Minitest/NoTestCases:
Exclude:
- 'test/dependencies/test_dependencies.rb'
# We need to use `OpenStruct` to wrap object in ConfitionalAttribute
Performance/OpenStruct:
Exclude:
- 'lib/alba/conditional_attribute.rb'
# We need to eval resource code to test errors on resource classes
Security/Eval:
Exclude:
- 'test/**/*.rb'
Style/ConstantVisibility:
Exclude:
- 'lib/alba/version.rb'
- 'test/**/*.rb'
# Copyright is in README
Style/Copyright:
Enabled: false
# I know what I do :)
Style/DisableCopsWithinSourceCodeDirective:
Enabled: false
# Test files doesn't need to have documentation
Style/Documentation:
Exclude:
- 'test/**/*'
# In README it's so obvious
Style/DocumentationMethod:
Exclude:
- 'README.md'
# I don't want to think about error class in example code
Style/ImplicitRuntimeError:
Exclude:
- 'README.md'
# We use it, don't we?
Style/InlineComment:
Enabled: false
Style/MethodCallWithArgsParentheses:
AllowedMethods: ['require', 'require_relative', 'include', 'extend', 'puts', 'p', 'warn', 'raise', 'send', 'public_send', 'alias_method']
Exclude:
# There are so many calls like `attributes` and `register_type` without parenthese and that's absolutely fine
- 'test/**/*.rb'
- 'README.md'
# There are so many cases we just want `if` expression!
Style/MissingElse:
EnforcedStyle: case
# We need to use `OpenStruct` to wrap object in ConfitionalAttribute
Style/OpenStructUse:
Exclude:
- 'lib/alba/conditional_attribute.rb'
# It's example code, please forgive us
Style/OptionalBooleanParameter:
Exclude:
- 'README.md'