components_order and test

This commit is contained in:
lionellloh 2020-06-30 23:18:04 +08:00
parent fb4db63e3b
commit 1422542a07
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@ module RuboCop
[{ name: :mirror, type: :method_call }], [{ name: :mirror, type: :method_call }],
[{ name: :version, type: :method_call }], [{ name: :version, type: :method_call }],
[{ name: :sha256, type: :method_call }], [{ name: :sha256, type: :method_call }],
[{ name: :license, type: :method_call }],
[{ name: :revision, type: :method_call }], [{ name: :revision, type: :method_call }],
[{ name: :version_scheme, type: :method_call }], [{ name: :version_scheme, type: :method_call }],
[{ name: :head, type: :method_call }], [{ name: :head, type: :method_call }],

View File

@ -19,6 +19,19 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
RUBY RUBY
end end
it "When license precedes sha256" do
expect_offense(<<~RUBY)
class Foo < Formula
homepage "https://brew.sh"
url "https://brew.sh/foo-1.0.tgz"
license "0BSD"
sha256 "samplesha256"
^^^^^^^^^^^^^^^^^^^^^ `sha256` (line 5) should be put before `license` (line 4)
end
RUBY
end
it "When `bottle` precedes `livecheck`" do it "When `bottle` precedes `livecheck`" do
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
class Foo < Formula class Foo < Formula