From 5304b70c922af0dbdd3c92db12a07c297283c807 Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Fri, 26 Jul 2024 05:41:57 -0700 Subject: [PATCH] rubocops/lines: remove existing npm audit --- Library/Homebrew/rubocops/lines.rb | 17 --------------- .../test/rubocops/text/miscellaneous_spec.rb | 21 ------------------- 2 files changed, 38 deletions(-) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 6ee6e38b12..7932991e3a 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -750,18 +750,6 @@ module RuboCop problem "Use ruby-macho instead of calling #{@offensive_node.source}" end - find_every_method_call_by_name(body_node, :system).each do |method_node| - # Skip Kibana: npm cache edge (see formula for more details) - next if @formula_name.match?(/^kibana(@\d[\d.]*)?$/) - - first_param, second_param = parameters(method_node) - next if !node_equals?(first_param, "npm") || - !node_equals?(second_param, "install") - - offending_node(method_node) - problem "Use Language::Node for npm install args" unless languageNodeModule?(method_node) - end - problem "Use new-style test definitions (test do)" if find_method_def(body_node, :test) find_method_with_args(body_node, :skip_clean, :all) do @@ -856,11 +844,6 @@ module RuboCop {(dstr (begin (send nil? %1)) $(str _ )) (dstr _ (begin (send nil? %1)) $(str _ ))} EOS - - # Node Pattern search for Language::Node - def_node_search :languageNodeModule?, <<~EOS - (const (const nil? :Language) :Node) - EOS end end diff --git a/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb b/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb index 03caec6d1f..baa6a32e6d 100644 --- a/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb +++ b/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb @@ -147,27 +147,6 @@ RSpec.describe RuboCop::Cop::FormulaAudit::Miscellaneous do RUBY end - it "reports an offense when `npm install` is called without Language::Node arguments" do - expect_offense(<<~RUBY) - class Foo < Formula - desc "foo" - url 'https://brew.sh/foo-1.0.tgz' - system "npm", "install" - ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use Language::Node for npm install args - end - RUBY - end - - it "reports no offenses when `npm install` is called without Language::Node arguments in an exempt formula" do - expect_no_offenses(<<~RUBY, "/homebrew-core/Formula/kibana@4.4.rb") - class KibanaAT44 < Formula - desc "foo" - url 'https://brew.sh/foo-1.0.tgz' - system "npm", "install" - end - RUBY - end - it "reports an offense when `depends_on` is called with an instance" do expect_offense(<<~RUBY) class Foo < Formula