Skip to content

Commit

Permalink
rubocop: Fix Style/TrailingCommaInArguments
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Feb 17, 2023
1 parent dca00fe commit 2eeb50e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ Style/TrailingCommaInHashLiteral:
Style/TrailingCommaInArrayLiteral:
Enabled: True
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArguments:
Enabled: True
EnforcedStyleForMultiline: consistent_comma
2 changes: 1 addition & 1 deletion lib/json-schema/attributes/type_v4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.validate(current_schema, data, fragments, processor, validator, options
build_fragment(fragments),
type_of_data(data),
union ? 'one or more of the following types' : 'the following type',
types
types,
)

validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
Expand Down
2 changes: 1 addition & 1 deletion test/common_test_suite_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.skip?(current_test, file_path)
t["data"],
:parse_data => false,
:validate_schema => true,
:version => version
:version => version,
)
assert_equal t["valid"], errors.empty?, "Common test suite case failed: #{err_id}"
end
Expand Down
2 changes: 1 addition & 1 deletion test/fragment_validation_with_ref_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def test_validation_of_fragment
def test_validation_of_fragment_with_array
data = {"content" => "ohai", "author" => "Bob"}
assert_valid(whole_schema_with_array, data,
:fragment => "#/definitions/omg/links/0/schema")
:fragment => "#/definitions/omg/links/0/schema",)
end
end
2 changes: 1 addition & 1 deletion test/load_ref_schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def load_other_schema
},
},
},
Addressable::URI.parse("http://example.com/schema#")
Addressable::URI.parse("http://example.com/schema#"),
))
end

Expand Down
4 changes: 2 additions & 2 deletions test/schema_reader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_refuse_all_files

def test_accept_uri_proc
reader = JSON::Schema::Reader.new(
:accept_uri => proc { |uri| uri.host == 'json-schema.org' }
:accept_uri => proc { |uri| uri.host == 'json-schema.org' },
)

assert reader.accept_uri?(Addressable::URI.parse('http://json-schema.org/address'))
Expand All @@ -48,7 +48,7 @@ def test_accept_file_proc
test_root = Pathname.new(__FILE__).expand_path.dirname

reader = JSON::Schema::Reader.new(
:accept_file => proc { |path| path.to_s.start_with?(test_root.to_s) }
:accept_file => proc { |path| path.to_s.start_with?(test_root.to_s) },
)

assert reader.accept_file?(test_root.join('anything.json'))
Expand Down
14 changes: 7 additions & 7 deletions test/uri_util_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_normalized_uri
str = "https://www.google.com/search"
uri = Addressable::URI.new(:scheme => 'https',
:host => 'www.google.com',
:path => 'search')
:path => 'search',)
assert_equal uri, JSON::Util::URI.normalized_uri(str, '/home')
end

Expand All @@ -24,7 +24,7 @@ def test_normalized_uri_with_empty_fragment
uri = Addressable::URI.new(:scheme => 'https',
:host => 'www.google.com',
:path => 'search',
:fragment => nil)
:fragment => nil,)
assert_equal uri, JSON::Util::URI.normalized_uri(str, '/home')
end

Expand All @@ -33,39 +33,39 @@ def test_normalized_uri_with_fragment
uri = Addressable::URI.new(:scheme => 'https',
:host => 'www.google.com',
:path => 'search',
:fragment => 'foo')
:fragment => 'foo',)
assert_equal uri, JSON::Util::URI.normalized_uri(str, '/home')
end

def test_normalized_uri_for_absolute_path
str = "/foo/bar.json"
uri = Addressable::URI.new(:scheme => 'file',
:host => '',
:path => '/foo/bar.json')
:path => '/foo/bar.json',)
assert_equal uri, JSON::Util::URI.normalized_uri(str, '/home')
end

def test_normalized_uri_for_relative_path
str = "foo/bar.json"
uri = Addressable::URI.new(:scheme => 'file',
:host => '',
:path => '/home/foo/bar.json')
:path => '/home/foo/bar.json',)
assert_equal uri, JSON::Util::URI.normalized_uri(str, '/home')
end

def test_normalized_uri_for_file_path_with_host
str = "file://localhost/foo/bar.json"
uri = Addressable::URI.new(:scheme => 'file',
:host => 'localhost',
:path => '/foo/bar.json')
:path => '/foo/bar.json',)
assert_equal uri, JSON::Util::URI.normalized_uri(str, '/home')
end

def test_uri_parse
str = "https://www.google.com/search"
uri = Addressable::URI.new(:scheme => 'https',
:host => 'www.google.com',
:path => 'search')
:path => 'search',)
assert_equal uri, JSON::Util::URI.parse(str)
end

Expand Down

0 comments on commit 2eeb50e

Please sign in to comment.