audit: unnecessary comments from external taps
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
7239b3099a
commit
9634041f82
@ -64,6 +64,15 @@ module RuboCop
|
||||
|
||||
problem "Commented-out dependency #{Regexp.last_match(1)}"
|
||||
end
|
||||
|
||||
return if formula_tap != "homebrew-core"
|
||||
|
||||
# Citation and tag comments from third-party taps
|
||||
audit_comments do |comment|
|
||||
next if comment !~ /#\s*(cite(?=\s*\w+:)|doi(?=\s*['"])|tag(?=\s*['"]))/
|
||||
|
||||
problem "Formulae in homebrew/core should not use `#{Regexp.last_match(1)}` comments"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -106,6 +106,21 @@ describe RuboCop::Cop::FormulaAudit::Comments do
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "citation tags" do
|
||||
expect_offense(<<~RUBY, "/homebrew-core/")
|
||||
class Foo < Formula
|
||||
desc "foo"
|
||||
url 'https://brew.sh/foo-1.0.tgz'
|
||||
# cite Howell_2009:
|
||||
^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `cite` comments
|
||||
# doi "10.111/222.x"
|
||||
^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `doi` comments
|
||||
# tag "software"
|
||||
^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `tag` comments
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user