mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Add link to pypi downloads page to problem message
This commit is contained in:
parent
5f3f7d010b
commit
70dfaf3b42
@ -292,15 +292,21 @@ module RuboCop
|
|||||||
|
|
||||||
# Check pypi urls
|
# Check pypi urls
|
||||||
pypi_pattern = %r{^https?://pypi.python.org/}
|
pypi_pattern = %r{^https?://pypi.python.org/}
|
||||||
audit_urls(urls, pypi_pattern) do
|
audit_urls(urls, pypi_pattern) do |_, url|
|
||||||
problem "use the `files.pythonhosted.org` url found on the pypi downloads page"
|
problem "use the `Source` url found on PyPI downloads page (`#{get_pypi_url(url)}`)"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Require long files.pythonhosted.org urls
|
# Require long files.pythonhosted.org urls
|
||||||
pythonhosted_pattern = %r{^https?://files.pythonhosted.org/packages/source/}
|
pythonhosted_pattern = %r{^https?://files.pythonhosted.org/packages/source/}
|
||||||
audit_urls(urls, pythonhosted_pattern) do
|
audit_urls(urls, pythonhosted_pattern) do |_, url|
|
||||||
problem "use the url found on the pypi downloads page"
|
problem "use the `Source` url found on PyPI downloads page (`#{get_pypi_url(url)}`)"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_pypi_url(url)
|
||||||
|
package_file = File.basename(url)
|
||||||
|
package_name = package_file.match(/^(.+)-[a-z0-9.]+$/)[1]
|
||||||
|
"https://pypi.org/project/#{package_name}/#files"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -251,7 +251,7 @@ describe RuboCop::Cop::FormulaAudit::PyPiUrls do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
desc "foo"
|
desc "foo"
|
||||||
url "https://pypi.python.org/packages/source/foo/foo-0.1.tar.gz"
|
url "https://pypi.python.org/packages/source/foo/foo-0.1.tar.gz"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `files.pythonhosted.org` url found on the pypi downloads page
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`)
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -261,7 +261,7 @@ describe RuboCop::Cop::FormulaAudit::PyPiUrls do
|
|||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
desc "foo"
|
desc "foo"
|
||||||
url "https://files.pythonhosted.org/packages/source/f/foo/foo-0.1.tar.gz"
|
url "https://files.pythonhosted.org/packages/source/f/foo/foo-0.1.tar.gz"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the url found on the pypi downloads page
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`)
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user