forked from simplecov-ruby/simplecov
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.rubocop.yml
More file actions
132 lines (116 loc) · 3.98 KB
/
Copy path.rubocop.yml
File metadata and controls
132 lines (116 loc) · 3.98 KB
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
plugins:
- rubocop-capybara
- rubocop-performance
- rubocop-rake
- rubocop-rspec
AllCops:
Exclude:
- "spec/fixtures/iso-8859.rb"
- "spec/fixtures/utf-8.rb"
- "spec/fixtures/utf-8-magic.rb"
- "spec/fixtures/euc-jp.rb"
- "spec/fixtures/empty_euc-jp.rb"
- "spec/fixtures/euc-jp-shebang.rb"
- "test_projects/**/*"
- "tmp/**/*"
- "vendor/bundle/**/*"
- "vendor/bundle/**/.*"
TargetRubyVersion: 3.2
NewCops: enable
Layout/AccessModifierIndentation:
Description: Modifiers should be indented as deep as method definitions,
or as deep as the class/module keyword, depending on configuration.
EnforcedStyle: outdent
Layout/LineLength:
AllowURI: true
Layout/SpaceInsideHashLiteralBraces:
Description: Use spaces inside hash literal braces - or don't.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
EnforcedStyle: no_space
Lint/AmbiguousRegexpLiteral:
Description: Checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.
Exclude:
- "features/**/*_steps.rb"
- "spec/**/*_steps.rb"
- "tmp/**/*_steps.rb"
Lint/ConstantDefinitionInBlock:
Exclude:
- "spec/**/*_spec.rb"
Metrics/BlockLength:
Description: Checks if the length of a block exceeds some maximum value.
Exclude:
- "spec/**/*.rb"
- "features/step_definitions/**/*.rb"
Metrics/ParameterLists:
Description: Avoid parameter lists longer than three or four parameters.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#too-many-params
Max: 5
# Keyword args are self-documenting at call sites and don't carry the
# readability cost of a long positional list, so don't count them
# toward the cap.
CountKeywordArgs: false
Naming/FileName:
Description: makes sure that Ruby source files have snake_case names.
Exclude:
- "spec/fixtures/utf-8.rb"
- "lib/simplecov-html.rb"
inherit_mode:
merge:
- Exclude
# Spec fixtures are byte-stable test inputs (line numbers and `puts`
# statements matter for coverage assertions), and spec/support/ holds
# helper modules — neither directory is a real spec suite, so the
# RSpec department shouldn't touch them. (The fixture rspec runners
# under spec/fixtures/frameworks/ are intentionally minimal:
# `expect(1).to eq(2)` is the point.)
RSpec:
Exclude:
- "spec/fixtures/**/*"
- "spec/support/**/*"
RSpec/ExpectActual:
Exclude:
- "spec/fixtures/**/*"
RSpec/DescribeClass:
Exclude:
- "spec/fixtures/**/*"
RSpec/ExampleLength:
Max: 20 # TODO: Lower to 5
RSpec/MultipleExpectations:
Max: 6 # TODO: Lower to 1
RSpec/SpecFilePathFormat:
# The project layout puts simplecov specs at spec/foo_spec.rb (mirroring
# lib/simplecov/foo.rb) rather than spec/simple_cov/foo_spec.rb. Map the
# SimpleCov module to an empty path segment so the cop accepts that.
CustomTransform:
SimpleCov: ''
# Mapping SimpleCov to an empty segment leaves the top-level
# `describe SimpleCov` spec (the SimpleCov module itself, mirroring
# lib/simplecov.rb) with an empty expected path, so there's nothing for
# the cop to match a filename against. Exempt it.
Exclude:
- spec/simplecov_spec.rb
RSpec/NestedGroups:
Max: 5 # TODO: Lower to 3
RSpec/MultipleMemoizedHelpers:
Max: 11 # TODO: Lower to 5
Style/CollectionMethods:
Description: Enforces the use of consistent method names from the Enumerable module.
PreferredMethods:
map: "collect"
reduce: "inject"
find: "detect"
find_all: "select"
Style/FrozenStringLiteralComment:
Description:
Add the frozen_string_literal comment to the top of files to help transition
from Ruby 2.3.0 to Ruby 3.0.
EnforcedStyle: always
Exclude:
- "spec/fixtures/**/*"
Style/EnvHome:
# `Dir.home` raises ArgumentError on JRuby when HOME is unset, defeating
# the `||` fall-through chain in lib/simplecov/load_global_config.rb.
Enabled: false
Style/StringLiterals:
Description: Allow double-quoted strings without interpolation.
EnforcedStyle: double_quotes