rubocop-gradual 0.3.2 → 0.3.3

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: 685de93c46f230379c3a6a10f732634b28312cb8c996d7f401cee9bca6b449c7
4
- data.tar.gz: 4c81550b26fdaa11006f007e6f4a007e3bca172448bce4d9d479c5798d7e78f8
3
+ metadata.gz: ad8fc07a5efc9411a388f7fd1eab366bacd44466ea7d268596b22d2c8a42522c
4
+ data.tar.gz: 618f6421cca7465ec6b3bfa08fd0a97eda8cf642c605ec8010a944f406d7b8bd
5
5
  SHA512:
6
- metadata.gz: 2759f62bd101bd82d222789c3ee704e7644000882418746ba09eb80578f3aed202aa80f3b067949d9cf1600c56b829b5900a80c2c5aa9859130320d43f5629df
7
- data.tar.gz: 856f18297791f916b8706be43062a5f5aebfe957c7d501d59af0b2808e74ca76d30d8f4a84d8a90474b90271299080d3fee80c3fdd748cec35c27430349062b4
6
+ metadata.gz: 14a9f2ae2e16a42171257db3d466eb99228e2a094c4e453725a3e07136f09a6d028bd080e158da47efbdbd012e57e8641ee259ff296df388f8515e3da14cbc23
7
+ data.tar.gz: f8c0d7a36a2f616893bbcdc681f775989b3b376ecdacc6383bdb8ca417fd08b82f06d9f19955b3c2decbb32d4f159fb2957f47b0a518ae22fb29f48e11fa4f4c
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.3] - 2023-10-18
11
+
12
+ ### Fixed
13
+
14
+ - Throw an error when the `--check` option is used and file hash is outdated. ([@skryukov])
15
+ - Wrap RuboCop errors to make output more pleasant. ([@skryukov])
16
+
10
17
  ## [0.3.2] - 2023-10-10
11
18
 
12
19
  ### Fixed
@@ -92,7 +99,8 @@ RuboCop::Gradual::RakeTask.new
92
99
 
93
100
  [@skryukov]: https://github.com/skryukov
94
101
 
95
- [Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.2...HEAD
102
+ [Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.3...HEAD
103
+ [0.3.3]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.2...v0.3.3
96
104
  [0.3.2]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.1...v0.3.2
97
105
  [0.3.1]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.0...v0.3.1
98
106
  [0.3.0]: https://github.com/skryukov/rubocop-gradual/compare/v0.2.0...v0.3.0
@@ -18,6 +18,9 @@ module RuboCop
18
18
  puts "Finished Gradual processing in #{time} seconds" if Configuration.display_time?
19
19
 
20
20
  exit_code
21
+ rescue RuboCop::Error => e
22
+ warn "\nRuboCop Error: #{e.message}"
23
+ 1
21
24
  end
22
25
 
23
26
  private
@@ -41,17 +41,18 @@ module RuboCop
41
41
  end
42
42
 
43
43
  def diff_issues(diff, result_file, old_file)
44
- fixed_or_moved_issues = old_file.changed_issues(result_file)
45
- new_or_moved_issues = result_file.changed_issues(old_file)
46
- moved_issues, fixed_issues = split_issues(fixed_or_moved_issues, new_or_moved_issues)
47
-
48
- diff.add_issues(
49
- result_file.path,
50
- fixed: fixed_issues,
51
- moved: moved_issues,
52
- new: new_or_moved_issues - moved_issues,
53
- unchanged: result_file.issues - new_or_moved_issues - moved_issues
54
- )
44
+ fixed_or_moved = old_file.changed_issues(result_file)
45
+ new_or_moved = result_file.changed_issues(old_file)
46
+ moved, fixed = split_issues(fixed_or_moved, new_or_moved)
47
+ new = new_or_moved - moved
48
+ unchanged = result_file.issues - new - moved
49
+
50
+ if result_file.file_hash != old_file.file_hash && fixed.empty? && new.empty? && moved.empty?
51
+ moved = unchanged
52
+ unchanged = []
53
+ end
54
+
55
+ diff.add_issues(result_file.path, fixed: fixed, moved: moved, new: new, unchanged: unchanged)
55
56
  end
56
57
 
57
58
  def split_issues(fixed_or_moved_issues, new_or_moved_issues)
@@ -42,7 +42,7 @@ module RuboCop
42
42
  code = ""
43
43
  data.each_line.lazy.drop(line).each_with_index do |str, index|
44
44
  from = index.zero? ? column : 0
45
- length = index.zero? ? length : length - code.length
45
+ length -= code.length unless index.zero?
46
46
  code += str[from, length]
47
47
 
48
48
  break if code.length >= length
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Gradual
5
- VERSION = "0.3.2"
5
+ VERSION = "0.3.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-gradual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -94,7 +94,7 @@ dependencies:
94
94
  version: '1.0'
95
95
  description: Gradually improve your code with RuboCop.
96
96
  email:
97
- - s.g.kryukov@yandex.ru
97
+ - me@skryukov.dev
98
98
  executables:
99
99
  - rubocop-gradual
100
100
  extensions: []