Skip to content

Commit 918ac6b

Browse files
chore: fix misc linting / minor issues
1 parent 0ef168a commit 918ac6b

File tree

9 files changed

+17
-10
lines changed

9 files changed

+17
-10
lines changed

.rubocop.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AllCops:
88
- "bin/*"
99
NewCops: enable
1010
SuggestExtensions: false
11-
TargetRubyVersion: 3.2
11+
TargetRubyVersion: 3.2.0
1212

1313
# Whether MFA is required or not should be left to the token configuration.
1414
Gemspec/RequireMFA:
@@ -112,6 +112,8 @@ Metrics/AbcSize:
112112
Metrics/BlockLength:
113113
AllowedPatterns:
114114
- assert_pattern
115+
- type_alias
116+
- define_sorbet_constant!
115117
Exclude:
116118
- "**/*.rbi"
117119

@@ -182,6 +184,9 @@ Style/ClassAndModuleChildren:
182184
Exclude:
183185
- "test/**/*"
184186

187+
Style/CommentAnnotation:
188+
Enabled: false
189+
185190
# We should go back and add these docs, but ignore for now.
186191
Style/Documentation:
187192
Enabled: false

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ desc("Lint `*.rb(i)`")
4141
multitask(:"lint:rubocop") do
4242
find = %w[find ./lib ./test ./rbi -type f -and ( -name *.rb -or -name *.rbi ) -print0]
4343

44-
rubocop = %w[rubocop --fail-level E]
44+
rubocop = %w[rubocop]
4545
rubocop += %w[--format github] if ENV.key?("CI")
4646

4747
# some lines cannot be shortened

lib/openai.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
# Standard libraries.
4+
# rubocop:disable Lint/RedundantRequireStatement
45
require "English"
56
require "cgi"
67
require "date"
@@ -14,6 +15,7 @@
1415
require "stringio"
1516
require "time"
1617
require "uri"
18+
# rubocop:enable Lint/RedundantRequireStatement
1719

1820
# We already ship the preferred sorbet manifests in the package itself.
1921
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.

lib/openai/errors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class APIStatusError < OpenAI::Errors::APIError
120120
# @param response [nil]
121121
# @param message [String, nil]
122122
#
123-
# @return [OpenAI::Errors::APIStatusError]
123+
# @return [self]
124124
def self.for(url:, status:, body:, request:, response:, message: nil)
125125
kwargs = {
126126
url: url,

rbi/openai/errors.rbi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module OpenAI
122122
request: NilClass,
123123
response: NilClass,
124124
message: T.nilable(String)
125-
).returns(T.self_type)
125+
).returns(T.attached_class)
126126
end
127127
def self.for(url:, status:, body:, request:, response:, message: nil)
128128
end

sig/openai/internal/type/array_of.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module OpenAI
99
| ^-> OpenAI::Internal::Type::Converter::input
1010
| OpenAI::Internal::Type::Converter::input type_info,
1111
?::Hash[Symbol, top] spec
12-
) -> self
12+
) -> instance
1313

1414
def ===: (top other) -> bool
1515

sig/openai/internal/type/base_model.rbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ module OpenAI
6161
def self.coerce: (
6262
OpenAI::Internal::Type::BaseModel | ::Hash[top, top] | top value,
6363
state: OpenAI::Internal::Type::Converter::coerce_state
64-
) -> (self | top)
64+
) -> (instance | top)
6565

6666
def self.dump: (
67-
self | top value,
67+
instance | top value,
6868
state: OpenAI::Internal::Type::Converter::dump_state
6969
) -> (::Hash[top, top] | top)
7070

@@ -84,7 +84,7 @@ module OpenAI
8484

8585
def to_yaml: (*top a) -> String
8686

87-
def initialize: (?::Hash[Symbol, top] | self data) -> void
87+
def initialize: (?::Hash[Symbol, top] | instance data) -> void
8888

8989
def self.inspect: (?depth: Integer) -> String
9090

sig/openai/internal/type/base_page.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module OpenAI
44
module BasePage[Elem]
55
def next_page?: -> bool
66

7-
def next_page: -> self
7+
def next_page: -> instance
88

99
def auto_paging_each: { (Elem arg0) -> void } -> void
1010

sig/openai/internal/type/hash_of.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module OpenAI
99
| ^-> OpenAI::Internal::Type::Converter::input
1010
| OpenAI::Internal::Type::Converter::input type_info,
1111
?::Hash[Symbol, top] spec
12-
) -> self
12+
) -> instance
1313

1414
def ===: (top other) -> bool
1515

0 commit comments

Comments
 (0)