Skip to content

rubocops/urls: audit more Apache URLs and autocorrect#21744

Open
cho-m wants to merge 2 commits intomainfrom
audit-apache-url
Open

rubocops/urls: audit more Apache URLs and autocorrect#21744
cho-m wants to merge 2 commits intomainfrom
audit-apache-url

Conversation

@cho-m
Copy link
Member

@cho-m cho-m commented Mar 16, 2026

  • 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 lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Closer.lua is still the Apache's recommendation and it handles older releases when moved to archive - https://infra.apache.org/release-download-pages.html

PR adds detection for some alternative Apache download URLs:

Also match when URL includes extra parts, e.g. flink-cdc url is

Will need to style fix Homebrew/core formulae first.


Some other ideas for future PRs:

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 when 🟢!

Might be nice to have some autocorrect tests.

@cho-m cho-m marked this pull request as ready for review March 16, 2026 19:34
Copilot AI review requested due to automatic review settings March 16, 2026 19:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands Homebrew’s URL-auditing RuboCop to recognize more Apache download URL variants and automatically correct them to the recommended closer.lua form.

Changes:

  • Broaden Apache URL detection to cover dlcdn.apache.org, downloads.apache.org, dist.apache.org/repos/dist/release, and additional dyn/.../mirrors.cgi shapes.
  • Add autocorrection for matched Apache URLs, rewriting them to https://www.apache.org/dyn/closer.lua?path=....
  • Add RSpec coverage for the new Apache URL variants and enable autocorrect support in the FormulaAudit::Urls cop.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Library/Homebrew/rubocops/shared/url_helper.rb Extends the Apache URL matching regex and adds autocorrection to closer.lua?path=....
Library/Homebrew/rubocops/urls.rb Enables AutoCorrector for the FormulaAudit::Urls cop so the new correction block can run.
Library/Homebrew/test/rubocops/urls_spec.rb Adds new specs asserting offenses + corrections for the newly recognized Apache URL forms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands Homebrew’s FormulaAudit/Urls Apache URL auditing to recognize additional Apache download URL variants and introduces an autocorrection to rewrite them to Apache’s recommended closer.lua?path=... form.

Changes:

  • Extend Apache URL detection to cover dlcdn.apache.org, downloads.apache.org, dist.apache.org/repos/dist/release/, and additional dyn/mirrors.cgi/dyn/closer.cgi URL shapes.
  • Add autocorrection support to FormulaAudit/Urls for Apache URL offenses.
  • Add RSpec coverage ensuring offenses are registered and corrected for the newly-detected Apache URL forms.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/test/rubocops/urls_spec.rb Adds tests for Apache URL offense detection and autocorrection.
Library/Homebrew/rubocops/urls.rb Enables autocorrection on the FormulaAudit::Urls cop.
Library/Homebrew/rubocops/shared/url_helper.rb Broadens Apache URL matching and implements autocorrect to closer.lua?path=....

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants