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.
|
||||
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.
|
||||
next if value_node.str_content.end_with?("/")
|
||||
|
||||
|
||||
@ -104,6 +104,7 @@ describe RuboCop::Cop::Cask::Url do
|
||||
end
|
||||
|
||||
context "when the URL does not end with a slash" do
|
||||
describe "and it has one path component" do
|
||||
let(:source) do
|
||||
<<~CASK
|
||||
cask "foo" do
|
||||
@ -116,6 +117,20 @@ describe RuboCop::Cop::Cask::Url do
|
||||
include_examples "does not report any offenses"
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
context "when the url ends with a / and the verified value does too" do
|
||||
let(:source) do
|
||||
<<~CASK
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user