Merge branch 'mlh-outdated-packages' of github.com:MLH-Fellowship/brew into mlh-outdated-packages
This commit is contained in:
commit
4105df0c3f
@ -17,7 +17,7 @@ GEM
|
||||
term-ansicolor (~> 1.3)
|
||||
thor (>= 0.19.4, < 2.0)
|
||||
tins (~> 1.6)
|
||||
diff-lcs (1.4.2)
|
||||
diff-lcs (1.4.3)
|
||||
docile (1.3.2)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
|
||||
@ -553,6 +553,7 @@ module Homebrew
|
||||
THROTTLED_DENYLIST = {
|
||||
"aws-sdk-cpp" => "10",
|
||||
"awscli@1" => "10",
|
||||
"balena-cli" => "10",
|
||||
"quicktype" => "10",
|
||||
"vim" => "50",
|
||||
}.freeze
|
||||
|
||||
@ -226,11 +226,10 @@ module RuboCop
|
||||
next if succeeding_component.empty?
|
||||
|
||||
offensive_nodes = check_precedence(preceding_component, succeeding_component)
|
||||
break if offensive_nodes
|
||||
return [present_components, offensive_nodes] if offensive_nodes
|
||||
end
|
||||
end
|
||||
|
||||
[present_components, offensive_nodes]
|
||||
nil
|
||||
end
|
||||
|
||||
# Method to format message for reporting component precedence violations
|
||||
|
||||
@ -652,6 +652,7 @@ false:
|
||||
- ./test/rubocops/components_redundancy_spec.rb
|
||||
- ./test/rubocops/conflicts_spec.rb
|
||||
- ./test/rubocops/dependency_order_spec.rb
|
||||
- ./test/rubocops/deprecate_spec.rb
|
||||
- ./test/rubocops/formula_desc_spec.rb
|
||||
- ./test/rubocops/homepage_spec.rb
|
||||
- ./test/rubocops/lines_spec.rb
|
||||
@ -884,6 +885,7 @@ true:
|
||||
- ./rubocops/cask/ast/stanza.rb
|
||||
- ./rubocops/cask/constants/stanza.rb
|
||||
- ./rubocops/cask/extend/string.rb
|
||||
- ./rubocops/deprecate.rb
|
||||
- ./tap_constants.rb
|
||||
- ./test/support/helper/fixtures.rb
|
||||
- ./test/support/lib/config.rb
|
||||
|
||||
@ -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
|
||||
|
||||
@ -344,6 +344,28 @@ class RuboCop::AST::IfNode < ::RuboCop::AST::Node
|
||||
def unless?; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::IndexNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::ParameterizedNode)
|
||||
include(::RuboCop::AST::MethodIdentifierPredicates)
|
||||
include(::RuboCop::AST::MethodDispatchNode)
|
||||
|
||||
def arguments; end
|
||||
def assignment_method?; end
|
||||
def attribute_accessor?; end
|
||||
def method_name; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::IndexasgnNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::ParameterizedNode)
|
||||
include(::RuboCop::AST::MethodIdentifierPredicates)
|
||||
include(::RuboCop::AST::MethodDispatchNode)
|
||||
|
||||
def arguments; end
|
||||
def assignment_method?; end
|
||||
def attribute_accessor?; end
|
||||
def method_name; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::IntNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::NumericNode)
|
||||
end
|
||||
@ -359,6 +381,19 @@ end
|
||||
|
||||
RuboCop::AST::KeywordSplatNode::DOUBLE_SPLAT = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::AST::LambdaNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::ParameterizedNode)
|
||||
include(::RuboCop::AST::MethodIdentifierPredicates)
|
||||
include(::RuboCop::AST::MethodDispatchNode)
|
||||
|
||||
def arguments; end
|
||||
def assignment_method?; end
|
||||
def attribute_accessor?; end
|
||||
def lambda?; end
|
||||
def lambda_literal?; end
|
||||
def method_name; end
|
||||
end
|
||||
|
||||
module RuboCop::AST::MethodDispatchNode
|
||||
include(::RuboCop::AST::MethodIdentifierPredicates)
|
||||
extend(::RuboCop::AST::NodePattern::Macros)
|
||||
@ -409,9 +444,16 @@ module RuboCop::AST::MethodIdentifierPredicates
|
||||
def camel_case_method?; end
|
||||
def comparison_method?; end
|
||||
def const_receiver?; end
|
||||
def enumerable_method?; end
|
||||
def enumerator_method?; end
|
||||
def method?(name); end
|
||||
def negation_method?; end
|
||||
def nonmutating_array_method?; end
|
||||
def nonmutating_binary_operator_method?; end
|
||||
def nonmutating_hash_method?; end
|
||||
def nonmutating_operator_method?; end
|
||||
def nonmutating_string_method?; end
|
||||
def nonmutating_unary_operator_method?; end
|
||||
def operator_method?; end
|
||||
def predicate_method?; end
|
||||
def prefix_bang?; end
|
||||
@ -419,9 +461,23 @@ module RuboCop::AST::MethodIdentifierPredicates
|
||||
def self_receiver?; end
|
||||
end
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::ENUMERATOR_METHODS = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::AST::MethodIdentifierPredicates::ENUMERABLE_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::OPERATOR_METHODS = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::AST::MethodIdentifierPredicates::ENUMERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_ARRAY_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_BINARY_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_HASH_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_STRING_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_UNARY_OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::MethodIdentifierPredicates::OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
module RuboCop::AST::ModifierNode
|
||||
def modifier_form?; end
|
||||
@ -450,6 +506,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node
|
||||
def arg_type?; end
|
||||
def args_type?; end
|
||||
def argument?; end
|
||||
def argument_type?; end
|
||||
def array_pattern_type?; end
|
||||
def array_pattern_with_tail_type?; end
|
||||
def array_type?; end
|
||||
@ -506,9 +563,11 @@ class RuboCop::AST::Node < ::Parser::AST::Node
|
||||
def erange_type?; end
|
||||
def false_type?; end
|
||||
def falsey_literal?; end
|
||||
def find_pattern_type?; end
|
||||
def first_line; end
|
||||
def float_type?; end
|
||||
def for_type?; end
|
||||
def forward_arg_type?; end
|
||||
def forward_args_type?; end
|
||||
def forwarded_args_type?; end
|
||||
def guard_clause?; end
|
||||
@ -542,6 +601,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node
|
||||
def last_line; end
|
||||
def line_count; end
|
||||
def literal?; end
|
||||
def loop_keyword?; end
|
||||
def lvar_type?; end
|
||||
def lvasgn_type?; end
|
||||
def masgn_type?; end
|
||||
@ -582,6 +642,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node
|
||||
def parent_module_name; end
|
||||
def parenthesized_call?; end
|
||||
def pin_type?; end
|
||||
def post_condition_loop?; end
|
||||
def postexe_type?; end
|
||||
def preexe_type?; end
|
||||
def proc?(node = _); end
|
||||
@ -654,6 +715,8 @@ class RuboCop::AST::Node < ::Parser::AST::Node
|
||||
def while_until_value_used?; end
|
||||
end
|
||||
|
||||
RuboCop::AST::Node::ARGUMENT_TYPES = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::ASSIGNMENTS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::BASIC_CONDITIONALS = T.let(T.unsafe(nil), Array)
|
||||
@ -676,10 +739,14 @@ RuboCop::AST::Node::KEYWORDS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::LITERALS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::LOOP_TYPES = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::MUTABLE_LITERALS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::OPERATOR_KEYWORDS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::POST_CONDITION_LOOP_TYPES = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::REFERENCES = T.let(T.unsafe(nil), Array)
|
||||
|
||||
RuboCop::AST::Node::SHORTHAND_ASSIGNMENTS = T.let(T.unsafe(nil), Array)
|
||||
@ -697,7 +764,7 @@ class RuboCop::AST::NodePattern
|
||||
def eql?(other); end
|
||||
def marshal_dump; end
|
||||
def marshal_load(pattern); end
|
||||
def match(*args); end
|
||||
def match(*args, **rest); end
|
||||
def pattern; end
|
||||
def to_s; end
|
||||
|
||||
@ -708,12 +775,8 @@ class RuboCop::AST::NodePattern::Invalid < ::StandardError
|
||||
end
|
||||
|
||||
module RuboCop::AST::NodePattern::Macros
|
||||
def def_node_matcher(method_name, pattern_str); end
|
||||
def def_node_search(method_name, pattern_str); end
|
||||
def node_search(method_name, compiler, on_match, prelude, called_from); end
|
||||
def node_search_all(method_name, compiler, called_from); end
|
||||
def node_search_body(method_name, trailing_params, prelude, match_code, on_match); end
|
||||
def node_search_first(method_name, compiler, called_from); end
|
||||
def def_node_matcher(method_name, pattern_str, **keyword_defaults); end
|
||||
def def_node_search(method_name, pattern_str, **keyword_defaults); end
|
||||
end
|
||||
|
||||
module RuboCop::AST::NumericNode
|
||||
@ -825,8 +888,22 @@ end
|
||||
|
||||
class RuboCop::AST::RegexpNode < ::RuboCop::AST::Node
|
||||
def content; end
|
||||
def delimiter?(char); end
|
||||
def delimiters; end
|
||||
def extended?; end
|
||||
def ignore_case?; end
|
||||
def interpolation?; end
|
||||
def multiline_mode?; end
|
||||
def no_encoding?; end
|
||||
def percent_r_literal?; end
|
||||
def regopt; end
|
||||
def single_interpolation?; end
|
||||
def slash_literal?; end
|
||||
def to_regexp; end
|
||||
|
||||
private
|
||||
|
||||
def regopt_include?(option); end
|
||||
end
|
||||
|
||||
RuboCop::AST::RegexpNode::OPTIONS = T.let(T.unsafe(nil), Hash)
|
||||
@ -920,6 +997,7 @@ class RuboCop::AST::Token
|
||||
end
|
||||
|
||||
module RuboCop::AST::Traversal
|
||||
def on___ENCODING__(node); end
|
||||
def on_alias(node); end
|
||||
def on_and(node); end
|
||||
def on_and_asgn(node); end
|
||||
@ -958,6 +1036,7 @@ module RuboCop::AST::Traversal
|
||||
def on_false(node); end
|
||||
def on_float(node); end
|
||||
def on_for(node); end
|
||||
def on_forward_arg(node); end
|
||||
def on_forward_args(node); end
|
||||
def on_forwarded_args(node); end
|
||||
def on_gvar(node); end
|
||||
@ -969,6 +1048,8 @@ module RuboCop::AST::Traversal
|
||||
def on_iflipflop(node); end
|
||||
def on_in_match(node); end
|
||||
def on_in_pattern(node); end
|
||||
def on_index(node); end
|
||||
def on_indexasgn(node); end
|
||||
def on_int(node); end
|
||||
def on_irange(node); end
|
||||
def on_ivar(node); end
|
||||
@ -1005,6 +1086,7 @@ module RuboCop::AST::Traversal
|
||||
def on_pin(node); end
|
||||
def on_postexe(node); end
|
||||
def on_preexe(node); end
|
||||
def on_procarg0(node); end
|
||||
def on_rational(node); end
|
||||
def on_redo(node); end
|
||||
def on_regexp(node); end
|
||||
@ -1095,6 +1177,8 @@ RuboCop::AST::NodePattern::Compiler::CAPTURED_REST = T.let(T.unsafe(nil), String
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::CLOSING = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::CONST = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::CUR_ELEMENT = T.let(T.unsafe(nil), String)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::CUR_NODE = T.let(T.unsafe(nil), String)
|
||||
@ -1105,6 +1189,10 @@ RuboCop::AST::NodePattern::Compiler::FUNCALL = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::IDENTIFIER = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::KEYWORD = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::KEYWORD_NAME = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::LITERAL = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::META = T.let(T.unsafe(nil), Regexp)
|
||||
@ -1117,6 +1205,8 @@ RuboCop::AST::NodePattern::Compiler::NUMBER = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::PARAM = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::PARAM_CONST = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::PARAM_NUMBER = T.let(T.unsafe(nil), Regexp)
|
||||
|
||||
RuboCop::AST::NodePattern::Compiler::PREDICATE = T.let(T.unsafe(nil), Regexp)
|
||||
@ -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
|
||||
|
||||
@ -19429,10 +19429,6 @@ class RuboCop::AST::Node
|
||||
|
||||
def cask_block?(node=T.unsafe(nil)); end
|
||||
|
||||
def find_pattern_type?(); end
|
||||
|
||||
def forward_arg_type?(); end
|
||||
|
||||
def key_node(node=T.unsafe(nil)); end
|
||||
|
||||
def method_node(node=T.unsafe(nil)); end
|
||||
@ -19604,6 +19600,10 @@ class RuboCop::Cop::FormulaAudit::Miscellaneous
|
||||
def languageNodeModule?(node0); end
|
||||
end
|
||||
|
||||
class RuboCop::Cop::FormulaAudit::Patches
|
||||
def patch_data?(node0); end
|
||||
end
|
||||
|
||||
class RuboCop::Cop::FormulaAudit::Test
|
||||
def test_calls(node0); end
|
||||
end
|
||||
|
||||
@ -77,6 +77,37 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "When `install` precedes `depends_on`" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
def install
|
||||
end
|
||||
|
||||
depends_on "openssl"
|
||||
^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 7) should be put before `install` (line 4)
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "When `test` precedes `depends_on`" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
def install
|
||||
end
|
||||
|
||||
def test
|
||||
end
|
||||
|
||||
depends_on "openssl"
|
||||
^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 10) should be put before `install` (line 4)
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "When only one of many `depends_on` precedes `conflicts_with`" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
|
||||
27
Library/Homebrew/utils/livecheck.rb
Normal file
27
Library/Homebrew/utils/livecheck.rb
Normal file
@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "open3"
|
||||
|
||||
module Livecheck
|
||||
def livecheck_formula_response(formula_name)
|
||||
puts "- livecheck formula : #{formula_name}"
|
||||
command_args = [
|
||||
"brew",
|
||||
"livecheck",
|
||||
formula_name,
|
||||
"--quiet"
|
||||
]
|
||||
|
||||
response = Open3.capture2e(*command_args)
|
||||
parse_livecheck_response(response)
|
||||
end
|
||||
|
||||
def parse_livecheck_response(response)
|
||||
output = response.first.gsub(' ', '').split(/:|==>|\n/)
|
||||
|
||||
# eg: ["burp", "2.2.18", "2.2.18"]
|
||||
package_name, brew_version, latest_version = output
|
||||
|
||||
{'name' => package_name, 'current_brew_version' => brew_version, 'livecheck_latest_version' => latest_version}
|
||||
end
|
||||
end
|
||||
@ -25,6 +25,16 @@ module RepologyParser
|
||||
puts "\n- Paginating repology api page: #{page_no}"
|
||||
|
||||
outdated_packages = query_repology_api("")
|
||||
<<<<<<< HEAD
|
||||
last_package_index = outdated_packages.size - 1
|
||||
response_size = outdated_packages.size
|
||||
|
||||
while response_size > 1 do
|
||||
page_no += 1
|
||||
puts "\n- Paginating repology api page: #{page_no}"
|
||||
|
||||
last_package_in_response = outdated_packages.keys[last_package_index]
|
||||
=======
|
||||
last_pacakge_index = outdated_packages.size - 1
|
||||
response_size = outdated_packages.size
|
||||
|
||||
@ -33,10 +43,47 @@ module RepologyParser
|
||||
puts "\n- Paginating repology api page: #{page_no}"
|
||||
|
||||
last_package_in_response = outdated_packages.keys[last_pacakge_index]
|
||||
>>>>>>> 14d63f61a5d3c5ca41d89c670a4bd58cab84aa6c
|
||||
response = query_repology_api("#{last_package_in_response}/")
|
||||
|
||||
response_size = response.size
|
||||
outdated_packages.merge!(response)
|
||||
<<<<<<< HEAD
|
||||
last_package_index = outdated_packages.size - 1
|
||||
end
|
||||
|
||||
puts "\n- #{outdated_packages.size} outdated packages identified"
|
||||
|
||||
outdated_packages
|
||||
end
|
||||
|
||||
def validate__repology_packages(outdated_repology_packages, brew_formulas)
|
||||
puts "\n---- Verify Outdated Repology Packages as Homebrew Formulae -----"
|
||||
|
||||
packages = {}
|
||||
|
||||
outdated_repology_packages.each do |name, repositories|
|
||||
# identify homebrew repo
|
||||
repology_homebrew_repo = repositories.select do
|
||||
|repo| repo['repo'] == 'homebrew'
|
||||
end.first
|
||||
|
||||
next if repology_homebrew_repo.empty?
|
||||
latest_version = nil
|
||||
|
||||
#identify latest version amongst repology repos
|
||||
repositories.each do |repo|
|
||||
latest_version = repo['version'] if repo['status'] == 'newest'
|
||||
end
|
||||
|
||||
packages[repology_homebrew_repo['srcname']] = {
|
||||
'repology_latest_version' => latest_version,
|
||||
}
|
||||
end
|
||||
# hash of hashes {'openclonk' => {repology_latest_version => 7.0}, ..}
|
||||
packages
|
||||
end
|
||||
=======
|
||||
last_pacakge_index = outdated_packages.size - 1
|
||||
end
|
||||
|
||||
@ -44,4 +91,5 @@ module RepologyParser
|
||||
|
||||
outdated_packages
|
||||
end
|
||||
>>>>>>> 14d63f61a5d3c5ca41d89c670a4bd58cab84aa6c
|
||||
end
|
||||
|
||||
36
Library/Homebrew/utils/versions.rb
Normal file
36
Library/Homebrew/utils/versions.rb
Normal file
@ -0,0 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "open3"
|
||||
require "formula"
|
||||
|
||||
module Versions
|
||||
def current_formula_version(formula_name)
|
||||
Formula[formula_name].version.to_s.to_f
|
||||
end
|
||||
|
||||
def bump_formula_pr(formula_name, url)
|
||||
command_args = [
|
||||
"brew",
|
||||
"bump-formula-pr",
|
||||
"--no-browse",
|
||||
"--dry-run",
|
||||
formula_name,
|
||||
"--url=#{url}",
|
||||
]
|
||||
|
||||
response = Open3.capture2e(*command_args)
|
||||
parse_formula_bump_response(response)
|
||||
end
|
||||
|
||||
def parse_formula_bump_response(response)
|
||||
response, status = formula_bump_response
|
||||
response
|
||||
end
|
||||
|
||||
def check_for_open_pr(formula_name, download_url)
|
||||
puts "- Checking for open PRs for formula : #{formula_name}"
|
||||
|
||||
response = bump_formula_pr(formula_name, download_url)
|
||||
!response.include? 'Error: These open pull requests may be duplicates'
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user