pronto-clang_format 0.1.2 → 0.1.3

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: 061f4e0d3a49949b184702e1c1e4ab65193d95f114f004fa8b2281d0ed48c37f
4
- data.tar.gz: dfbc0137ae30578e7581b4157e006931209d0ace485702a6d31640c1403aa3fe
3
+ metadata.gz: 9fe7b8b5605c1b8f0412b956371ecad612216fcdaf2cddb8ea68c9436f346db3
4
+ data.tar.gz: 6b2e07eef94cf67d213d1cdeccd103d9eb4aabb9cd458138af1cee08a5cce3f4
5
5
  SHA512:
6
- metadata.gz: a303e28f8c48abb8d1917c49385965aa65b629e155c3ec64b59d21093083de7a74b9b4508707548fb51e7bd3fc1976ce9958afcfc7d6d86acd16e1035c52f0f7
7
- data.tar.gz: fe59355bb6206a4a114c5fb9e70db591774c821769def8a85038797f7633a896271ace94392b1f657bcb473f386ac9a7f96457290d0efd85aad5599ba188f37c
6
+ metadata.gz: a16d084a2da8626789f91b5691cc6236c2742afc51a67923a7989f341eb9344728a89cb08c7d010ad24627709d6209d7018d71f1b4fced8ac514f208b808ca12
7
+ data.tar.gz: ce6ef55cc378d4ffac01d9c2716c005729b38d03b7d1ddbb4ed13fa43bb0e962760302cc19ec503d8abf54aeea6b7d54f991a37b16295bf179e6cfecf42c33de
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module ClangFormat
3
- VERSION = '0.1.2'.freeze
3
+ VERSION = '0.1.3'.freeze
4
4
  end
5
5
  end
@@ -57,9 +57,8 @@ module Pronto
57
57
  end_line_no, = ln_col_from_offset(newlines_array, offset + length)
58
58
  # extract relevant lines and pass to offence
59
59
  start_offset = offset_from_ln_col(newlines_array, line_no, 1)
60
- end_offset = offset_from_ln_col(newlines_array, end_line_no + 1, 0)
61
- old_lines_text = file_contents[start_offset..end_offset]
62
- .prepend("\n")
60
+ end_offset = offset_from_ln_col(newlines_array, end_line_no + 1, -1)
61
+ old_lines_text = "\n#{file_contents[start_offset..end_offset]}\n"
63
62
  Offence.new(offset, line_no, column, length, replacement,
64
63
  old_lines_text)
65
64
  end
@@ -87,6 +86,8 @@ module Pronto
87
86
  # newline_offsets_in(file_contents)
88
87
  # - offset: offset to be converted
89
88
  def offset_from_ln_col(newlines_array, ln, col)
89
+ # return -1 if the line does not exist in file
90
+ return -1 unless ln - 2 < newlines_array.length
90
91
  (ln >= 2 ? newlines_array[ln - 2] : -1) + col
91
92
  end
92
93
 
@@ -21,6 +21,7 @@ module Pronto
21
21
  .select { |p| valid_patch?(p) }
22
22
  .map { |p| inspect(p) }
23
23
  .flatten.compact
24
+ .uniq { |message| message.line } # generate only one message per line
24
25
  end
25
26
 
26
27
  def valid_patch?(patch)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-clang_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Jabbour