rubocop-gradual 0.3.2 → 0.3.4

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: 685de93c46f230379c3a6a10f732634b28312cb8c996d7f401cee9bca6b449c7
4
- data.tar.gz: 4c81550b26fdaa11006f007e6f4a007e3bca172448bce4d9d479c5798d7e78f8
3
+ metadata.gz: 03f450cd4cc7123b6c7bf7b393cab547f36ea8c38bff64ff5468a8d50e7590c8
4
+ data.tar.gz: 4abbd0ba12b43d4db80203315bbfc4d2cd9fc120e30d0659a32bcd62278b1087
5
5
  SHA512:
6
- metadata.gz: 2759f62bd101bd82d222789c3ee704e7644000882418746ba09eb80578f3aed202aa80f3b067949d9cf1600c56b829b5900a80c2c5aa9859130320d43f5629df
7
- data.tar.gz: 856f18297791f916b8706be43062a5f5aebfe957c7d501d59af0b2808e74ca76d30d8f4a84d8a90474b90271299080d3fee80c3fdd748cec35c27430349062b4
6
+ metadata.gz: a4a1ebecba028f66d5b646bfe36c62e01ac5d45e9a31ffab5cb01b12ff90023333dbcd61c58dc427090e6f095e9ee658284c8bab714cacbcf0c52eabad8b9f75
7
+ data.tar.gz: 2a04f09d401e024597bc255cb9897f1b76fe62ac0b2395a665951b49f019e531273335564e8481791b480597278370924de474eca0a45dacf708a71fac8674da
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.4] - 2023-10-26
11
+
12
+ ### Fixed
13
+
14
+ - Use JSON.dump instead of to_json for stable results encoding. ([@skryukov])
15
+
16
+ ## [0.3.3] - 2023-10-18
17
+
18
+ ### Fixed
19
+
20
+ - Throw an error when the `--check` option is used and file hash is outdated. ([@skryukov])
21
+ - Wrap RuboCop errors to make output more pleasant. ([@skryukov])
22
+
10
23
  ## [0.3.2] - 2023-10-10
11
24
 
12
25
  ### Fixed
@@ -92,7 +105,9 @@ RuboCop::Gradual::RakeTask.new
92
105
 
93
106
  [@skryukov]: https://github.com/skryukov
94
107
 
95
- [Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.2...HEAD
108
+ [Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.4...HEAD
109
+ [0.3.4]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.3...v0.3.4
110
+ [0.3.3]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.2...v0.3.3
96
111
  [0.3.2]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.1...v0.3.2
97
112
  [0.3.1]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.0...v0.3.1
98
113
  [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
@@ -20,7 +20,7 @@ module RuboCop
20
20
  end
21
21
 
22
22
  def to_s
23
- "[#{[line, column, length, message.to_json, code_hash].join(", ")}]"
23
+ "[#{[line, column, length, JSON.dump(message), code_hash].join(", ")}]"
24
24
  end
25
25
 
26
26
  def ==(other)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Gradual
5
- VERSION = "0.3.2"
5
+ VERSION = "0.3.4"
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.4
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-26 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: []