pronto-rubocop 0.11.3 → 0.11.5

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
  SHA256:
3
- metadata.gz: 756b96b9e8df77b37193360fe3fe6ecf809b78da8aa71b3efe7a87926dfc4607
4
- data.tar.gz: e9a6a56746f4fd1b4ed40679b9233a5d364d0663a9249fd57ba43c03a988a954
3
+ metadata.gz: 31a6b1d783a13213827c18f9b43e4abeb8059eeb5f03327932ab4adddb4a605e
4
+ data.tar.gz: f6c46e2ec733ae8e6734f6c8b5ad0e6960a4cf7ab084ac5ef9b9c1c522f6f9a2
5
5
  SHA512:
6
- metadata.gz: 66ee070e5860a174b28e19e36e52b76465fba4b0ea87497c13b4acf5a321c5a49381c97dbe5689fa4aa9666b2efff1a1e52258ec85b1762f504dec8cf99aaf61
7
- data.tar.gz: d3ee6497d266630e4a38cfed9561ad13562a40b3662c340877086e35a8b8962dbf9bcab607391becde855545804b27655603dfd5aa40e78ad605609fe5e9128b
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
@@ -40,6 +37,7 @@ module Pronto
40
37
  def rubocop_config
41
38
  @rubocop_config ||= begin
42
39
  store = ::RuboCop::ConfigStore.new
40
+ store.options_config = ENV['RUBOCOP_CONFIG'] if ENV['RUBOCOP_CONFIG']
43
41
  store.for(path)
44
42
  end
45
43
  end
@@ -66,6 +64,11 @@ module Pronto
66
64
  .reject(&:disabled?)
67
65
  end
68
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
+
69
72
  def team
70
73
  @team ||=
71
74
  if ::RuboCop::Cop::Team.respond_to?(:mobilize)
@@ -75,6 +78,19 @@ module Pronto
75
78
  ::RuboCop::Cop::Team.new(registry, rubocop_config)
76
79
  end
77
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
78
94
  end
79
95
  end
80
96
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pronto
4
4
  module RubocopVersion
5
- VERSION = '0.11.3'
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.3
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-11-09 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.3.15
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: []