pronto-rubocop 0.11.4 → 0.11.5

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: e1b54bb1da3b75627d89dcf30ade91899bc7841331d07aee4741dcd0dbd666bf
4
- data.tar.gz: d7aa8f5af922b6ba949e4261494d28b14c870f0fc38a09a951de25eaca15aee7
3
+ metadata.gz: 31a6b1d783a13213827c18f9b43e4abeb8059eeb5f03327932ab4adddb4a605e
4
+ data.tar.gz: f6c46e2ec733ae8e6734f6c8b5ad0e6960a4cf7ab084ac5ef9b9c1c522f6f9a2
5
5
  SHA512:
6
- metadata.gz: d66a9abf4c546eb99092f9a253f6ed6da1a38d12aa8172a77a5fb4ce043e7958efd1a25d6b26714fd1fb3c36c3f6d55e9be90aadec77746ddcb33da8905f83f4
7
- data.tar.gz: 372bd0473ed8a3704b97e9b633a2238d159746d0b780641e8898261dbbc0549f6df6fe096e212b0b1c20ab5bb74ec31444c74f71174d8b059f322ca073e811cf
6
+ metadata.gz: 8334a6dcde6ea5160695f8ec9104f74bdd81b5e9d3f67dd4ed7dbd19d4ccec6f843832449141996012cac311a1e653e1e3957614ee7145c024fb5689d31c2f76
7
+ data.tar.gz: de20031af59547eb5c717a03943086267cfa6efef577bd604d817e32e85b9c5136f6826ae08a806bc51c03be114a1d89f8d487d4b95ac511c6668e427d7b23cf
@@ -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']
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@v2
39
+ - uses: actions/checkout@v3
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)
@@ -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.flat_map do |offense|
17
- patch
18
- .added_lines
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
@@ -67,6 +64,11 @@ module Pronto
67
64
  .reject(&:disabled?)
68
65
  end
69
66
 
67
+ def offense_includes?(offense, line_number)
68
+ offense_range = (offense.location.first_line..offense.location.last_line)
69
+ offense_range.include?(line_number)
70
+ end
71
+
70
72
  def team
71
73
  @team ||=
72
74
  if ::RuboCop::Cop::Team.respond_to?(:mobilize)
@@ -76,6 +78,19 @@ module Pronto
76
78
  ::RuboCop::Cop::Team.new(registry, rubocop_config)
77
79
  end
78
80
  end
81
+
82
+ def first_relevant_line(patch, offense)
83
+ patch.added_lines.detect do |line|
84
+ offense_includes?(offense, line.new_lineno)
85
+ end
86
+ end
87
+
88
+ def first_relevant_message(patch, offense)
89
+ offending_line = first_relevant_line(patch, offense)
90
+ return nil unless offending_line
91
+
92
+ OffenseLine.new(self, offense, offending_line).message
93
+ end
79
94
  end
80
95
  end
81
96
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pronto
4
4
  module RubocopVersion
5
- VERSION = '0.11.4'
5
+ VERSION = '0.11.5'
6
6
  end
7
7
  end
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
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindaugas Mozūras
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-31 00:00:00.000000000 Z
11
+ date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pronto
@@ -86,7 +86,7 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '1.2'
89
- description:
89
+ description:
90
90
  email: mindaugas.mozuras@gmail.com
91
91
  executables: []
92
92
  extensions: []
@@ -107,7 +107,7 @@ homepage: http://github.com/mmozuras/pronto-rubocop
107
107
  licenses:
108
108
  - MIT
109
109
  metadata: {}
110
- post_install_message:
110
+ post_install_message:
111
111
  rdoc_options: []
112
112
  require_paths:
113
113
  - lib
@@ -122,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.0.9
126
- signing_key:
125
+ rubygems_version: 3.1.2
126
+ signing_key:
127
127
  specification_version: 4
128
128
  summary: Pronto runner for Rubocop, ruby code analyzer
129
129
  test_files: []