pronto-rubocop 0.11.4 → 0.11.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 +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/checks.yml +2 -2
- data/.github/workflows/push_gem.yml +32 -0
- data/README.md +2 -2
- data/lib/pronto/rubocop/offense_line.rb +1 -0
- data/lib/pronto/rubocop/patch_cop.rb +40 -10
- data/lib/pronto/rubocop/version.rb +1 -1
- data/lib/pronto/rubocop.rb +3 -1
- data/pronto-rubocop.gemspec +2 -2
- metadata +20 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d192df5adbb4e399dd56d3c202eeb325d73b456567eb7b6db846b5168f0c1045
|
4
|
+
data.tar.gz: b1444cc4f6f915a547d0e43be5622fa7df6b889837da2e09474d0f864a5f741b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71f72f153f848cb90592bf2fe635f1bd32d0ba2749b0e095e645ea8b5f570be2e90b412a3eae40a71a4a01f330e1359ceb1fc36406433080dac383ece83e5d9f
|
7
|
+
data.tar.gz: a5b07e6280f14dd884f76a2f9a9ec8318a48fc0696cf4ecd075f24174531c0ecaf70616c28faf637b6f01f5f9869891469d93831dea5df113169fe7b14d722c3
|
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
runs-on: ubuntu-latest
|
15
15
|
strategy:
|
16
16
|
matrix:
|
17
|
-
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0']
|
17
|
+
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
|
18
18
|
rubocop: ['0.63.1', '0.81.0', '0.84.0', '0.85.0', '0.86.0', '0.87.0', '< 1.0', '1.0.0', '1.29.1', '1.30.0', '1.38.0', '< 2.0']
|
19
19
|
include:
|
20
20
|
- ruby: '2.3'
|
@@ -36,7 +36,7 @@ jobs:
|
|
36
36
|
rubocop: '1.38.0'
|
37
37
|
fail-fast: false
|
38
38
|
steps:
|
39
|
-
- uses: actions/checkout@
|
39
|
+
- uses: actions/checkout@v4
|
40
40
|
- name: use specific rubocop version
|
41
41
|
run: echo "gem 'rubocop', '${{ matrix.rubocop }}'" > Gemfile.local
|
42
42
|
- name: use specific rubocop-ast version (if required)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Publish gem to rubygems.org
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: read
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
push:
|
13
|
+
if: github.repository == 'prontolabs/pronto-rubocop'
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: write
|
18
|
+
id-token: write
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
|
22
|
+
with:
|
23
|
+
egress-policy: audit
|
24
|
+
|
25
|
+
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # v4.2.2
|
26
|
+
|
27
|
+
- uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0
|
28
|
+
with:
|
29
|
+
bundler-cache: true
|
30
|
+
ruby-version: '3.4'
|
31
|
+
|
32
|
+
- uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Pronto runner for RuboCop
|
2
2
|
|
3
|
-
[](https://codeclimate.com/github/prontolabs/pronto-rubocop)
|
4
|
-
[](https://travis-ci.org/prontolabs/pronto-rubocop)
|
5
3
|
[](http://badge.fury.io/rb/pronto-rubocop)
|
4
|
+
[](https://github.com/prontolabs/pronto-rubocop/actions/workflows/checks.yml)
|
5
|
+
[](https://codeclimate.com/github/prontolabs/pronto-rubocop)
|
6
6
|
|
7
7
|
Pronto runner for [RuboCop](https://github.com/bbatsov/rubocop), ruby code
|
8
8
|
analyzer. [What is Pronto?](https://github.com/prontolabs/pronto)
|
@@ -34,6 +34,7 @@ module Pronto
|
|
34
34
|
def suggestion_text
|
35
35
|
return unless patch_cop.runner.pronto_rubocop_config['suggestions']
|
36
36
|
return if corrections_count.zero?
|
37
|
+
return if corrector.nil? # possible after optimisation in https://github.com/rubocop/rubocop/pull/11264
|
37
38
|
return if differing_lines_count != corrections_count
|
38
39
|
|
39
40
|
@suggestion_text ||= corrected_lines[offense.line - 1]
|
@@ -13,12 +13,9 @@ module Pronto
|
|
13
13
|
def messages
|
14
14
|
return [] unless valid?
|
15
15
|
|
16
|
-
offenses
|
17
|
-
patch
|
18
|
-
|
19
|
-
.select { |line| line.new_lineno == offense.line }
|
20
|
-
.map { |line| OffenseLine.new(self, offense, line).message }
|
21
|
-
end
|
16
|
+
offenses
|
17
|
+
.map { |offense| first_relevant_message(patch, offense) }
|
18
|
+
.compact
|
22
19
|
end
|
23
20
|
|
24
21
|
def processed_source
|
@@ -34,7 +31,7 @@ module Pronto
|
|
34
31
|
end
|
35
32
|
|
36
33
|
def registry
|
37
|
-
@registry ||= ::RuboCop::Cop::Registry.new(
|
34
|
+
@registry ||= ::RuboCop::Cop::Registry.new(all_cops)
|
38
35
|
end
|
39
36
|
|
40
37
|
def rubocop_config
|
@@ -49,11 +46,20 @@ module Pronto
|
|
49
46
|
|
50
47
|
attr_reader :patch
|
51
48
|
|
49
|
+
def all_cops
|
50
|
+
# keep support of older Rubocop versions
|
51
|
+
if RuboCop::Cop.const_defined?(:Registry) && RuboCop::Cop::Registry.respond_to?(:all)
|
52
|
+
RuboCop::Cop::Registry.all
|
53
|
+
else
|
54
|
+
RuboCop::Cop::Cop.all
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
52
58
|
def valid?
|
53
59
|
return false if rubocop_config.file_to_exclude?(path)
|
54
60
|
return true if rubocop_config.file_to_include?(path)
|
55
61
|
|
56
|
-
|
62
|
+
runner.ruby_file?(path)
|
57
63
|
end
|
58
64
|
|
59
65
|
def path
|
@@ -61,12 +67,23 @@ module Pronto
|
|
61
67
|
end
|
62
68
|
|
63
69
|
def offenses
|
64
|
-
|
65
|
-
|
70
|
+
# keep support of older Rubocop versions
|
71
|
+
if team.respond_to?(:investigate)
|
72
|
+
offenses = team.investigate(processed_source).offenses
|
73
|
+
else
|
74
|
+
offenses = team.inspect_file(processed_source)
|
75
|
+
end
|
76
|
+
|
77
|
+
offenses
|
66
78
|
.sort
|
67
79
|
.reject(&:disabled?)
|
68
80
|
end
|
69
81
|
|
82
|
+
def offense_includes?(offense, line_number)
|
83
|
+
offense_range = (offense.location.first_line..offense.location.last_line)
|
84
|
+
offense_range.include?(line_number)
|
85
|
+
end
|
86
|
+
|
70
87
|
def team
|
71
88
|
@team ||=
|
72
89
|
if ::RuboCop::Cop::Team.respond_to?(:mobilize)
|
@@ -76,6 +93,19 @@ module Pronto
|
|
76
93
|
::RuboCop::Cop::Team.new(registry, rubocop_config)
|
77
94
|
end
|
78
95
|
end
|
96
|
+
|
97
|
+
def first_relevant_line(patch, offense)
|
98
|
+
patch.added_lines.detect do |line|
|
99
|
+
offense_includes?(offense, line.new_lineno)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def first_relevant_message(patch, offense)
|
104
|
+
offending_line = first_relevant_line(patch, offense)
|
105
|
+
return nil unless offending_line
|
106
|
+
|
107
|
+
OffenseLine.new(self, offense, offending_line).message
|
108
|
+
end
|
79
109
|
end
|
80
110
|
end
|
81
111
|
end
|
data/lib/pronto/rubocop.rb
CHANGED
@@ -8,7 +8,9 @@ require 'pronto/rubocop/offense_line'
|
|
8
8
|
module Pronto
|
9
9
|
class Rubocop < Runner
|
10
10
|
def run
|
11
|
-
|
11
|
+
return [] unless @patches
|
12
|
+
|
13
|
+
@patches
|
12
14
|
.select { |patch| patch.additions.positive? }
|
13
15
|
.flat_map { |patch| PatchCop.new(patch, self).messages }
|
14
16
|
end
|
data/pronto-rubocop.gemspec
CHANGED
@@ -10,12 +10,11 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.author = 'Mindaugas Mozūras'
|
12
12
|
s.email = 'mindaugas.mozuras@gmail.com'
|
13
|
-
s.homepage = '
|
13
|
+
s.homepage = 'https://github.com/prontolabs/pronto-rubocop'
|
14
14
|
s.summary = 'Pronto runner for Rubocop, ruby code analyzer'
|
15
15
|
|
16
16
|
s.licenses = ['MIT']
|
17
17
|
s.required_ruby_version = '>= 2.3.0'
|
18
|
-
s.rubygems_version = '1.8.23'
|
19
18
|
|
20
19
|
s.files = `git ls-files`.split($RS).reject do |file|
|
21
20
|
file =~ %r{^(?:
|
@@ -34,6 +33,7 @@ Gem::Specification.new do |s|
|
|
34
33
|
|
35
34
|
s.add_runtime_dependency('pronto', '~> 0.11.0')
|
36
35
|
s.add_runtime_dependency('rubocop', '>= 0.63.1', '< 2.0')
|
36
|
+
s.add_development_dependency('base64', '~> 0.1.2')
|
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,13 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-11 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: pronto
|
@@ -44,6 +43,20 @@ dependencies:
|
|
44
43
|
- - "<"
|
45
44
|
- !ruby/object:Gem::Version
|
46
45
|
version: '2.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: base64
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.1.2
|
53
|
+
type: :development
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.1.2
|
47
60
|
- !ruby/object:Gem::Dependency
|
48
61
|
name: rake
|
49
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +99,6 @@ dependencies:
|
|
86
99
|
- - "~>"
|
87
100
|
- !ruby/object:Gem::Version
|
88
101
|
version: '1.2'
|
89
|
-
description:
|
90
102
|
email: mindaugas.mozuras@gmail.com
|
91
103
|
executables: []
|
92
104
|
extensions: []
|
@@ -95,7 +107,9 @@ extra_rdoc_files:
|
|
95
107
|
- README.md
|
96
108
|
files:
|
97
109
|
- ".github/CODEOWNERS"
|
110
|
+
- ".github/dependabot.yml"
|
98
111
|
- ".github/workflows/checks.yml"
|
112
|
+
- ".github/workflows/push_gem.yml"
|
99
113
|
- LICENSE
|
100
114
|
- README.md
|
101
115
|
- lib/pronto/rubocop.rb
|
@@ -103,11 +117,10 @@ files:
|
|
103
117
|
- lib/pronto/rubocop/patch_cop.rb
|
104
118
|
- lib/pronto/rubocop/version.rb
|
105
119
|
- pronto-rubocop.gemspec
|
106
|
-
homepage:
|
120
|
+
homepage: https://github.com/prontolabs/pronto-rubocop
|
107
121
|
licenses:
|
108
122
|
- MIT
|
109
123
|
metadata: {}
|
110
|
-
post_install_message:
|
111
124
|
rdoc_options: []
|
112
125
|
require_paths:
|
113
126
|
- lib
|
@@ -122,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
135
|
- !ruby/object:Gem::Version
|
123
136
|
version: '0'
|
124
137
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
126
|
-
signing_key:
|
138
|
+
rubygems_version: 3.6.2
|
127
139
|
specification_version: 4
|
128
140
|
summary: Pronto runner for Rubocop, ruby code analyzer
|
129
141
|
test_files: []
|