Class: RuboCop::Cop::Cask::HomepageMatchesUrl
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Cask::HomepageMatchesUrl
- Extended by:
- Forwardable
- Includes:
- CaskHelp
- Defined in:
- lib/rubocop/cop/cask/homepage_matches_url.rb
Overview
This cop checks that a cask’s homepage matches the download url, or if it doesn’t, checks if a comment in the form ‘# example.com was verified as official when first introduced to the cask` is present.
Constant Summary collapse
- REFERENCE_URL =
'https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment'.freeze
- COMMENT_FORMAT =
/# [^ ]+ was verified as official when first introduced to the cask/- MSG_NO_MATCH =
'`%<url>s` does not match `%<full_url>s`'.freeze
- MSG_MISSING =
'`%<domain>s` does not match `%<homepage>s`, a comment has to be added ' \ 'above the `url` stanza. For details, see ' + REFERENCE_URL
- MSG_WRONG_FORMAT =
'`%<comment>s` does not match the expected comment format. ' \ 'For details, see ' + REFERENCE_URL
- MSG_UNNECESSARY =
'`%<domain>s` matches `%<homepage>s`, the comment above the `url` ' \ 'stanza is unnecessary'.freeze
Instance Method Summary collapse
Methods included from CaskHelp
Instance Method Details
#on_cask(cask_block) ⇒ Object
30 31 32 33 34 |
# File 'lib/rubocop/cop/cask/homepage_matches_url.rb', line 30 def on_cask(cask_block) @cask_block = cask_block return unless homepage_stanza add_offenses end |