Skip to content
Snippets Groups Projects
Unverified Commit a4f9a664 authored by nandahkrishna's avatar nandahkrishna
Browse files

livecheck: add component order rubocop

parent 56f0308f
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment