Skip to content

Commit 4244f89

Browse files
chore: loosen rubocop rules that don't always make sense
1 parent 5c9767e commit 4244f89

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.rubocop.yml

+11
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ Layout/MultilineMethodParameterLineBreaks:
6464
Layout/SpaceInsideHashLiteralBraces:
6565
EnforcedStyle: no_space
6666

67+
Lint/BooleanSymbol:
68+
Enabled: false
69+
6770
# This option occasionally mangles identifier names
6871
Lint/DeprecatedConstants:
6972
Exclude:
7073
- "**/*.rbi"
7174

75+
# We use pattern assertion in tests to ensure correctness.
76+
Lint/DuplicateMatchPattern:
77+
Exclude:
78+
- "test/**/*"
79+
7280
# Fairly useful in tests for pattern assertions.
7381
Lint/EmptyInPattern:
7482
Exclude:
@@ -119,6 +127,9 @@ Metrics/ParameterLists:
119127
Metrics/PerceivedComplexity:
120128
Enabled: false
121129

130+
Naming/AccessorMethodName:
131+
Enabled: false
132+
122133
# Need to preserve block identifier for documentation.
123134
Naming/BlockForwarding:
124135
Enabled: false

Rakefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
3939

4040
desc("Lint `*.rb(i)`")
4141
multitask(:"lint:rubocop") do
42-
lint = xargs + %w[rubocop --fail-level E] + (ENV.key?("CI") ? %w[--format github] : [])
42+
rubocop = %w[rubocop --fail-level E]
43+
rubocop += %w[--format github] if ENV.key?("CI")
44+
45+
# some lines cannot be shortened
46+
rubocop += %w[--except Lint/RedundantCopDisableDirective,Layout/LineLength]
47+
48+
lint = xargs + rubocop
4349
sh("#{rubo_find.shelljoin} | #{lint.shelljoin}")
4450
end
4551

test/openai/internal/type/base_model_test.rb

-2
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,9 @@ def test_coerce
194194
[E0.new(:one), "one"] => [{yes: 1}, :one],
195195
[E0.new(:two), "one"] => [{maybe: 1}, "one"],
196196

197-
# rubocop:disable Lint/BooleanSymbol
198197
[E1, true] => [{yes: 1}, true],
199198
[E1, false] => [{no: 1}, false],
200199
[E1, :true] => [{no: 1}, :true],
201-
# rubocop:enable Lint/BooleanSymbol
202200

203201
[E2, 1] => [{yes: 1}, 1],
204202
[E2, 1.0] => [{yes: 1}, 1],

0 commit comments

Comments
 (0)