Skip to content

Commit 94c8fd4

Browse files
committed
Fix rubocop issues from rebase
1 parent 5bca787 commit 94c8fd4

11 files changed

Lines changed: 24 additions & 24 deletions

File tree

lib/openapi3_parser/node/context.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def self.root(factory_context)
2727
input_locations = input_location?(factory_context.input) ? [source_location] : []
2828

2929
new(factory_context.input,
30-
document_location: document_location,
30+
document_location:,
3131
source_locations: [source_location],
32-
input_locations: input_locations)
32+
input_locations:)
3333
end
3434

3535
# Create a context for the child of a previous context
@@ -53,7 +53,7 @@ def self.next_field(parent_context, field, factory_context)
5353
new(factory_context.input,
5454
document_location:,
5555
source_locations: [factory_context.source_location],
56-
input_locations: input_locations)
56+
input_locations:)
5757
end
5858

5959
# Create a context for a the a field that is the result of a reference
@@ -72,7 +72,7 @@ def self.resolved_reference(current_context, reference_factory_context)
7272
new(input,
7373
document_location: current_context.document_location,
7474
source_locations: current_context.source_locations + [reference_factory_context.source_location],
75-
input_locations: input_locations)
75+
input_locations:)
7676
end
7777

7878
def self.merge_reference_input(current_input, reference_input)

lib/openapi3_parser/node_factory/object_factory/validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def check_unexpected_fields
4343

4444
Validators::UnexpectedFields.call(
4545
validatable,
46-
extension_regex: extension_regex,
46+
extension_regex:,
4747
allowed_fields: factory.allowed_fields,
4848
raise_on_invalid:
4949
)

lib/openapi3_parser/node_factory/openapi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Openapi < NodeFactory::Object
2727

2828
validate do |validatable|
2929
next if validatable.context.openapi_version < "3.1"
30-
next if (validatable.input.keys & %w[components paths webhooks]).any?
30+
next if validatable.input.keys.intersect?(%w[components paths webhooks])
3131

3232
validatable.add_error("At least one of components, paths and webhooks fields are required")
3333
end

lib/openapi3_parser/openapi_version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class OpenapiVersion < Gem::Version
1010
#
1111
# @return [Boolean]
1212
def <=>(other)
13-
super self.class.new(other)
13+
super(self.class.new(other))
1414
end
1515
end
1616
end

spec/lib/openapi3_parser/node/context_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@
179179

180180
it "returns true when input and locations match" do
181181
instance = described_class.new({},
182-
document_location: document_location,
182+
document_location:,
183183
source_locations: [source_location],
184184
input_locations: [source_location])
185185
other = described_class.new({},
186-
document_location: document_location,
186+
document_location:,
187187
source_locations: [source_location],
188188
input_locations: [source_location])
189189

@@ -192,7 +192,7 @@
192192

193193
it "returns false when one of these differ" do
194194
instance = described_class.new({},
195-
document_location: document_location,
195+
document_location:,
196196
source_locations: [source_location],
197197
input_locations: [source_location])
198198

@@ -203,7 +203,7 @@
203203
)
204204

205205
other = described_class.new({},
206-
document_location: document_location,
206+
document_location:,
207207
source_locations: [other_source_location],
208208
input_locations: [other_source_location])
209209

@@ -230,7 +230,7 @@
230230

231231
it "returns true when input and input locations match" do
232232
instance = described_class.new({},
233-
document_location: document_location,
233+
document_location:,
234234
source_locations: [source_location],
235235
input_locations: [source_location])
236236
other = described_class.new({},
@@ -243,7 +243,7 @@
243243

244244
it "returns false when input doesn't match" do
245245
instance = described_class.new({},
246-
document_location: document_location,
246+
document_location:,
247247
source_locations: [source_location],
248248
input_locations: [source_location])
249249
other = described_class.new({ different: "data" },
@@ -256,7 +256,7 @@
256256

257257
it "returns false when input locations don't match" do
258258
instance = described_class.new({},
259-
document_location: document_location,
259+
document_location:,
260260
source_locations: [source_location],
261261
input_locations: [source_location])
262262
other = described_class.new({},

spec/lib/openapi3_parser/node_factory/context_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
}
131131
source_location = create_source_location(input)
132132

133-
instance = described_class.new({}, source_location: source_location)
133+
instance = described_class.new({}, source_location:)
134134
expect(instance.openapi_version).to eq("3.0")
135135
end
136136
end

spec/lib/openapi3_parser/node_factory/object_factory/node_builder_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def ref_factory(context)
157157
factory_context = create_node_factory_context(
158158
{ "$ref" => "#/components/schemas/Referenced",
159159
"last_name" => "Smith" },
160-
document_input: document_input
160+
document_input:
161161
)
162162

163163
node_builder = described_class.new(
@@ -173,7 +173,7 @@ def ref_factory(context)
173173
factory_context = create_node_factory_context(
174174
{ "$ref" => "#/components/schemas/Referenced",
175175
"last_name" => nil },
176-
document_input: document_input
176+
document_input:
177177
)
178178

179179
node_builder = described_class.new(
@@ -188,7 +188,7 @@ def ref_factory(context)
188188
it "returns the data without any $ref fields" do
189189
factory_context = create_node_factory_context(
190190
{ "$ref" => "#/components/schemas/Referenced" },
191-
document_input: document_input
191+
document_input:
192192
)
193193

194194
node_builder = described_class.new(
@@ -202,7 +202,7 @@ def ref_factory(context)
202202
it "raises an error if a reference is broken" do
203203
factory_context = create_node_factory_context(
204204
{ "$ref" => "#/components/schemas/Broken" },
205-
document_input: document_input
205+
document_input:
206206
)
207207

208208
node_builder = described_class.new(

spec/lib/openapi3_parser/node_factory/object_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
let(:node_factory_context) { create_node_factory_context({}) }
55
let(:instance) { described_class.new(node_factory_context) }
66

7-
it_behaves_like "node factory", ::Hash
7+
it_behaves_like "node factory", Hash
88

99
describe "#allowed_fields" do
1010
it "returns the keys of fields that are allowed" do

spec/lib/openapi3_parser/node_factory/schema/oas_dialect3_1_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
end
4141

4242
let(:node_factory_context) do
43-
create_node_factory_context(input, document_input: document_input)
43+
create_node_factory_context(input, document_input:)
4444
end
4545

4646
let(:node_context) do

spec/support/helpers/context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def node_factory_context_to_node_context(node_factory_context)
3636
Openapi3Parser::Node::Context.new(input,
3737
document_location: source_location,
3838
source_locations: [source_location],
39-
input_locations: input_locations)
39+
input_locations:)
4040
end
4141

4242
def create_node_context(input, document_input: {}, pointer_segments: [])
@@ -48,7 +48,7 @@ def create_node_context(input, document_input: {}, pointer_segments: [])
4848
Openapi3Parser::Node::Context.new(input,
4949
document_location: location,
5050
source_locations: [location],
51-
input_locations: input_locations)
51+
input_locations:)
5252
end
5353
end
5454
end

0 commit comments

Comments
 (0)