Skip to content

Commit

Permalink
Merge pull request #17868 from branchvincent/npm_audit
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid authored Jul 26, 2024
2 parents 95e30ee + 5304b70 commit e1b4f8c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
17 changes: 0 additions & 17 deletions Library/Homebrew/rubocops/lines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -750,18 +750,6 @@ def audit_formula(formula_nodes)
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
Expand Down Expand Up @@ -856,11 +844,6 @@ def modifier?(node)
{(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

Expand Down
21 changes: 0 additions & 21 deletions Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,6 @@ class Foo < Formula
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/[email protected]")
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
Expand Down

0 comments on commit e1b4f8c

Please sign in to comment.