rubocop-cask 0.15.1 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6b59dbdf77871dfb415f6c6b82a839adf420ef2
4
- data.tar.gz: 6272d48c52239336dfb184841a762def030aa4ed
3
+ metadata.gz: 2ac6a5d268b98862401e58b0085e4efa060c0583
4
+ data.tar.gz: 566a249832eabe03dd177f584915918a076c87d3
5
5
  SHA512:
6
- metadata.gz: d1613b3809074f0ac320b6dc6ae492d4d0a876111bc5bc4dbb342d531114fe66fcf4e813c1917e1bb17583afd26f689496d0bc429efc796aea9ffb73db648de4
7
- data.tar.gz: 267fb175ad3f454167720ffa8b9ea9ca71d84f14e8ddeb36433e6d60122557e3613be67a5275a52760b22e7af93bdd09ecc610bb762d3ffc4ad1a109c76a600d
6
+ metadata.gz: d2e4d8eacaf06880cd78e9889b2f62936a69145d9cb1a3ced0b1712ee54bf31904f20c82a737179132a8ff865fe7fc5cd285bdadc61ce76f92515f9b0606ee2f
7
+ data.tar.gz: e81e01ee41c0ac1dbb3e76fa6aa45cecd2d6fb25634dc351e93ed32de67b80e572b0305816dde37ea92f8c09e3264e2f1bb48cb3a58e33a1163e5421c6164973
@@ -54,7 +54,7 @@ module RuboCop
54
54
  alias eql? ==
55
55
 
56
56
  Constants::STANZA_ORDER.each do |stanza_name|
57
- class_eval <<-RUBY, __FILE__, __LINE__
57
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
58
58
  def #{stanza_name}?
59
59
  stanza_name == :#{stanza_name}
60
60
  end
@@ -3,6 +3,6 @@ require 'rubygems'
3
3
  module RuboCop
4
4
  module Cask
5
5
  # Version information for the Cask RuboCop plugin.
6
- VERSION = '0.15.1'.freeze
6
+ VERSION = '0.16.0'.freeze
7
7
  end
8
8
  end
@@ -16,15 +16,15 @@ module RuboCop
16
16
 
17
17
  COMMENT_FORMAT = /# [^ ]+ was verified as official when first introduced to the cask/
18
18
 
19
- MSG_NO_MATCH = '`%s` does not match `%s`'.freeze
19
+ MSG_NO_MATCH = '`%<url>s` does not match `%<full_url>s`'.freeze
20
20
 
21
- MSG_MISSING = '`%s` does not match `%s`, a comment has to be added ' \
21
+ MSG_MISSING = '`%<domain>s` does not match `%<homepage>s`, a comment has to be added ' \
22
22
  'above the `url` stanza. For details, see ' + REFERENCE_URL
23
23
 
24
- MSG_WRONG_FORMAT = '`%s` does not match the expected comment format. ' \
24
+ MSG_WRONG_FORMAT = '`%<comment>s` does not match the expected comment format. ' \
25
25
  'For details, see ' + REFERENCE_URL
26
26
 
27
- MSG_UNNECESSARY = '`%s` matches `%s`, the comment above the `url` ' \
27
+ MSG_UNNECESSARY = '`%<domain>s` matches `%<homepage>s`, the comment above the `url` ' \
28
28
  'stanza is unnecessary'.freeze
29
29
 
30
30
  def on_cask(cask_block)
@@ -56,7 +56,7 @@ module RuboCop
56
56
  comment = comment(stanza).loc.expression
57
57
  add_offense(comment,
58
58
  location: comment,
59
- message: format(MSG_UNNECESSARY, domain(stanza), homepage))
59
+ message: format(MSG_UNNECESSARY, domain: domain(stanza), homepage: homepage))
60
60
  end
61
61
 
62
62
  def add_offense_missing_comment(stanza)
@@ -65,7 +65,7 @@ module RuboCop
65
65
 
66
66
  range = stanza.source_range
67
67
  url_domain = domain(stanza)
68
- add_offense(range, location: range, message: format(MSG_MISSING, url_domain, homepage, url_domain))
68
+ add_offense(range, location: range, message: format(MSG_MISSING, domain: url_domain, homepage: homepage))
69
69
  end
70
70
 
71
71
  def add_offense_no_match(stanza)
@@ -76,7 +76,7 @@ module RuboCop
76
76
  comment = comment(stanza).loc.expression
77
77
  add_offense(comment,
78
78
  location: comment,
79
- message: format(MSG_NO_MATCH, url_from_comment(stanza), full_url(stanza)))
79
+ message: format(MSG_NO_MATCH, url: url_from_comment(stanza), full_url: full_url(stanza)))
80
80
  end
81
81
 
82
82
  def add_offense_wrong_format(stanza)
@@ -87,7 +87,7 @@ module RuboCop
87
87
  comment = comment(stanza).loc.expression
88
88
  add_offense(comment,
89
89
  location: comment,
90
- message: format(MSG_WRONG_FORMAT, comment(stanza).text))
90
+ message: format(MSG_WRONG_FORMAT, comment: comment(stanza).text))
91
91
  end
92
92
 
93
93
  def comment?(stanza)
@@ -9,7 +9,7 @@ module RuboCop
9
9
  class HomepageUrlTrailingSlash < Cop
10
10
  include OnHomepageStanza
11
11
 
12
- MSG_NO_SLASH = "'%s' must have a slash after the domain.".freeze
12
+ MSG_NO_SLASH = "'%<url>s' must have a slash after the domain.".freeze
13
13
 
14
14
  def on_homepage_stanza(stanza)
15
15
  url_node = stanza.stanza_node.first_argument
@@ -17,7 +17,7 @@ module RuboCop
17
17
 
18
18
  return if url !~ %r{^.+://[^/]+$}
19
19
  add_offense(url_node, location: :expression,
20
- message: format(MSG_NO_SLASH, url))
20
+ message: format(MSG_NO_SLASH, url: url))
21
21
  end
22
22
 
23
23
  def autocorrect(node)
@@ -19,7 +19,7 @@ module RuboCop
19
19
  extend Forwardable
20
20
  include CaskHelp
21
21
 
22
- MESSAGE = 'Use `%s` instead of `%s`'.freeze
22
+ MESSAGE = 'Use `%<preferred>s` instead of `%<current>s`'.freeze
23
23
 
24
24
  def on_cask(cask_block)
25
25
  @cask_header = cask_block.header
@@ -53,7 +53,7 @@ module RuboCop
53
53
  end
54
54
 
55
55
  def error_msg
56
- format(MESSAGE, preferred_header_str, header_str)
56
+ format(MESSAGE, preferred: preferred_header_str, current: header_str)
57
57
  end
58
58
  end
59
59
  end
@@ -10,7 +10,7 @@ module RuboCop
10
10
  extend Forwardable
11
11
  include CaskHelp
12
12
 
13
- MESSAGE = '`%s` stanza out of order'.freeze
13
+ MESSAGE = '`%<stanza>s` stanza out of order'.freeze
14
14
 
15
15
  def on_cask(cask_block)
16
16
  @cask_block = cask_block
@@ -34,7 +34,7 @@ module RuboCop
34
34
 
35
35
  def add_offenses
36
36
  offending_stanzas.each do |stanza|
37
- message = format(MESSAGE, stanza.stanza_name)
37
+ message = format(MESSAGE, stanza: stanza.stanza_name)
38
38
  add_offense(stanza, location: stanza.source_range_with_comments,
39
39
  message: message)
40
40
  end
@@ -137,19 +137,19 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
137
137
 
138
138
  context 'when caveats stanza is incorrectly grouped' do
139
139
  let(:source) do
140
- format(<<-CASK.undent, caveats.strip)
140
+ format(<<-CASK.undent, caveats: caveats.strip)
141
141
  cask 'foo' do
142
142
  version :latest
143
143
  sha256 :no_check
144
144
  url 'https://foo.example.com/foo.zip'
145
145
  name 'Foo'
146
146
  app 'Foo.app'
147
- %s
147
+ %<caveats>s
148
148
  end
149
149
  CASK
150
150
  end
151
151
  let(:correct_source) do
152
- format(<<-CASK.undent, caveats.strip)
152
+ format(<<-CASK.undent, caveats: caveats.strip)
153
153
  cask 'foo' do
154
154
  version :latest
155
155
  sha256 :no_check
@@ -159,7 +159,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
159
159
 
160
160
  app 'Foo.app'
161
161
 
162
- %s
162
+ %<caveats>s
163
163
  end
164
164
  CASK
165
165
  end
@@ -193,11 +193,11 @@ describe RuboCop::Cop::Cask::StanzaOrder do
193
193
 
194
194
  context 'when the caveats stanza is out of order' do
195
195
  let(:source) do
196
- format(<<-CASK.undent, caveats.strip)
196
+ format(<<-CASK.undent, caveats: caveats.strip)
197
197
  cask 'foo' do
198
198
  name 'Foo'
199
199
  url 'https://foo.example.com/foo.zip'
200
- %s
200
+ %<caveats>s
201
201
  version :latest
202
202
  app 'Foo.app'
203
203
  sha256 :no_check
@@ -205,14 +205,14 @@ describe RuboCop::Cop::Cask::StanzaOrder do
205
205
  CASK
206
206
  end
207
207
  let(:correct_source) do
208
- format(<<-CASK.undent, caveats.strip)
208
+ format(<<-CASK.undent, caveats: caveats.strip)
209
209
  cask 'foo' do
210
210
  version :latest
211
211
  sha256 :no_check
212
212
  url 'https://foo.example.com/foo.zip'
213
213
  name 'Foo'
214
214
  app 'Foo.app'
215
- %s
215
+ %<caveats>s
216
216
  end
217
217
  CASK
218
218
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-cask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hagins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-25 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: public_suffix
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.51.0
33
+ version: 0.52.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.51.0
40
+ version: 0.52.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement