yaml-sort 2.0.1 → 2.0.2

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: e8eee6a8ad9b5761ffc9e9ef08f6025c66e3c661acfef15f197b3d28f67e3253
4
- data.tar.gz: 108d4ea68106e308eafbe6bce7cd372556ebde65010ade2b1b742e82f43f29d5
3
+ metadata.gz: 125cdbf70a136c2968ab9c18f99cbfaa62e3f4117a577187a37f43298910a7c9
4
+ data.tar.gz: 58ed8f15a8cd027871e17dbc8ccd8293fd1be1e3242e2b12012ea1efc9f50c87
5
5
  SHA512:
6
- metadata.gz: 234b85bdf4dd61f2bfa5a8568c59979ad12c374af47daed35d0a7248b0e1b8f96aed17bc77ba17ca2d8a7233d55803c9d6c5a4fcfa962394d6183ff61a3e9e21
7
- data.tar.gz: 525ca02351c0f79d86a6e367341b4c8750b294400ffd96a7d4ad00dfced59de0e16060b29a5ceb0b0dcb40d95db9f8d1f1b8fcaabbfb1dfb6c3a58fa470ad27d
6
+ metadata.gz: 3e2580f860075dd74a69c5e5a31097d906cbba4c9293a8f3181ee6fbf72cc931ca371cbf3b5258ed5ac93d356d2ed82f2805477f039799ea4cd293a39458a236
7
+ data.tar.gz: 00d35a112f355e53e0fca7d3bc63349dc6c1da2b87fc8195af480754b1e81f31049da97282679eef282d412c42d2ec7788689879c915a6697860408d01f9f5cd
data/CHANGELOG.md CHANGED
@@ -3,9 +3,17 @@ All notable changes to this project will be documented in this file.
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
- ## [2.0.1](https://github.com/smortex/yaml-sort/tree/2.0.1) (2022-06-01)
6
+ ## [2.0.2](https://github.com/smortex/yaml-sort/tree/2.0.2) (2022-06-10)
7
7
 
8
- [Full Changelog](https://github.com/smortex/yaml-sort/compare/v2.0.0...2.0.1)
8
+ [Full Changelog](https://github.com/smortex/yaml-sort/compare/v2.0.1...2.0.2)
9
+
10
+ **Fixed bugs:**
11
+
12
+ - Fix infinite loops when processing files with trailing whitespace [\#9](https://github.com/smortex/yaml-sort/pull/9) ([smortex](https://github.com/smortex))
13
+
14
+ ## [v2.0.1](https://github.com/smortex/yaml-sort/tree/v2.0.1) (2022-06-01)
15
+
16
+ [Full Changelog](https://github.com/smortex/yaml-sort/compare/v2.0.0...v2.0.1)
9
17
 
10
18
  **Fixed bugs:**
11
19
 
@@ -30,43 +30,42 @@ def scan(text)
30
30
 
31
31
  until s.eos?
32
32
  if scan_value
33
- unless s.match?(/[[:space:]]*\n/)
34
- @position += s.matched_size if s.scan(/[[:blank:]]*/)
35
- case
36
- when s.scan(/[|>][-+]?(?=\n)/)
37
- match = s.matched
38
-
39
- while s.match?("\n" + last_indent_value + " ")
40
- match += s.scan(/\n[^\n]+(?=\n)/)
41
- end
42
- emit(:VALUE, match)
43
- when s.scan(/"/)
44
- match = s.matched
45
- loop do
46
- match += s.scan_until(/"|\\/)
47
- if match[-1] == "\\"
48
- match += s.scan(/.|\n/)
49
- else
50
- break
51
- end
52
- end
53
- emit(:VALUE, match)
54
- when s.scan(/'/)
55
- match = s.matched
56
- loop do
57
- match += s.scan_until(/'/)
58
- break unless s.match?(/'/)
59
- match += s.scan(/'/)
60
- end
61
- emit(:VALUE, match)
62
- when s.scan(/\S+/)
63
- match = s.matched
64
- until s.match?(/[\n]/) || s.eos?
65
- match += s.scan(/[^\n]+/)
33
+ @position += s.matched_size if s.scan(/[[:blank:]]*/)
34
+ case
35
+ when s.scan(/[|>][-+]?(?=\n)/)
36
+ match = s.matched
37
+
38
+ while s.match?("\n" + last_indent_value + " ")
39
+ match += s.scan(/\n[^\n]+(?=\n)/)
40
+ end
41
+ emit(:VALUE, match)
42
+ when s.scan(/"/)
43
+ match = s.matched
44
+ loop do
45
+ match += s.scan_until(/"|\\/)
46
+ if match[-1] == "\\"
47
+ match += s.scan(/.|\n/)
48
+ else
49
+ break
66
50
  end
67
- emit(:VALUE, match)
68
51
  end
52
+ emit(:VALUE, match)
53
+ when s.scan(/'/)
54
+ match = s.matched
55
+ loop do
56
+ match += s.scan_until(/'/)
57
+ break unless s.match?(/'/)
58
+ match += s.scan(/'/)
59
+ end
60
+ emit(:VALUE, match)
61
+ when s.scan(/\S+/)
62
+ match = s.matched
63
+ until s.match?(/[\n]/) || s.eos?
64
+ match += s.scan(/[^\n]+/)
65
+ end
66
+ emit(:VALUE, match)
69
67
  end
68
+ s.scan(/[[:blank:]]*/)
70
69
  scan_value = false
71
70
  else
72
71
  case
@@ -88,23 +87,23 @@ def scan(text)
88
87
  when s.match?(/./)
89
88
  scan_value = true
90
89
  else
91
- message = if @lines[@lineno - 1][@position] == "\n"
92
- <<~MESSAGE
93
- #{@filename}:#{@lineno + 1}: unexpected content
94
- #{@lines[@lineno].chomp}
95
- ^#{"~" * (@lines[@lineno].chomp.length - 1)}
96
- MESSAGE
97
- else
98
- <<~MESSAGE
99
- #{@filename}:#{@lineno}: unexpected content
100
- #{@lines[@lineno - 1].chomp}
101
- #{" " * @position}^
102
- MESSAGE
103
- end
104
- raise(Racc::ParseError, message)
105
- end
106
- end
107
- end
90
+ message = if @lines[@lineno - 1][@position] == "\n"
91
+ <<~MESSAGE
92
+ #{@filename}:#{@lineno + 1}: unexpected content
93
+ #{@lines[@lineno].chomp}
94
+ ^#{"~" * (@lines[@lineno].chomp.length - 1)}
95
+ MESSAGE
96
+ else
97
+ <<~MESSAGE
98
+ #{@filename}:#{@lineno}: unexpected content
99
+ #{@lines[@lineno - 1].chomp}
100
+ #{" " * @position}^
101
+ MESSAGE
102
+ end
103
+ raise(Racc::ParseError, message)
104
+ end
105
+ end
106
+ end
108
107
 
109
108
  unindent
110
109
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yaml
4
4
  module Sort
5
- VERSION = "2.0.1"
5
+ VERSION = "2.0.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-sort
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-01 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri