Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocops/lines: remove existing npm audit #17868

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading