rubocop-cask 0.14.4 → 0.15.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: 5e3ef8c1197234e1a0f99c84c25b9a38de7bda32
4
- data.tar.gz: c4339e3e4ae6144c91a7ce11384ec97401686ea9
3
+ metadata.gz: 577e8c7ab24a304d8ba4ac31feb192fed42d8d62
4
+ data.tar.gz: 76f5df9d67eaed9fdea5789927b5d5238464af9b
5
5
  SHA512:
6
- metadata.gz: eb6c7447ab7d25d715955cf82014118feb0b7f1b14b3f910786e7a618dc85af06ba212ee7ad558ede835d3d368031b1a51664b654988e276cab59f03724dd345
7
- data.tar.gz: 413cb456166b64d779e9ac15dbc86bacd3efe057bb209f9df34b5e7161d0aa153fbf38d296350c56294eeca1cd15cb2161d452a04685f2539c82990501158705
6
+ metadata.gz: 54c659d0ba5dd259262026e611c6519928ff9896d5754ad92a63dc2562224f149e8e65b3a3e003d6220ffd7fa8bf4e713b58ad760297aae7aa1214af4cfd8462
7
+ data.tar.gz: 7021e9ddcea30f5c4b4c804722481f1c9fa3010d84ddb6687fc93378034429182d58a8d9f5ba5e34e2e4f3fdb373c30cfd83d92d500917130c66e2f54302f959
@@ -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.14.4'.freeze
6
+ VERSION = '0.15.0'.freeze
7
7
  end
8
8
  end
@@ -55,8 +55,8 @@ module RuboCop
55
55
 
56
56
  comment = comment(stanza).loc.expression
57
57
  add_offense(comment,
58
- comment,
59
- format(MSG_UNNECESSARY, domain(stanza), homepage))
58
+ location: comment,
59
+ message: format(MSG_UNNECESSARY, domain(stanza), 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, range, format(MSG_MISSING, url_domain, homepage, url_domain))
68
+ add_offense(range, location: range, message: format(MSG_MISSING, url_domain, homepage, url_domain))
69
69
  end
70
70
 
71
71
  def add_offense_no_match(stanza)
@@ -75,8 +75,8 @@ module RuboCop
75
75
 
76
76
  comment = comment(stanza).loc.expression
77
77
  add_offense(comment,
78
- comment,
79
- format(MSG_NO_MATCH, url_from_comment(stanza), full_url(stanza)))
78
+ location: comment,
79
+ message: format(MSG_NO_MATCH, url_from_comment(stanza), full_url(stanza)))
80
80
  end
81
81
 
82
82
  def add_offense_wrong_format(stanza)
@@ -86,8 +86,8 @@ module RuboCop
86
86
 
87
87
  comment = comment(stanza).loc.expression
88
88
  add_offense(comment,
89
- comment,
90
- format(MSG_WRONG_FORMAT, comment(stanza).text))
89
+ location: comment,
90
+ message: format(MSG_WRONG_FORMAT, comment(stanza).text))
91
91
  end
92
92
 
93
93
  def comment?(stanza)
@@ -16,7 +16,8 @@ module RuboCop
16
16
  url = url_node.str_content
17
17
 
18
18
  return if url !~ %r{^.+://[^/]+$}
19
- add_offense(url_node, :expression, format(MSG_NO_SLASH, url))
19
+ add_offense(url_node, location: :expression,
20
+ message: format(MSG_NO_SLASH, url))
20
21
  end
21
22
 
22
23
  def autocorrect(node)
@@ -48,7 +48,8 @@ module RuboCop
48
48
  end
49
49
 
50
50
  def offense
51
- add_offense(@cask_header.method_node, header_range, error_msg)
51
+ add_offense(@cask_header.method_node, location: header_range,
52
+ message: error_msg)
52
53
  end
53
54
 
54
55
  def error_msg
@@ -74,20 +74,20 @@ module RuboCop
74
74
  def add_offense_missing_line(stanza)
75
75
  line_index = index_of_line_after(stanza)
76
76
  line_ops[line_index] = :insert
77
- add_offense(line_index, MISSING_LINE_MSG)
77
+ add_offense(line_index, message: MISSING_LINE_MSG)
78
78
  end
79
79
 
80
80
  def add_offense_extra_line(stanza)
81
81
  line_index = index_of_line_after(stanza)
82
82
  line_ops[line_index] = :remove
83
- add_offense(line_index, EXTRA_LINE_MSG)
83
+ add_offense(line_index, message: EXTRA_LINE_MSG)
84
84
  end
85
85
 
86
- def add_offense(line_index, msg)
86
+ def add_offense(line_index, message:)
87
87
  line_length = [processed_source[line_index].size, 1].max
88
88
  range = source_range(processed_source.buffer, line_index + 1, 0,
89
89
  line_length)
90
- super(range, range, msg)
90
+ super(range, location: range, message: message)
91
91
  end
92
92
  end
93
93
  end
@@ -35,7 +35,8 @@ module RuboCop
35
35
  def add_offenses
36
36
  offending_stanzas.each do |stanza|
37
37
  message = format(MESSAGE, stanza.stanza_name)
38
- add_offense(stanza, stanza.source_range_with_comments, message)
38
+ add_offense(stanza, location: stanza.source_range_with_comments,
39
+ message: message)
39
40
  end
40
41
  end
41
42
 
data/lib/rubocop-cask.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  require 'rubocop'
2
2
 
3
+ RuboCop::ConfigLoader.default_configuration =
4
+ RuboCop::ConfigLoader.configuration_from_file(
5
+ File.expand_path('../config/default.yml', __dir__)
6
+ )
7
+
3
8
  require 'rubocop/cask/constants'
4
9
  require 'rubocop/cask/extend/string'
5
10
  require 'rubocop/cask/extend/node'
@@ -7,10 +12,6 @@ require 'rubocop/cask/ast/cask_header'
7
12
  require 'rubocop/cask/ast/cask_block'
8
13
  require 'rubocop/cask/ast/stanza'
9
14
  require 'rubocop/cask/version'
10
- require 'rubocop/cask/inject'
11
-
12
- RuboCop::Cask::Inject.defaults!
13
-
14
15
  require 'rubocop/cop/cask/mixin/cask_help'
15
16
  require 'rubocop/cop/cask/mixin/on_homepage_stanza'
16
17
  require 'rubocop/cop/cask/homepage_matches_url'
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.14.4
4
+ version: 0.15.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-20 00:00:00.000000000 Z
11
+ date: 2017-10-23 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.50.0
33
+ version: 0.51.0
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.50.0
40
+ version: 0.51.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +73,6 @@ files:
73
73
  - lib/rubocop/cask/constants.rb
74
74
  - lib/rubocop/cask/extend/node.rb
75
75
  - lib/rubocop/cask/extend/string.rb
76
- - lib/rubocop/cask/inject.rb
77
76
  - lib/rubocop/cask/version.rb
78
77
  - lib/rubocop/cop/cask/homepage_matches_url.rb
79
78
  - lib/rubocop/cop/cask/homepage_url_trailing_slash.rb
@@ -1,22 +0,0 @@
1
- require 'yaml'
2
-
3
- module RuboCop
4
- module Cask
5
- # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
6
- # bit of our configuration.
7
- module Inject
8
- DEFAULT_FILE = File.expand_path(
9
- '../../../../config/default.yml', __FILE__
10
- )
11
-
12
- def self.defaults!
13
- hash = ConfigLoader.send(:load_yaml_configuration, DEFAULT_FILE)
14
- config = Config.new(hash, DEFAULT_FILE)
15
- puts "configuration from #{DEFAULT_FILE}" if ConfigLoader.debug?
16
- config = ConfigLoader.merge_with_default(config, DEFAULT_FILE)
17
-
18
- ConfigLoader.instance_variable_set(:@default_configuration, config)
19
- end
20
- end
21
- end
22
- end