Skip if the URL stanza has only two path components
https://github.com/Homebrew/homebrew-cask-fonts/pull/7336#discussion_r1156325651
This commit is contained in:
parent
28f8cbe8da
commit
7bb20a3b83
@ -43,6 +43,8 @@ module RuboCop
|
|||||||
|
|
||||||
# Skip if the URL and the verified value are the same.
|
# Skip if the URL and the verified value are the same.
|
||||||
next if value_node.source == url_stanza.source.gsub(%r{^"https?://}, "\"")
|
next if value_node.source == url_stanza.source.gsub(%r{^"https?://}, "\"")
|
||||||
|
# Skip if the URL has two path components, eg: `https://github.com/google/fonts.git`.
|
||||||
|
next if url_stanza.source.gsub(%r{^"https?://}, "\"").count("/") == 2
|
||||||
# Skip if the verified value ends with a slash.
|
# Skip if the verified value ends with a slash.
|
||||||
next if value_node.str_content.end_with?("/")
|
next if value_node.str_content.end_with?("/")
|
||||||
|
|
||||||
|
|||||||
@ -104,16 +104,31 @@ describe RuboCop::Cop::Cask::Url do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the URL does not end with a slash" do
|
context "when the URL does not end with a slash" do
|
||||||
let(:source) do
|
describe "and it has one path component" do
|
||||||
<<~CASK
|
let(:source) do
|
||||||
cask "foo" do
|
<<~CASK
|
||||||
url "https://github.com/Foo",
|
cask "foo" do
|
||||||
verified: "github.com/Foo"
|
url "https://github.com/Foo",
|
||||||
end
|
verified: "github.com/Foo"
|
||||||
CASK
|
end
|
||||||
|
CASK
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples "does not report any offenses"
|
||||||
end
|
end
|
||||||
|
|
||||||
include_examples "does not report any offenses"
|
describe "and it has two path components" do
|
||||||
|
let(:source) do
|
||||||
|
<<~CASK
|
||||||
|
cask "foo" do
|
||||||
|
url "https://github.com/foo/foo.git",
|
||||||
|
verified: "github.com/foo/foo"
|
||||||
|
end
|
||||||
|
CASK
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples "does not report any offenses"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the url ends with a / and the verified value does too" do
|
context "when the url ends with a / and the verified value does too" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user