rubocop-rubycw 0.1.1 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87fd1bec83b5aa40bb75389248446b77be192dae8e6cd995459f39568d78f677
4
- data.tar.gz: fe7852ed6d94b11292258597015e5035387177c54001417f59cc4ae61009a600
3
+ metadata.gz: 979e01a9b40b87393441a06a1c664f1ae89a09872fb4dcf067154201a1805559
4
+ data.tar.gz: 6cc2b141cd593ef75a81790cc5038f1b79e5d3305461a5d6b7d1505025e36226
5
5
  SHA512:
6
- metadata.gz: 9149d4541c6252ffae31f4f6194184779e67a88493bc642f867529d7761a2a1691bbf80e297f14b40d56a7b8d026e82faee57f9990cf68a479897013d0d5f4df
7
- data.tar.gz: 858e238744ce39b500106a1e97e536687d3acc6f1887df39268033edbb7fd66604be9366aa0c505e93527d0551414eb87fdc638146a4a2a7789dab523eb9a089
6
+ metadata.gz: f8f915423ace490c3a5537cc5fef4a4df02ca2c990387248a08dfeab217f478bad71e141c7d1aa69f058c93e50d6cf5b1a1d78d26f89ce0a35f1a2b046f13bbf
7
+ data.tar.gz: 40f956aaa1ef3f9cfbbf89f2d7ae182e9f3ac9a50b0c655b0f2f7c298c1f627aca3318e882a71fb4459c23b15cb4aa8ee3e24410ad7625bfc3f106566905c3f0
data/.circleci/config.yml CHANGED
@@ -7,12 +7,6 @@ steps: &steps
7
7
  - run: bundle exec rake
8
8
 
9
9
  jobs:
10
-
11
- ruby-2.3:
12
- docker:
13
- - image: circleci/ruby:2.3
14
- <<: *steps
15
-
16
10
  ruby-2.4:
17
11
  docker:
18
12
  - image: circleci/ruby:2.4
@@ -28,6 +22,16 @@ jobs:
28
22
  - image: circleci/ruby:2.6
29
23
  <<: *steps
30
24
 
25
+ ruby-2.7:
26
+ docker:
27
+ - image: circleci/ruby:2.7
28
+ <<: *steps
29
+
30
+ ruby-3.0:
31
+ docker:
32
+ - image: circleci/ruby:3.0
33
+ <<: *steps
34
+
31
35
  ruby-head:
32
36
  docker:
33
37
  - image: rubocophq/circleci-ruby-snapshot:latest
@@ -37,8 +41,9 @@ workflows:
37
41
  version: 2
38
42
  build:
39
43
  jobs:
40
- - ruby-2.3
41
44
  - ruby-2.4
42
45
  - ruby-2.5
43
46
  - ruby-2.6
47
+ - ruby-2.7
48
+ - ruby-3.0
44
49
  - ruby-head
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Masataka Pocke Kuwabara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -4,12 +4,18 @@ Integrate RuboCop and `ruby -cw`.
4
4
 
5
5
  You can get Ruby's warning as a RuboCop offense by rubocop-rubycw.
6
6
 
7
+ ## Requirements
8
+
9
+ * Ruby 2.4 or greater.
10
+ * But I highly recommend to use Ruby 2.6 or greater.
11
+ Because it is about 10x slower if it works on Ruby 2.5 or lower.
12
+
7
13
  ## Installation
8
14
 
9
15
  Add this line to your application's Gemfile:
10
16
 
11
17
  ```ruby
12
- gem 'rubocop-rubycw'
18
+ gem 'rubocop-rubycw', require: false
13
19
  ```
14
20
 
15
21
  And then execute:
@@ -36,5 +42,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
36
42
 
37
43
  ## Contributing
38
44
 
39
- Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/rubocop-rubycw.
40
-
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-rubycw.
@@ -4,10 +4,10 @@ module RuboCop
4
4
  module Cop
5
5
  module Rubycw
6
6
  # Execute `ruby -cw` and wrap the warning as RuboCop offense.
7
- class Rubycw < Cop
7
+ class Rubycw < Base
8
8
  include RangeHelp
9
9
 
10
- def investigate(processed_source)
10
+ def on_new_investigation
11
11
  source = processed_source.raw_source
12
12
 
13
13
  warnings(source).each do |line|
@@ -15,7 +15,7 @@ module RuboCop
15
15
  message = line[/.+:\d+: warning: (.+)$/, 1]
16
16
 
17
17
  range = source_range(processed_source.buffer, lnum, 0)
18
- add_offense(range, location: range, message: message)
18
+ add_offense(range, message: message)
19
19
  end
20
20
  end
21
21
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # The original code is from https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
4
- # See https://github.com/rubocop-hq/rubocop-rspec/blob/master/MIT-LICENSE.md
3
+ # The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
4
+ # See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
5
5
  module RuboCop
6
6
  module Rubycw
7
7
  # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module Rubycw
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
@@ -4,14 +4,17 @@ module RuboCop
4
4
  module Rubycw
5
5
  module WarningCapturer
6
6
  if defined?(RubyVM::AbstractSyntaxTree)
7
- require 'stringio'
8
-
9
7
  module ::Warning
10
- def warn(*message)
8
+ def self.warn(*message, **kwargs)
11
9
  if WarningCapturer.warnings
12
10
  WarningCapturer.warnings.concat message
13
11
  else
14
- super
12
+ if RUBY_VERSION >= '3'
13
+ # kwargs is available since Ruby 3
14
+ super(*message, **kwargs)
15
+ else
16
+ super(*message)
17
+ end
15
18
  end
16
19
  end
17
20
  end
@@ -45,7 +48,7 @@ module RuboCop
45
48
  require 'open3'
46
49
 
47
50
  def self.capture(source)
48
- _stdout, stderr, _status = Open3.capture3(RbConfig.ruby, '-cw', '-e', source)
51
+ _stdout, stderr, _status = Open3.capture3(RbConfig.ruby, '-cw', stdin_data: source)
49
52
  stderr.lines.map(&:chomp)
50
53
  end
51
54
  end
@@ -8,8 +8,9 @@ Gem::Specification.new do |spec|
8
8
 
9
9
  spec.summary = %q{Integrate RuboCop and ruby -cw}
10
10
  spec.description = %q{Integrate RuboCop and ruby -cw}
11
- spec.homepage = "https://github.com/pocke/rubocop-rubycw"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
11
+ spec.homepage = "https://github.com/rubocop/rubocop-rubycw"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
13
+ spec.license = 'MIT'
13
14
 
14
15
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
15
16
 
@@ -26,6 +27,5 @@ Gem::Specification.new do |spec|
26
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
28
  spec.require_paths = ["lib"]
28
29
 
29
- spec.add_runtime_dependency 'rubocop'
30
+ spec.add_runtime_dependency 'rubocop', '~> 1.0'
30
31
  end
31
-
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rubycw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Pocke Kuwabara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2021-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.0'
27
27
  description: Integrate RuboCop and ruby -cw
28
28
  email:
29
29
  - kuwabara@pocke.me
@@ -36,6 +36,7 @@ files:
36
36
  - ".rspec"
37
37
  - ".rubocop.yml"
38
38
  - Gemfile
39
+ - LICENSE
39
40
  - README.md
40
41
  - Rakefile
41
42
  - bin/console
@@ -49,12 +50,13 @@ files:
49
50
  - lib/rubocop/rubycw/version.rb
50
51
  - lib/rubocop/rubycw/warning_capturer.rb
51
52
  - rubocop-rubycw.gemspec
52
- homepage: https://github.com/pocke/rubocop-rubycw
53
- licenses: []
53
+ homepage: https://github.com/rubocop/rubocop-rubycw
54
+ licenses:
55
+ - MIT
54
56
  metadata:
55
- homepage_uri: https://github.com/pocke/rubocop-rubycw
56
- source_code_uri: https://github.com/pocke/rubocop-rubycw
57
- post_install_message:
57
+ homepage_uri: https://github.com/rubocop/rubocop-rubycw
58
+ source_code_uri: https://github.com/rubocop/rubocop-rubycw
59
+ post_install_message:
58
60
  rdoc_options: []
59
61
  require_paths:
60
62
  - lib
@@ -62,15 +64,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
64
  requirements:
63
65
  - - ">="
64
66
  - !ruby/object:Gem::Version
65
- version: 2.3.0
67
+ version: 2.4.0
66
68
  required_rubygems_version: !ruby/object:Gem::Requirement
67
69
  requirements:
68
70
  - - ">="
69
71
  - !ruby/object:Gem::Version
70
72
  version: '0'
71
73
  requirements: []
72
- rubygems_version: 3.0.3
73
- signing_key:
74
+ rubygems_version: 3.3.0.dev
75
+ signing_key:
74
76
  specification_version: 4
75
77
  summary: Integrate RuboCop and ruby -cw
76
78
  test_files: []