Standardize livecheck block language formatting
This commit is contained in:
parent
01cb74e525
commit
79e20b3512
@ -4179,7 +4179,7 @@ class Formula
|
||||
end
|
||||
|
||||
# {Livecheck} can be used to check for newer versions of the software.
|
||||
# This method evaluates the DSL specified in the livecheck block of the
|
||||
# This method evaluates the DSL specified in the `livecheck` block of the
|
||||
# {Formula} (if it exists) and sets the instance variables of a {Livecheck}
|
||||
# object accordingly. This is used by `brew livecheck` to check for newer
|
||||
# versions of the software.
|
||||
|
||||
@ -37,7 +37,7 @@ class Livecheck
|
||||
# Sets the `@referenced_cask_name` instance variable to the provided `String`
|
||||
# or returns the `@referenced_cask_name` instance variable when no argument
|
||||
# is provided. Inherited livecheck values from the referenced cask
|
||||
# (e.g. regex) can be overridden in the livecheck block.
|
||||
# (e.g. regex) can be overridden in the `livecheck` block.
|
||||
sig {
|
||||
params(
|
||||
# Name of cask to inherit livecheck info from.
|
||||
@ -56,7 +56,7 @@ class Livecheck
|
||||
# Sets the `@referenced_formula_name` instance variable to the provided
|
||||
# `String` or returns the `@referenced_formula_name` instance variable when
|
||||
# no argument is provided. Inherited livecheck values from the referenced
|
||||
# formula (e.g. regex) can be overridden in the livecheck block.
|
||||
# formula (e.g. regex) can be overridden in the `livecheck` block.
|
||||
sig {
|
||||
params(
|
||||
# Name of formula to inherit livecheck info from.
|
||||
|
||||
@ -79,7 +79,7 @@ module Homebrew
|
||||
full_name: false,
|
||||
debug: false
|
||||
)
|
||||
# Check the livecheck block for a formula or cask reference
|
||||
# Check the `livecheck` block for a formula or cask reference
|
||||
livecheck = formula_or_cask.livecheck
|
||||
livecheck_formula = livecheck.formula
|
||||
livecheck_cask = livecheck.cask
|
||||
|
||||
@ -142,7 +142,7 @@ class Resource
|
||||
end
|
||||
|
||||
# {Livecheck} can be used to check for newer versions of the software.
|
||||
# This method evaluates the DSL specified in the livecheck block of the
|
||||
# This method evaluates the DSL specified in the `livecheck` block of the
|
||||
# {Resource} (if it exists) and sets the instance variables of a {Livecheck}
|
||||
# object accordingly. This is used by `brew livecheck` to check for newer
|
||||
# versions of the software.
|
||||
|
||||
@ -40,7 +40,8 @@ module RuboCop
|
||||
method_nodes.select(&:block_type?).each do |node|
|
||||
node.child_nodes.each do |child|
|
||||
child.each_node(:send) do |send_node|
|
||||
# Skip (nested) livecheck blocks as its `url` is different to a download `url`.
|
||||
# Skip (nested) `livecheck` block as its `url` is different
|
||||
# from a download `url`.
|
||||
next if send_node.method_name == :livecheck || inside_livecheck_defined?(send_node)
|
||||
# Skip string interpolations.
|
||||
if send_node.ancestors.drop_while { |a| !a.begin_type? }.any? { |a| a.dstr_type? || a.regexp_type? }
|
||||
|
||||
@ -508,13 +508,13 @@ RSpec.describe Cask::Audit, :cask do
|
||||
let(:online) { true }
|
||||
let(:message) { /Version '[^']*' differs from '[^']*' retrieved by livecheck\./ }
|
||||
|
||||
context "when the Cask has a livecheck block using skip" do
|
||||
context "when the Cask has a `livecheck` block using skip" do
|
||||
let(:cask_token) { "livecheck-skip" }
|
||||
|
||||
it { is_expected.not_to error_with(message) }
|
||||
end
|
||||
|
||||
context "when the Cask has a livecheck block referencing a Cask using skip" do
|
||||
context "when the Cask has a `livecheck` block referencing a Cask using skip" do
|
||||
let(:cask_token) { "livecheck-skip-reference" }
|
||||
|
||||
it { is_expected.not_to error_with(message) }
|
||||
@ -526,7 +526,7 @@ RSpec.describe Cask::Audit, :cask do
|
||||
it { is_expected.not_to error_with(message) }
|
||||
end
|
||||
|
||||
context "when the Cask has a livecheck block referencing a deprecated Cask" do
|
||||
context "when the Cask has a `livecheck` block referencing a deprecated Cask" do
|
||||
let(:cask_token) { "livecheck-deprecated-reference" }
|
||||
|
||||
it { is_expected.not_to error_with(message) }
|
||||
@ -538,7 +538,7 @@ RSpec.describe Cask::Audit, :cask do
|
||||
it { is_expected.not_to error_with(message) }
|
||||
end
|
||||
|
||||
context "when the Cask has a livecheck block referencing a disabled Cask" do
|
||||
context "when the Cask has a `livecheck` block referencing a disabled Cask" do
|
||||
let(:cask_token) { "livecheck-disabled-reference" }
|
||||
|
||||
it { is_expected.not_to error_with(message) }
|
||||
@ -550,7 +550,7 @@ RSpec.describe Cask::Audit, :cask do
|
||||
it { is_expected.not_to error_with(message) }
|
||||
end
|
||||
|
||||
context "when the Cask has a livecheck block referencing a Cask where version is :latest" do
|
||||
context "when the Cask has a `livecheck` block referencing a Cask where version is :latest" do
|
||||
let(:cask_token) { "livecheck-version-latest-reference" }
|
||||
|
||||
it { is_expected.not_to error_with(message) }
|
||||
@ -562,7 +562,7 @@ RSpec.describe Cask::Audit, :cask do
|
||||
it { is_expected.not_to error_with(message) }
|
||||
end
|
||||
|
||||
context "when the Cask has a livecheck block referencing a Cask with an unversioned url" do
|
||||
context "when the Cask has a `livecheck` block referencing a Cask with an unversioned url" do
|
||||
let(:cask_token) { "livecheck-url-unversioned-reference" }
|
||||
|
||||
it { is_expected.not_to error_with(message) }
|
||||
|
||||
@ -705,7 +705,7 @@ RSpec.describe Formula do
|
||||
end
|
||||
|
||||
describe "#livecheck_defined?" do
|
||||
specify "no livecheck block defined" do
|
||||
specify "no `livecheck` block defined" do
|
||||
f = formula do
|
||||
url "https://brew.sh/test-1.0.tbz"
|
||||
end
|
||||
@ -713,7 +713,7 @@ RSpec.describe Formula do
|
||||
expect(f.livecheck_defined?).to be false
|
||||
end
|
||||
|
||||
specify "livecheck block defined" do
|
||||
specify "`livecheck` block defined" do
|
||||
f = formula do
|
||||
url "https://brew.sh/test-1.0.tbz"
|
||||
livecheck do
|
||||
|
||||
@ -77,7 +77,7 @@ RSpec.describe Homebrew::Livecheck do
|
||||
end
|
||||
|
||||
describe "::resolve_livecheck_reference" do
|
||||
context "when a formula/cask has a livecheck block without formula/cask methods" do
|
||||
context "when a formula/cask has a `livecheck` block without formula/cask methods" do
|
||||
it "returns [nil, []]" do
|
||||
expect(livecheck.resolve_livecheck_reference(f)).to eq([nil, []])
|
||||
expect(livecheck.resolve_livecheck_reference(c)).to eq([nil, []])
|
||||
|
||||
@ -65,18 +65,18 @@ RSpec.describe Resource do
|
||||
end
|
||||
|
||||
describe "#livecheck" do
|
||||
specify "when livecheck block is set" do
|
||||
specify "when `livecheck` block is set" do
|
||||
expect(livecheck_resource.livecheck.url).to eq("https://brew.sh/test/releases")
|
||||
expect(livecheck_resource.livecheck.regex).to eq(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#livecheck_defined?" do
|
||||
it "returns false if livecheck block is not set in resource" do
|
||||
it "returns false if `livecheck` block is not set in resource" do
|
||||
expect(resource.livecheck_defined?).to be false
|
||||
end
|
||||
|
||||
specify "livecheck block defined in resources" do
|
||||
specify "`livecheck` block defined in resources" do
|
||||
expect(livecheck_resource.livecheck_defined?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,7 +5,7 @@ require "rubocops/livecheck"
|
||||
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckRegexParentheses do
|
||||
subject(:cop) { described_class.new }
|
||||
|
||||
it "reports an offense when the `regex` call in the livecheck block does not use parentheses" do
|
||||
it "reports an offense when the `regex` call in the `livecheck` block does not use parentheses" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
@ -30,7 +30,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckRegexParentheses do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "reports no offenses when the `regex` call in the livecheck block uses parentheses" do
|
||||
it "reports no offenses when the `regex` call in the `livecheck` block uses parentheses" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
@ -5,7 +5,7 @@ require "rubocops/livecheck"
|
||||
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckSkip do
|
||||
subject(:cop) { described_class.new }
|
||||
|
||||
it "reports an offense when a skipped formula's livecheck block contains other information" do
|
||||
it "reports an offense when a skipped formula's `livecheck` block contains other information" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
@ -29,7 +29,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckSkip do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "reports no offenses when a skipped formula's livecheck block contains no other information" do
|
||||
it "reports no offenses when a skipped formula's `livecheck` block contains no other information" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
@ -5,7 +5,7 @@ require "rubocops/livecheck"
|
||||
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckUrlProvided do
|
||||
subject(:cop) { described_class.new }
|
||||
|
||||
it "reports an offense when a `url` is not specified in a livecheck block" do
|
||||
it "reports an offense when a `url` is not specified in a `livecheck` block" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
@ -29,7 +29,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckUrlProvided do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "reports no offenses when a `url` and `regex` are specified in the livecheck block" do
|
||||
it "reports no offenses when a `url` and `regex` are specified in the `livecheck` block" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
@ -42,7 +42,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckUrlProvided do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "reports no offenses when a `url` and `strategy` are specified in the livecheck block" do
|
||||
it "reports no offenses when a `url` and `strategy` are specified in the `livecheck` block" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
@ -5,7 +5,7 @@ require "rubocops/livecheck"
|
||||
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckUrlSymbol do
|
||||
subject(:cop) { described_class.new }
|
||||
|
||||
it "reports an offense when the `url` specified in the livecheck block is identical to a formula URL" do
|
||||
it "reports an offense when the `url` specified in the `livecheck` block is identical to a formula URL" do
|
||||
expect_offense(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
@ -28,7 +28,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckUrlSymbol do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "reports no offenses when the `url` specified in the livecheck block is not identical to a formula URL" do
|
||||
it "reports no offenses when the `url` specified in the `livecheck` block is not identical to a formula URL" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
class Foo < Formula
|
||||
url "https://brew.sh/foo-1.0.tgz"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user