pronto-rubocop 0.11.0 → 0.11.1
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 +4 -4
- data/.github/workflows/checks.yml +14 -2
- data/README.md +14 -0
- data/lib/pronto/rubocop.rb +3 -1
- data/lib/pronto/rubocop/offense_line.rb +11 -9
- data/lib/pronto/rubocop/patch_cop.rb +2 -0
- data/lib/pronto/rubocop/version.rb +3 -1
- data/pronto-rubocop.gemspec +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d5cd91a500a54c1184c0850685fd32ca72a832a82fd9c3a57b840d5b8eca6b2
|
4
|
+
data.tar.gz: 3b41e6777620b40b9d7e3d0d20946294c24acf8b081b32667e5adc69e2f03810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e440e9d28f6ef2b46ba4b6556164dcf97298e7926a972f5997417275dc4b2611e434ecdca32ccf8dc4550daa2d3561ae66871404b1773a306b3d93a8eb90a90
|
7
|
+
data.tar.gz: 81f24db46df5d142535c545c3943514ebcb5b138f08171e17a5c8e72178ae014fc1d67b206a425e7e34d04fc6dad7f0839ba56b4a5ea9e3291434ebaf809e74f
|
@@ -7,13 +7,25 @@ on:
|
|
7
7
|
branches: [ master ]
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
10
|
+
unit_tests:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby: ['2.
|
14
|
+
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0']
|
15
|
+
rubocop: ['0.63.1', '0.81.0', '0.84.0', '0.85.0', '0.86.0', '0.87.0', '< 1.0', '1.0.0', '< 2.0']
|
16
|
+
include:
|
17
|
+
- ruby: '2.3'
|
18
|
+
rubocop: '0.63.1'
|
19
|
+
- ruby: '2.3'
|
20
|
+
rubocop: '0.81.0'
|
21
|
+
fail-fast: false
|
15
22
|
steps:
|
16
23
|
- uses: actions/checkout@v2
|
24
|
+
- name: use specific rubocop version
|
25
|
+
run: echo "gem 'rubocop', '${{ matrix.rubocop }}'" > Gemfile.local
|
26
|
+
- name: use specific rubocop-ast version (if required)
|
27
|
+
if: matrix.rubocop == '0.84.0' || matrix.rubocop == '0.85.0'
|
28
|
+
run: echo "gem 'rubocop-ast', '< 0.7.0'" >> Gemfile.local
|
17
29
|
- uses: ruby/setup-ruby@v1
|
18
30
|
with:
|
19
31
|
ruby-version: ${{ matrix.ruby }}
|
data/README.md
CHANGED
@@ -38,3 +38,17 @@ the Pull Request.
|
|
38
38
|
For example:
|
39
39
|
|
40
40
|

|
41
|
+
|
42
|
+
## RuboCop versions
|
43
|
+
|
44
|
+
If you need to use RuboCop v0.84.0 or v0.85.x, you'll need to ensure that
|
45
|
+
you've also need to add `gem 'rubocop-ast', '< 0.7.0'` to your Gemfile as
|
46
|
+
these were the first versions to use rubocop-ast, and unfortunately the
|
47
|
+
dependency was loose enough that rubocop-ast versions >= 0.7.0 were allowed,
|
48
|
+
which causes `require 'rubocop'` to fail with
|
49
|
+
```
|
50
|
+
NoMethodError:
|
51
|
+
undefined method `join' for #<Set: {:==, :===, :!=, :<=, :>=, :>, :<}>
|
52
|
+
in rubocop-0.84.0/lib/rubocop/cop/style/redundant_conditional.rb:57:in `<class:RedundantConditional>'
|
53
|
+
```
|
54
|
+
This is due to https://github.com/rubocop-hq/rubocop-ast/issues/22
|
data/lib/pronto/rubocop.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pronto'
|
2
4
|
require 'rubocop'
|
3
5
|
require 'pronto/rubocop/patch_cop'
|
@@ -7,7 +9,7 @@ module Pronto
|
|
7
9
|
class Rubocop < Runner
|
8
10
|
def run
|
9
11
|
ruby_patches
|
10
|
-
.select { |patch| patch.additions
|
12
|
+
.select { |patch| patch.additions.positive? }
|
11
13
|
.flat_map { |patch| PatchCop.new(patch, self).messages }
|
12
14
|
end
|
13
15
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Pronto
|
2
4
|
class Rubocop < Runner
|
3
5
|
class OffenseLine
|
@@ -31,7 +33,7 @@ module Pronto
|
|
31
33
|
|
32
34
|
def suggestion_text
|
33
35
|
return unless patch_cop.runner.pronto_rubocop_config['suggestions']
|
34
|
-
return if corrections_count
|
36
|
+
return if corrections_count.zero?
|
35
37
|
return if differing_lines_count != corrections_count
|
36
38
|
|
37
39
|
@suggestion_text ||= corrected_lines[offense.line - 1]
|
@@ -51,7 +53,8 @@ module Pronto
|
|
51
53
|
processed_source.lines.join("\n").lines
|
52
54
|
end
|
53
55
|
|
54
|
-
if ::RuboCop::Cop::Team.respond_to?(:mobilize)
|
56
|
+
if ::RuboCop::Cop::Team.respond_to?(:mobilize) && ::RuboCop::Cop::Team.public_method_defined?(:investigate)
|
57
|
+
# rubocop >= 0.87.0 has both mobilize and public investigate method
|
55
58
|
MOBILIZE = :mobilize
|
56
59
|
|
57
60
|
def report
|
@@ -66,8 +69,8 @@ module Pronto
|
|
66
69
|
report.offenses.size
|
67
70
|
end
|
68
71
|
else
|
69
|
-
# rubocop
|
70
|
-
MOBILIZE = :new
|
72
|
+
# rubocop 0.85.x and 0.86.0 have mobilize, older versions don't
|
73
|
+
MOBILIZE = ::RuboCop::Cop::Team.respond_to?(:mobilize) ? :mobilize : :new
|
71
74
|
|
72
75
|
def corrector
|
73
76
|
@corrector ||= begin
|
@@ -86,11 +89,10 @@ module Pronto
|
|
86
89
|
def autocorrect_team
|
87
90
|
@autocorrect_team ||=
|
88
91
|
::RuboCop::Cop::Team.send(MOBILIZE,
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
)
|
92
|
+
::RuboCop::Cop::Registry.new([cop_class]),
|
93
|
+
patch_cop.rubocop_config,
|
94
|
+
auto_correct: true,
|
95
|
+
stdin: true)
|
94
96
|
end
|
95
97
|
|
96
98
|
def cop_class
|
data/pronto-rubocop.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
$LOAD_PATH.push File.expand_path('
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
4
|
require 'pronto/rubocop/version'
|
5
5
|
require 'English'
|
6
6
|
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.require_paths = ['lib']
|
34
34
|
|
35
35
|
s.add_runtime_dependency('pronto', '~> 0.11.0')
|
36
|
-
s.add_runtime_dependency('rubocop', '>= 0.
|
36
|
+
s.add_runtime_dependency('rubocop', '>= 0.63.1', '< 2.0')
|
37
37
|
s.add_development_dependency('rake', '~> 12.0')
|
38
38
|
s.add_development_dependency('rspec', '~> 3.4')
|
39
39
|
s.add_development_dependency('rspec-its', '~> 1.2')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.63.1
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '2.0'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.
|
43
|
+
version: 0.63.1
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '2.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|