livecheck: add component order rubocop
This commit is contained in:
parent
56f0308fe7
commit
a4f9a66406
@ -23,6 +23,7 @@ module RuboCop
|
||||
[{ name: :version_scheme, type: :method_call }],
|
||||
[{ name: :head, type: :method_call }],
|
||||
[{ name: :stable, type: :block_call }],
|
||||
[{ name: :livecheck, type: :block_call }],
|
||||
[{ name: :bottle, type: :block_call }],
|
||||
[{ name: :pour_bottle?, type: :block_call }],
|
||||
[{ name: :devel, type: :block_call }],
|
||||
|
||||
@ -19,6 +19,23 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "When `bottle` precedes `livecheck`" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
homepage "https://brew.sh"
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
bottle :unneeded
|
||||
|
||||
livecheck do
|
||||
^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5)
|
||||
url "https://brew.sh/foo/versions/"
|
||||
regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/)
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "When url precedes homepage" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user