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

feat: use shared checks for URL cop #17521

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

SMillerDev
Copy link
Member

  • 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?

This continues what I did for homepage to make sure rules are consistent between cask and formula urls.

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.

Nice work, thanks @SMillerDev!

@SMillerDev
Copy link
Member Author

Just wondering, does this one make sense for casks?

/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/w/workman.rb:5:3: C: Cask/Url: Use versioned rather than branch tarballs for stable checksums.

@Bo98
Copy link
Member

Bo98 commented Jun 18, 2024

While versioned tarballs are ideal, there's version :latest/sha256 :no_check basically everywhere in casks so is usually allowed.

@SMillerDev
Copy link
Member Author

After my last changes in cask there are just 3 errors remaining that I need some help with:

This gets matched as a github repo, not sure how to override that and allow this. Or how to get this to download as a tarball.

Casks/g/github.rb:9:3: C: Cask/Url: Use GitHub tarballs rather than zipballs (url is url "https://desktop.githubusercontent.com/github-desktop/releases/#{version}/GitHubDesktop-#{arch}.zip",
      verified: "desktop.githubusercontent.com/github-desktop/").
  url "https://desktop.githubusercontent.com/github-desktop/releases/#{version}/GitHubDesktop-#{arch}.zip", ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Casks/g/github@beta.rb:9:3: C: Cask/Url: Use GitHub tarballs rather than zipballs (url is url "https://desktop.githubusercontent.com/github-desktop/releases/#{version}/GitHubDesktop-#{arch}.zip",
      verified: "desktop.githubusercontent.com/github-desktop/releases/").
  url "https://desktop.githubusercontent.com/github-desktop/releases/#{version}/GitHubDesktop-#{arch}.zip", ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This repo contains zip files for distribution. Preferably I'd also override this one to allow it.

Casks/s/sol.rb:5:3: C: Cask/Url: Use GitHub tarballs rather than zipballs (url is url "https://raw.githubusercontent.com/ospfranco/sol/main/releases/#{version}.zip",
      verified: "raw.githubusercontent.com/ospfranco/sol/").
  url "https://raw.githubusercontent.com/ospfranco/sol/main/releases/#{version}.zip", ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@MikeMcQuaid
Copy link
Member

This gets matched as a github repo, not sure how to override that and allow this. Or how to get this to download as a tarball.

https://github.com/Homebrew/brew/blob/master/Library/Homebrew/rubocops/urls.rb#L225

Add next if url.include?("desktop.githubusercontent.com/github-desktop/releases/") below here

This repo contains zip files for distribution. Preferably I'd also override this one to allow it.

https://github.com/ospfranco/sol/releases/tag/2.1.41

Looks like just default generated archives from here so this cask should be fixed to use a tarball.

@SMillerDev
Copy link
Member Author

Looks like just default generated archives from here so this cask should be fixed to use a tarball.

No, it's actually https://github.com/ospfranco/sol/blob/main/releases/2.1.58.zip. The folder in the repo is called releases see ospfranco/sol#127

@MikeMcQuaid
Copy link
Member

No, it's actually ospfranco/sol@main/releases/2.1.58.zip. The folder in the repo is called releases see ospfranco/sol#127

Oh, weird. Yeh, in that case I guess: add another exception here (probably for .match?($r{/blob/(main|master|HEAD)/releases/})

@SMillerDev
Copy link
Member Author

Dropped the releases part, now we allow all zip files when they are part of the repo main|master|HEAD content. It made a bit more sense to me as a rule.

@MikeMcQuaid MikeMcQuaid merged commit 077170b into Homebrew:master Jun 25, 2024
25 checks passed
@MikeMcQuaid
Copy link
Member

Thanks @SMillerDev, great work again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants