Merge remote-tracking branch 'origin/master' into license-forbidden

This commit is contained in:
Lionell 2020-07-09 00:05:23 +08:00
commit 55878cab99
13 changed files with 707 additions and 211 deletions

50
.github/workflows/doctor.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: brew doctor
on:
pull_request:
paths:
- .github/workflows/doctor.yml
- Library/Homebrew/cmd/doctor.rb
- Library/Homebrew/diagnostic.rb
- Library/Homebrew/extend/os/diagnostic.rb
- Library/Homebrew/extend/os/mac/diagnostic.rb
- Library/Homebrew/os/mac/xcode.rb
jobs:
tests:
strategy:
matrix:
version: [10.15, 10.14, 10.13]
fail-fast: false
runs-on: ${{ matrix.version }}
env:
PATH: '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- name: Update Homebrew
run: brew update-reset
- name: Set up Git repository
run: |
cd $(brew --repo)
git clean -ffdx
git fetch --prune --force origin master
git fetch --prune --force origin ${{github.sha}}
git checkout --force ${{github.sha}}
git log -1
- name: Run brew test-bot --only-cleanup-before
run: brew test-bot --only-cleanup-before
- name: Run brew test-bot --only-setup
run: brew test-bot --only-setup
- name: Run brew test-bot --only-cleanup-after
if: always()
run: brew test-bot --only-cleanup-after
- name: Cleanup
if: always()
run: |
find .
rm -rf *

View File

@ -62,12 +62,12 @@ jobs:
- name: Run brew doctor
run: |
# minimally fix brew doctor failures (a full clean takes ~5m)
if [ "$RUNNER_OS" = "Linux" ]; then
# Cleanup some Linux `brew doctor` failures
sudo rm -rf /usr/local/include/node/
else
# Link old gettext (otherwise `brew doctor` is sad)
brew link gettext
# link old formulae
brew link --overwrite --force gettext python@3.8
# remove deleted formula
brew uninstall --force python@2

2
.gitignore vendored
View File

@ -85,6 +85,7 @@
**/vendor/bundle/ruby/*/gems/bundler-*/
**/vendor/bundle/ruby/*/gems/byebug-*/
**/vendor/bundle/ruby/*/gems/coderay-*/
**/vendor/bundle/ruby/*/gems/colorize-*/
**/vendor/bundle/ruby/*/gems/connection_pool-*/
**/vendor/bundle/ruby/*/gems/codecov-*/
**/vendor/bundle/ruby/*/gems/diff-lcs-*/
@ -129,7 +130,6 @@
**/vendor/bundle/ruby/*/gems/simplecov-*/
**/vendor/bundle/ruby/*/gems/simplecov-html-*/
**/vendor/bundle/ruby/*/gems/thor-*/
**/vendor/bundle/ruby/*/gems/url-*/
**/vendor/bundle/ruby/*/gems/unf_ext-*/
**/vendor/bundle/ruby/*/gems/unf-*/
**/vendor/bundle/ruby/*/gems/unicode-display_width-*/

View File

@ -9,10 +9,11 @@ GEM
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.1)
byebug (11.1.3)
codecov (0.1.17)
codecov (0.1.19)
colorize
json
simplecov
url
colorize (0.8.1)
concurrent-ruby (1.1.6)
connection_pool (2.2.3)
diff-lcs (1.4.4)
@ -80,7 +81,7 @@ GEM
rspec-support (3.9.3)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (0.87.0)
rubocop (0.87.1)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
@ -108,7 +109,6 @@ GEM
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
url (0.3.2)
webrobots (0.1.2)
zeitwerk (2.3.1)

View File

@ -1,11 +1,11 @@
# frozen_string_literal: true
PYTHON_VIRTUALENV_URL =
"https://files.pythonhosted.org/packages/11/74" \
"/2c151a13ef41ab9fb43b3c4ff9e788e0496ed7923b2078d42cab30622bdf" \
"/virtualenv-16.7.4.tar.gz"
"https://files.pythonhosted.org/packages/c4/1b" \
"/09bb751c6e805bf4711bbaead5499c8d8caf92398ba8da92daa8bf19f60e" \
"/virtualenv-20.0.26.tar.gz"
PYTHON_VIRTUALENV_SHA256 =
"94a6898293d07f84a98add34c4df900f8ec64a570292279f6d91c781d37fd305"
"e10cc66f40cbda459720dfe1d334c4dc15add0d80f09108224f171006a97a172"
PYTHON_VIRTUALENV_URL_MOJAVE =
"https://files.pythonhosted.org/packages/b1/72" \

View File

@ -15,11 +15,40 @@ module RuboCop
bash-completion@2
].freeze
def audit_formula(_node, _class_node, _parent_class_node, body)
def audit_formula(_node, _class_node, _parent_class_node, body_node)
find_method_calls_by_name(body_node, :conflicts_with).each do |conflicts_with_call|
next unless parameters(conflicts_with_call).last.respond_to? :values
reason = parameters(conflicts_with_call).last.values.first
offending_node(reason)
name = Regexp.new(@formula_name, Regexp::IGNORECASE)
reason = string_content(reason).sub(name, "")
first_word = reason.split.first
if reason.match?(/\A[A-Z]/)
problem "'#{first_word}' from the `conflicts_with` reason should be '#{first_word.downcase}'."
end
problem "`conflicts_with` reason should not end with a period." if reason.end_with?(".")
end
return unless versioned_formula?
problem MSG if !ALLOWLIST.include?(@formula_name) &&
method_called_ever?(body, :conflicts_with)
method_called_ever?(body_node, :conflicts_with)
end
def autocorrect(node)
lambda do |corrector|
if versioned_formula?
corrector.replace(node.source_range, "keg_only :versioned_formula")
else
reason = string_content(node)
reason[0] = reason[0].downcase
reason = reason.delete_suffix(".")
corrector.replace(node.source_range, "\"#{reason}\"")
end
end
end
end
end

View File

@ -163,6 +163,7 @@ false:
- ./dev-cmd/release-notes.rb
- ./dev-cmd/ruby.rb
- ./dev-cmd/sh.rb
- ./dev-cmd/sponsors.rb
- ./dev-cmd/style.rb
- ./dev-cmd/tap-new.rb
- ./dev-cmd/test.rb
@ -603,6 +604,7 @@ false:
- ./test/dev-cmd/release-notes_spec.rb
- ./test/dev-cmd/ruby_spec.rb
- ./test/dev-cmd/sh_spec.rb
- ./test/dev-cmd/sponsors_spec.rb
- ./test/dev-cmd/style_spec.rb
- ./test/dev-cmd/tap-new_spec.rb
- ./test/dev-cmd/test_spec.rb

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true
@ -12,6 +12,24 @@ end
module RuboCop::Cop::Performance
end
class RuboCop::Cop::Performance::AncestorsInclude < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
def ancestors_include_candidate?(node = _); end
def autocorrect(node); end
def on_send(node); end
end
RuboCop::Cop::Performance::AncestorsInclude::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::BigDecimalWithNumericArgument < ::RuboCop::Cop::Cop
def autocorrect(node); end
def big_decimal_with_numeric_argument?(node = _); end
def on_send(node); end
end
RuboCop::Cop::Performance::BigDecimalWithNumericArgument::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::BindCall < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
extend(::RuboCop::Cop::TargetRubyVersion)
@ -256,6 +274,29 @@ class RuboCop::Cop::Performance::InefficientHashSearch < ::RuboCop::Cop::Cop
def use_long_method; end
end
class RuboCop::Cop::Performance::IoReadlines < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
def autocorrect(node); end
def on_send(node); end
def readlines_on_class?(node = _); end
def readlines_on_instance?(node = _); end
private
def build_bad_method(enumerable_call); end
def build_call_args(call_args_node); end
def build_good_method(enumerable_call); end
def correction_range(enumerable_call, readlines_call); end
def enumerable_method?(node); end
def offense(node, enumerable_call, readlines_call); end
def offense_range(enumerable_call, readlines_call); end
end
RuboCop::Cop::Performance::IoReadlines::ENUMERABLE_METHODS = T.let(T.unsafe(nil), Array)
RuboCop::Cop::Performance::IoReadlines::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::OpenStruct < ::RuboCop::Cop::Cop
def on_send(node); end
def open_struct(node = _); end
@ -349,6 +390,42 @@ RuboCop::Cop::Performance::RedundantMerge::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Performance::RedundantMerge::WITH_MODIFIER_CORRECTION = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::RedundantSortBlock < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
include(::RuboCop::Cop::SortBlock)
def autocorrect(node); end
def on_block(node); end
private
def message(var_a, var_b); end
end
RuboCop::Cop::Performance::RedundantSortBlock::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::RedundantStringChars < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
def autocorrect(node); end
def on_send(node); end
def redundant_chars_call?(node = _); end
private
def build_bad_method(method, args); end
def build_call_args(call_args_node); end
def build_good_method(method, args); end
def build_message(method, args); end
def correction_range(receiver, node); end
def offense_range(receiver, node); end
def replaceable_method?(method_name); end
end
RuboCop::Cop::Performance::RedundantStringChars::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Performance::RedundantStringChars::REPLACEABLE_METHODS = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::Performance::RegexpMatch < ::RuboCop::Cop::Cop
def autocorrect(node); end
def last_matches(node0); end
@ -398,21 +475,61 @@ RuboCop::Cop::Performance::ReverseEach::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Performance::ReverseEach::UNDERSCORE = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::Size < ::RuboCop::Cop::Cop
class RuboCop::Cop::Performance::ReverseFirst < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
def autocorrect(node); end
def on_send(node); end
def reverse_first_candidate?(node = _); end
private
def allowed_parent?(node); end
def array?(node); end
def eligible_node?(node); end
def eligible_receiver?(node); end
def hash?(node); end
def build_bad_method(node); end
def build_good_method(node); end
def build_message(node); end
def correction_range(receiver, node); end
end
RuboCop::Cop::Performance::ReverseFirst::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::Size < ::RuboCop::Cop::Cop
def array?(node = _); end
def autocorrect(node); end
def count?(node = _); end
def hash?(node = _); end
def on_send(node); end
end
RuboCop::Cop::Performance::Size::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::SortReverse < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
include(::RuboCop::Cop::SortBlock)
def autocorrect(node); end
def on_block(node); end
private
def message(var_a, var_b); end
end
RuboCop::Cop::Performance::SortReverse::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::Squeeze < ::RuboCop::Cop::Cop
def autocorrect(node); end
def on_send(node); end
def squeeze_candidate?(node = _); end
private
def repeating_literal?(regex_str); end
end
RuboCop::Cop::Performance::Squeeze::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Performance::Squeeze::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash)
class RuboCop::Cop::Performance::StartWith < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RegexpMetacharacter)
@ -424,6 +541,19 @@ end
RuboCop::Cop::Performance::StartWith::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::StringInclude < ::RuboCop::Cop::Cop
def autocorrect(node); end
def on_match_with_lvasgn(node); end
def on_send(node); end
def redundant_regex?(node = _); end
private
def literal?(regex_str); end
end
RuboCop::Cop::Performance::StringInclude::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::Performance::StringReplacement < ::RuboCop::Cop::Cop
include(::RuboCop::Cop::RangeHelp)
@ -504,6 +634,18 @@ module RuboCop::Cop::RegexpMetacharacter
def safe_multiline?; end
end
module RuboCop::Cop::SortBlock
include(::RuboCop::Cop::RangeHelp)
extend(::RuboCop::AST::NodePattern::Macros)
def replaceable_body?(node = _, param1, param2); end
def sort_with_block?(node = _); end
private
def sort_range(send, node); end
end
RuboCop::NodePattern = RuboCop::AST::NodePattern
module RuboCop::Performance

View File

@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# tapioca sync
# tapioca sync --exclude json
# typed: true
@ -225,7 +225,6 @@ class RuboCop::Cop::RSpec::DescribeClass < ::RuboCop::Cop::RSpec::Cop
def describe_with_rails_metadata?(node = _); end
def on_top_level_describe(node, _); end
def rails_metadata?(node = _); end
def shared_group?(node = _); end
def valid_describe?(node = _); end
private
@ -528,7 +527,7 @@ end
class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::Cop::RSpec::Cop
def association?(node = _); end
def autocorrect(node); end
def factory_attributes(node0); end
def factory_attributes(node = _); end
def on_block(node); end
def value_matcher(node = _); end
@ -773,12 +772,13 @@ end
RuboCop::Cop::RSpec::InstanceSpy::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::InstanceVariable < ::RuboCop::Cop::RSpec::Cop
include(::RuboCop::RSpec::TopLevelGroup)
def custom_matcher?(node = _); end
def dynamic_class?(node = _); end
def ivar_assigned?(node0, param1); end
def ivar_usage(node0); end
def on_block(node); end
def spec_group?(node = _); end
def on_top_level_group(node); end
private
@ -786,8 +786,6 @@ class RuboCop::Cop::RSpec::InstanceVariable < ::RuboCop::Cop::RSpec::Cop
def valid_usage?(node); end
end
RuboCop::Cop::RSpec::InstanceVariable::EXAMPLE_GROUP_METHODS = T.let(T.unsafe(nil), RuboCop::RSpec::Language::SelectorSet)
RuboCop::Cop::RSpec::InstanceVariable::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::InvalidPredicateMatcher < ::RuboCop::Cop::RSpec::Cop
@ -844,7 +842,6 @@ end
RuboCop::Cop::RSpec::LeadingSubject::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::LeakyConstantDeclaration < ::RuboCop::Cop::RSpec::Cop
def in_example_or_shared_group?(node = _); end
def on_casgn(node); end
def on_class(node); end
def on_module(node); end
@ -875,12 +872,14 @@ end
RuboCop::Cop::RSpec::LetBeforeExamples::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::LetSetup < ::RuboCop::Cop::RSpec::Cop
def let_bang(node0); end
def example_or_shared_group_or_including?(node = _); end
def let_bang(node = _); end
def method_called?(node0, param1); end
def on_block(node); end
private
def child_let_bang(node, &block); end
def unused_let_bang(node); end
end
@ -993,12 +992,11 @@ class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Cop
include(::RuboCop::Cop::ConfigurableMax)
include(::RuboCop::RSpec::TopLevelDescribe)
def find_contexts(node0); end
def on_top_level_describe(node, _args); end
private
def find_nested_contexts(node, nesting: _, &block); end
def find_nested_example_groups(node, nesting: _, &block); end
def max_nesting; end
def max_nesting_config; end
def message(nesting); end
@ -1157,6 +1155,7 @@ class RuboCop::Cop::RSpec::ReturnFromStub < ::RuboCop::Cop::RSpec::Cop
def contains_stub?(node0); end
def on_block(node); end
def on_send(node); end
def stub_with_block?(node = _); end
private
@ -1280,16 +1279,17 @@ end
RuboCop::Cop::RSpec::SingleArgumentMessageChain::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::SubjectStub < ::RuboCop::Cop::RSpec::Cop
include(::RuboCop::RSpec::TopLevelGroup)
def message_expectation?(node = _, param1); end
def message_expectation_matcher?(node0); end
def on_block(node); end
def on_top_level_group(node); end
def subject(node = _); end
private
def find_all_explicit_subjects(node); end
def find_subject_expectations(node, subject_names = _, &block); end
def processed_example_groups; end
end
RuboCop::Cop::RSpec::SubjectStub::MSG = T.let(T.unsafe(nil), String)
@ -1467,17 +1467,14 @@ end
class RuboCop::RSpec::ExampleGroup < ::RuboCop::RSpec::Concept
def examples; end
def hooks; end
def lets; end
def scope_change?(node = _); end
def subjects; end
private
def examples_in_scope(node, &blk); end
def find_examples(node); end
def find_hooks(node); end
def find_subjects(node); end
def hooks_in_scope(node); end
def subjects_in_scope(node); end
def find_all(node, predicate); end
def find_all_in_scope(node, predicate); end
end
module RuboCop::RSpec::FactoryBot
@ -1576,6 +1573,8 @@ module RuboCop::RSpec::Language::NodePattern
def example_group_with_body?(node = _); end
def hook?(node = _); end
def let?(node = _); end
def shared_group?(node = _); end
def spec_group?(node = _); end
def subject?(node = _); end
end
@ -1636,6 +1635,21 @@ module RuboCop::RSpec::TopLevelDescribe
def top_level_nodes; end
end
module RuboCop::RSpec::TopLevelGroup
include(::RuboCop::RSpec::Language)
extend(::RuboCop::AST::NodePattern::Macros)
def example_or_shared_group?(node = _); end
def on_block(node); end
private
def root_node; end
def top_level_group?(node); end
def top_level_groups; end
def top_level_nodes; end
end
module RuboCop::RSpec::Variable
include(::RuboCop::RSpec::Language)
extend(::RuboCop::AST::NodePattern::Macros)

View File

@ -5819,6 +5819,10 @@ class Cask::DSL::Container
def nested=(nested); end
def pairs(); end
def pairs=(pairs); end
def type(); end
def type=(type); end
@ -19436,7 +19440,7 @@ module RuboCop::RSpec::ExpectOffense
def expect_no_offenses(source, file=T.unsafe(nil)); end
def expect_offense(source, file=T.unsafe(nil), **replacements); end
def expect_offense(source, file=T.unsafe(nil), severity: T.unsafe(nil), **replacements); end
def format_offense(source, **replacements); end
end
@ -23216,6 +23220,8 @@ class URL
def scheme=(scheme); end
def specs(); end
def string(); end
def subdomain(); end
@ -23234,6 +23240,8 @@ class URL
def trust_cert(); end
def uri(); end
def user_agent(); end
def using(); end

View File

@ -5,14 +5,34 @@ require "rubocops/conflicts"
describe RuboCop::Cop::FormulaAudit::Conflicts do
subject(:cop) { described_class.new }
context "When auditing formula for conflicts with" do
it "multiple conflicts_with" do
context "When auditing conflicts_with" do
it "conflicts_with reason is capitalized" do
expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", :because => "Reason"
^^^^^^^^ 'Reason' from the `conflicts_with` reason should be 'reason'.
conflicts_with "baz", :because => "Foo is the formula name which does not require downcasing"
end
RUBY
end
it "conflicts_with reason ends with a period" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", "baz", :because => "reason."
^^^^^^^^^ `conflicts_with` reason should not end with a period.
end
RUBY
end
it "conflicts_with in a versioned formula" do
expect_offense(<<~RUBY, "/homebrew-core/Formula/foo@2.0.rb")
class FooAT20 < Formula
url 'https://brew.sh/foo-2.0.tgz'
conflicts_with "mysql", "mariadb", "percona-server",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead.
:because => "both install plugins"
conflicts_with "mysql", "mariadb"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead.
end
RUBY
end
@ -21,10 +41,48 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do
expect_no_offenses(<<~RUBY, "/homebrew-core/Formula/foo@2.0.rb")
class FooAT20 < Formula
url 'https://brew.sh/foo-2.0.tgz'
desc 'Bar'
homepage "https://brew.sh"
end
RUBY
end
it "auto-corrects capitalized reason" do
source = <<~RUBY
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", :because => "Reason"
end
RUBY
corrected_source = <<~RUBY
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", :because => "reason"
end
RUBY
new_source = autocorrect_source(source)
expect(new_source).to eq(corrected_source)
end
it "auto-corrects trailing period" do
source = <<~RUBY
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", :because => "reason."
end
RUBY
corrected_source = <<~RUBY
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
conflicts_with "bar", :because => "reason"
end
RUBY
new_source = autocorrect_source(source)
expect(new_source).to eq(corrected_source)
end
end
include_examples "formulae exist", described_class::ALLOWLIST