Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audit: specify which URL has a content problem in problem message #11203

Merged
merged 2 commits into from
Apr 22, 2021

Conversation

kthchew
Copy link
Contributor

@kthchew kthchew commented Apr 21, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Implements #11183 (CC @cdayjr). The two new messages are (for example):

❯ brew audit --online some-test-formula
some-test-formula:
  * The homepage URL https://example.com/some-nonexistent-homepage is not reachable (HTTP status code 404)
  * Stable: The zip/tarball URL https://example.com/some-nonexistent-thing/unknown-0.1.tar.gz is not reachable (HTTP status code 404)

(formerly did not mention "homepage" or "zip/tarball")

@carlocab
Copy link
Member

Thanks for looking into this! What about if the stable URL is a git repo?

@kthchew
Copy link
Contributor Author

kthchew commented Apr 21, 2021

Thanks for looking into this! What about if the stable URL is a git repo?

As in a private GitHub (for example) repo? In theory it should have the same error message as it used to, with the first instance of “URL” replaced with “zip/tarball URL”. I can’t check this right now, but I’ll see if I can verify that when I’m back to my computer tomorrow.

@carlocab
Copy link
Member

Oh, I just meant that this message would also call Git repo URLs a zip/tarball URL, which could be confusing.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@@ -383,7 +383,7 @@ def audit_homepage
user_agents: [:browser, :default],
check_content: true,
strict: @strict))
problem http_content_problem
problem http_content_problem.sub("URL", "homepage URL")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally homepage URL would be an argument to curl_check_http_content rather than substituting the output at the end. It would be good to make this a required argument and also use it in Library/Homebrew/cask/audit.rb too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense! I’ll also try to look into what I can do for this tonight.

@kthchew
Copy link
Contributor Author

kthchew commented Apr 21, 2021

Oh, I just meant that this message would also call Git repo URLs a zip/tarball URL, which could be confusing.

Ohh, sorry, I completely missed the point! Yeah, I didn’t account for that at all. I’ll try to see what I can do about it tonight.

@kthchew
Copy link
Contributor Author

kthchew commented Apr 21, 2021

Force pushed some changes based on your reviews. Please let me know if anything else needs improvement!

@@ -101,7 +101,7 @@ def audit_urls

strategy = DownloadStrategyDetector.detect(url, using)
if strategy <= CurlDownloadStrategy && !url.start_with?("file")
if (http_content_problem = curl_check_http_content(url, specs: specs))
if (http_content_problem = curl_check_http_content(url, "zip, tarball, or repo URL", specs: specs))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (http_content_problem = curl_check_http_content(url, "zip, tarball, or repo URL", specs: specs))
if (http_content_problem = curl_check_http_content(url, "source URL", specs: specs))

This seems nicer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you. I thought there was a more concise way to say it, but it was escaping my brain 😛

Change made.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good here, nice work!

Library/Homebrew/utils/curl.rb Outdated Show resolved Hide resolved
MikeMcQuaid
MikeMcQuaid previously approved these changes Apr 22, 2021
MikeMcQuaid
MikeMcQuaid previously approved these changes Apr 22, 2021
@MikeMcQuaid MikeMcQuaid merged commit afbe0e8 into Homebrew:master Apr 22, 2021
@MikeMcQuaid
Copy link
Member

Thanks again @kthchew!

@kthchew
Copy link
Contributor Author

kthchew commented Apr 22, 2021

You’re welcome! 😊

@kthchew kthchew deleted the audit-url branch May 2, 2021 03:22
@kthchew kthchew restored the audit-url branch May 2, 2021 05:27
@kthchew kthchew deleted the audit-url branch May 2, 2021 05:27
@github-actions github-actions bot added the outdated PR was locked due to age label Jun 2, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants