mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Autocorrect style issues with brew style --fix
This commit is contained in:
parent
77d972c67c
commit
5ccfbcd1d2
@ -275,7 +275,7 @@ module Formulary
|
||||
def load_file(flags:, ignore_errors:)
|
||||
if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?<formula_name>[\w+-.@]+).rb} =~ url
|
||||
raise UsageError, "Installation of #{formula_name} from a GitHub commit URL is unsupported! " \
|
||||
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
|
||||
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
|
||||
elsif url.match?(%r{^(https?|ftp)://})
|
||||
raise UsageError, "Non-checksummed download of #{name} formula file from an arbitrary URL is unsupported! ",
|
||||
"`brew extract` or `brew create` and `brew tap-new` to create a "\
|
||||
|
@ -205,8 +205,8 @@ module RuboCop
|
||||
return if tap_style_exception? :components_order_exceptions
|
||||
|
||||
problem "`#{format_component(c1)}` (line #{line_number(c1)}) " \
|
||||
"should be put before `#{format_component(c2)}` " \
|
||||
"(line #{line_number(c2)})" do |corrector|
|
||||
"should be put before `#{format_component(c2)}` " \
|
||||
"(line #{line_number(c2)})" do |corrector|
|
||||
reorder_components(corrector, c1, c2)
|
||||
end
|
||||
end
|
||||
|
@ -205,7 +205,7 @@ module RuboCop
|
||||
|
||||
find_method_with_args(body_node, :depends_on, "mpich") do
|
||||
problem "Formulae in homebrew/core should use 'depends_on \"open-mpi\"' " \
|
||||
"instead of '#{@offensive_node.source}'." do |corrector|
|
||||
"instead of '#{@offensive_node.source}'." do |corrector|
|
||||
corrector.replace(@offensive_node.source_range, "depends_on \"open-mpi\"")
|
||||
end
|
||||
end
|
||||
@ -340,7 +340,7 @@ module RuboCop
|
||||
|
||||
offending_node(str)
|
||||
problem "References to `#{content}` should "\
|
||||
"match the specified python dependency (`#{fix}`)" do |corrector|
|
||||
"match the specified python dependency (`#{fix}`)" do |corrector|
|
||||
corrector.replace(str.source_range, "\"#{fix}\"")
|
||||
end
|
||||
end
|
||||
|
@ -293,7 +293,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
it "checks online and verifies that a standard license id is the same "\
|
||||
"as what is indicated on its Github repo", :needs_network do
|
||||
"as what is indicated on its Github repo", :needs_network do
|
||||
formula_text = <<~RUBY
|
||||
class Cask < Formula
|
||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||
@ -309,7 +309,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
it "checks online and verifies that a standard license id with AND is the same "\
|
||||
"as what is indicated on its Github repo", :needs_network do
|
||||
"as what is indicated on its Github repo", :needs_network do
|
||||
formula_text = <<~RUBY
|
||||
class Cask < Formula
|
||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||
@ -325,7 +325,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
it "checks online and verifies that a standard license id with WITH is the same "\
|
||||
"as what is indicated on its Github repo", :needs_network do
|
||||
"as what is indicated on its Github repo", :needs_network do
|
||||
formula_text = <<~RUBY
|
||||
class Cask < Formula
|
||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||
@ -407,7 +407,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
it "checks online and detects that a formula-specified license is not "\
|
||||
"the same as what is indicated on its Github repository", :needs_network do
|
||||
"the same as what is indicated on its Github repository", :needs_network do
|
||||
formula_text = <<~RUBY
|
||||
class Cask < Formula
|
||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||
@ -441,7 +441,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
it "checks online and detects that an array of license does not contain "\
|
||||
"what is indicated on its Github repository", :needs_network do
|
||||
"what is indicated on its Github repository", :needs_network do
|
||||
formula_text = <<~RUBY
|
||||
class Cask < Formula
|
||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||
@ -454,11 +454,11 @@ module Homebrew
|
||||
|
||||
fa.audit_license
|
||||
expect(fa.problems.first[:message]).to match "Formula license [\"0BSD\", \"MIT\"] "\
|
||||
"does not match GitHub license [\"GPL-3.0\"]."
|
||||
"does not match GitHub license [\"GPL-3.0\"]."
|
||||
end
|
||||
|
||||
it "checks online and verifies that an array of license contains "\
|
||||
"what is indicated on its Github repository", :needs_network do
|
||||
"what is indicated on its Github repository", :needs_network do
|
||||
formula_text = <<~RUBY
|
||||
class Cask < Formula
|
||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||
|
@ -51,7 +51,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
|
||||
let(:expected_offenses) do
|
||||
[{
|
||||
message: "'https://foo.brew.sh' must have a slash "\
|
||||
"after the domain.",
|
||||
"after the domain.",
|
||||
severity: :convention,
|
||||
line: 2,
|
||||
column: 11,
|
||||
|
@ -110,7 +110,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
|
||||
line: 3,
|
||||
column: 2,
|
||||
source: "uninstall :quit => 'com.example.foo',\n" \
|
||||
" :kext => 'com.example.foo.kext'",
|
||||
" :kext => 'com.example.foo.kext'",
|
||||
}, {
|
||||
message: "`version` stanza out of order",
|
||||
severity: :convention,
|
||||
|
@ -6,11 +6,11 @@ require "utils/pypi"
|
||||
describe PyPI do
|
||||
let(:package_url) do
|
||||
"https://files.pythonhosted.org/packages/b0/3f/2e1dad67eb172b6443b5eb37eb885a054a55cfd733393071499514140282/"\
|
||||
"snakemake-5.29.0.tar.gz"
|
||||
"snakemake-5.29.0.tar.gz"
|
||||
end
|
||||
let(:old_package_url) do
|
||||
"https://files.pythonhosted.org/packages/6f/c4/da52bfdd6168ea46a0fe2b7c983b6c34c377a8733ec177cc00b197a96a9f/"\
|
||||
"snakemake-5.28.0.tar.gz"
|
||||
"snakemake-5.28.0.tar.gz"
|
||||
end
|
||||
|
||||
describe PyPI::Package do
|
||||
|
@ -137,7 +137,7 @@ module Homebrew
|
||||
|
||||
def are_required_by_deps
|
||||
"#{"is".pluralize(reqs.count)} required by #{deps.to_sentence}, " \
|
||||
"which #{"is".pluralize(deps.count)} currently installed"
|
||||
"which #{"is".pluralize(deps.count)} currently installed"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -274,10 +274,10 @@ module Utils
|
||||
formatted_percent_header =
|
||||
format "%#{percent_width}s", percent_header
|
||||
puts "#{formatted_index_header} | #{formatted_name_with_options_header} | "\
|
||||
"#{formatted_count_header} | #{formatted_percent_header}"
|
||||
"#{formatted_count_header} | #{formatted_percent_header}"
|
||||
|
||||
columns_line = "#{"-"*index_width}:|-#{"-"*name_with_options_width}-|-"\
|
||||
"#{"-"*count_width}:|-#{"-"*percent_width}:"
|
||||
"#{"-"*count_width}:|-#{"-"*percent_width}:"
|
||||
puts columns_line
|
||||
|
||||
index = 0
|
||||
@ -296,7 +296,7 @@ module Utils
|
||||
format_percent((count.to_i * 100) / total_count.to_f)
|
||||
end
|
||||
puts "#{formatted_index} | #{formatted_name_with_options} | " \
|
||||
"#{formatted_count} | #{formatted_percent}%"
|
||||
"#{formatted_count} | #{formatted_percent}%"
|
||||
next if index > 10
|
||||
end
|
||||
return unless results.length > 1
|
||||
@ -310,7 +310,7 @@ module Utils
|
||||
formatted_total_percent_footer =
|
||||
format "%#{percent_width}s", formatted_total_percent
|
||||
puts "#{formatted_total_footer} | #{formatted_blank_footer} | "\
|
||||
"#{formatted_total_count_footer} | #{formatted_total_percent_footer}%"
|
||||
"#{formatted_total_count_footer} | #{formatted_total_percent_footer}%"
|
||||
end
|
||||
|
||||
def config_true?(key)
|
||||
|
@ -195,7 +195,7 @@ module PyPI
|
||||
input_packages.each do |existing_package|
|
||||
if existing_package.same_package?(extra_package) && existing_package.version != extra_package.version
|
||||
odie "Conflicting versions specified for the `#{extra_package.name}` package: "\
|
||||
"#{existing_package.version}, #{extra_package.version}"
|
||||
"#{existing_package.version}, #{extra_package.version}"
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user