From 1c2d76c4e4903322197c3cf854188e31d5a41838 Mon Sep 17 00:00:00 2001 From: Nanda H Krishna Date: Sat, 17 Apr 2021 01:44:28 +0530 Subject: [PATCH] rubocops/patches: remove autocorrection of some URLs --- Library/Homebrew/rubocops/patches.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/rubocops/patches.rb b/Library/Homebrew/rubocops/patches.rb index 28d3d55fd5..272e7c8311 100644 --- a/Library/Homebrew/rubocops/patches.rb +++ b/Library/Homebrew/rubocops/patches.rb @@ -53,24 +53,16 @@ module RuboCop end if regex_match_group(patch_url_node, %r{https://github.com/[^/]*/[^/]*/commit/[a-fA-F0-9]*\.diff}) - problem "GitHub patches should end with .patch, not .diff: #{patch_url}" do |corrector| - correct = patch_url_node.source.gsub(/\.diff/, ".patch") - corrector.replace(patch_url_node.source_range, correct) - end + problem "GitHub patches should end with .patch, not .diff: #{patch_url}" end if regex_match_group(patch_url_node, %r{.*gitlab.*/commit/[a-fA-F0-9]*\.diff}) - problem "GitLab patches should end with .patch, not .diff: #{patch_url}" do |corrector| - correct = patch_url_node.source.gsub(/\.diff/, ".patch") - corrector.replace(patch_url_node.source_range, correct) - end + problem "GitLab patches should end with .patch, not .diff: #{patch_url}" end gh_patch_param_pattern = %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)} if regex_match_group(patch_url_node, gh_patch_param_pattern) && !patch_url.match?(/\?full_index=\w+$/) - problem "GitHub patches should use the full_index parameter: #{patch_url}?full_index=1" do |corrector| - corrector.replace(patch_url_node.source_range, "\"#{patch_url}?full_index=1\"") - end + problem "GitHub patches should use the full_index parameter: #{patch_url}?full_index=1" end gh_patch_patterns = Regexp.union([%r{/raw\.github\.com/},