rufo 0.16.0 → 0.16.1
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 +4 -4
- data/CHANGELOG.md +30 -20
- data/lib/rufo/formatter.rb +19 -2
- data/lib/rufo/version.rb +1 -1
- metadata +3 -4
- data/bin/runtest +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6b55f94b8276a2ca0dc8518aa98949e83f83a95adc25a039385cb6855bcbb1c
|
|
4
|
+
data.tar.gz: 03b7595cccdade48c215c3609726bd8a40a5ac72c66e6f64246e842a63f7729e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c15b016ff6914844a2da86cf3af9ae257abdd9c421dfc4186d2eea39cfba919a2ac3ec489a1f539c59abd49452a5af511e2bca538adb7c62b346859bab3912b
|
|
7
|
+
data.tar.gz: aadada98b7acf84c40c147210655c54681d49b2d2079c76f6d44c19775676556cbf6545bc0754b4c037ba94478b31259f1236a464f60b15704f1e6ecbb98def7
|
data/CHANGELOG.md
CHANGED
|
@@ -12,11 +12,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
12
12
|
|
|
13
13
|
### Added
|
|
14
14
|
|
|
15
|
+
## [0.16.1] - 2023-05-04
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Fix Bug: raises error while formatting pattern matching syntax ([#304](https://github.com/ruby-formatter/rufo/issues/304))
|
|
19
|
+
- Fix Bug: avoid inserting a unnecessary comma to end of heredoc which in array with method call ([#303](https://github.com/ruby-formatter/rufo/pull/303))
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
15
25
|
## [0.16.0] - 2023-04-02
|
|
16
26
|
|
|
17
27
|
### Fixed
|
|
18
28
|
|
|
19
|
-
- Formats ERB files with configuration (
|
|
29
|
+
- Formats ERB files with configuration ([#275](https://github.com/ruby-formatter/rufo/issues/275))
|
|
20
30
|
|
|
21
31
|
### Changed
|
|
22
32
|
|
|
@@ -58,8 +68,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
58
68
|
|
|
59
69
|
### Added
|
|
60
70
|
|
|
61
|
-
- Support for partial argument forwarding. (
|
|
62
|
-
- Support for endless method. (
|
|
71
|
+
- Support for partial argument forwarding. ([#268](https://github.com/ruby-formatter/rufo/issues/268))
|
|
72
|
+
- Support for endless method. ([#271](https://github.com/ruby-formatter/rufo/issues/271))
|
|
63
73
|
- Add Ruby 3.2.0 to test runs on CI.
|
|
64
74
|
|
|
65
75
|
## [0.13.0] - 2021-05-07
|
|
@@ -84,7 +94,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
84
94
|
- File.read default encode UTF-8
|
|
85
95
|
- Handle case where the code is invalid but ripper does not raise an error.
|
|
86
96
|
- Removed implicit dependency on `rake`.
|
|
87
|
-
- Error when semicolon and then used in a case statement #230.
|
|
97
|
+
- Error when semicolon and then used in a case statement [#230](https://github.com/ruby-formatter/rufo/issues/230).
|
|
88
98
|
|
|
89
99
|
### Changed
|
|
90
100
|
|
|
@@ -175,22 +185,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
175
185
|
## [0.7.0] - 2019-04-28
|
|
176
186
|
|
|
177
187
|
### Fixed
|
|
178
|
-
- Argument align with splat (
|
|
188
|
+
- Argument align with splat ([#123](https://github.com/ruby-formatter/rufo/issues/123))
|
|
179
189
|
|
|
180
190
|
### Changed
|
|
181
191
|
|
|
182
192
|
### Added
|
|
183
|
-
- Support jbuilder files (
|
|
193
|
+
- Support jbuilder files ([#173](https://github.com/ruby-formatter/rufo/issues/173))
|
|
184
194
|
|
|
185
195
|
## [0.6.1] - 2019-04-27
|
|
186
196
|
|
|
187
197
|
### Fixed
|
|
188
|
-
- Fix bug: symbol literal like `:"foo"` in ruby 2.6.3 (
|
|
198
|
+
- Fix bug: symbol literal like `:"foo"` in ruby 2.6.3 ([#168](https://github.com/ruby-formatter/rufo/issues/168))
|
|
189
199
|
|
|
190
200
|
## [0.6.0] - 2019-03-04
|
|
191
201
|
|
|
192
202
|
### Fixed
|
|
193
|
-
- Fix odd indentation of nested one liner "if" statements (
|
|
203
|
+
- Fix odd indentation of nested one liner "if" statements ([#128](https://github.com/ruby-formatter/rufo/issues/128))
|
|
194
204
|
|
|
195
205
|
### Added
|
|
196
206
|
- Ignore `vendor` directories from files to be checked. This allows rufo to be run without any arguments against a directory both locally and on common CI tools without needing any configuration.
|
|
@@ -204,7 +214,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
204
214
|
|
|
205
215
|
### Fixed
|
|
206
216
|
|
|
207
|
-
- Fix bug: Rufo crashes on nested empty hash literal (
|
|
217
|
+
- Fix bug: Rufo crashes on nested empty hash literal ([#152](https://github.com/ruby-formatter/rufo/issues/152))
|
|
208
218
|
- Handle case where rufo would change formatting if run multiple times for hashes in some cases.
|
|
209
219
|
|
|
210
220
|
## [0.5.0] - 2019-02-09
|
|
@@ -222,7 +232,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
222
232
|
## [0.4.2] - 2019-01-22
|
|
223
233
|
|
|
224
234
|
### Fixed
|
|
225
|
-
- Fix bug: Rufo indents squiggly HEREDOC incorrectly causing bad formating (
|
|
235
|
+
- Fix bug: Rufo indents squiggly HEREDOC incorrectly causing bad formating ([#136](https://github.com/ruby-formatter/rufo/issues/136))
|
|
226
236
|
|
|
227
237
|
### Added
|
|
228
238
|
|
|
@@ -231,14 +241,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
231
241
|
## [0.4.1] - 2018-10-27
|
|
232
242
|
|
|
233
243
|
### Fixed
|
|
234
|
-
- Fix bug for double colon operator in method definition (
|
|
244
|
+
- Fix bug for double colon operator in method definition ([#120](https://github.com/ruby-formatter/rufo/issues/120))
|
|
235
245
|
|
|
236
246
|
## [0.4.0] - 2018-08-09
|
|
237
247
|
|
|
238
248
|
### Fixed
|
|
239
|
-
- Fix Bug: Rufo breaks HEREDOC syntax. (
|
|
240
|
-
- Fix Bug: formatter.rb:3700:in `block in adjust_other_alignments': undefined method `[]' for nil:NilClass (NoMethodError) (
|
|
241
|
-
- Fix Bug: Rufo keeps switching formatting on same file every time it runs (
|
|
249
|
+
- Fix Bug: Rufo breaks HEREDOC syntax. ([#88](https://github.com/ruby-formatter/rufo/issues/88)). This fixes heredoc within parens formatting causing bad formatting and subsequent syntax error.
|
|
250
|
+
- Fix Bug: formatter.rb:3700:in `block in adjust_other_alignments': undefined method `[]' for nil:NilClass (NoMethodError) ([#87](https://github.com/ruby-formatter/rufo/issues/87)). Check alignment target exists.
|
|
251
|
+
- Fix Bug: Rufo keeps switching formatting on same file every time it runs ([#86](https://github.com/ruby-formatter/rufo/issues/86)). Avoids re-indenting nested literal indents.
|
|
242
252
|
|
|
243
253
|
### Added
|
|
244
254
|
- Allow for simpler else_body node to suit new Ripper style in 2.6.0
|
|
@@ -250,7 +260,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
250
260
|
## [0.3.1] - 2018-04-12
|
|
251
261
|
|
|
252
262
|
### Fixed
|
|
253
|
-
- Fix `quote_style` config not being respected (
|
|
263
|
+
- Fix `quote_style` config not being respected ([#95](https://github.com/ruby-formatter/rufo/issues/95)).
|
|
254
264
|
|
|
255
265
|
## [0.3.0] - 2018-03-24
|
|
256
266
|
|
|
@@ -259,9 +269,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
259
269
|
- Normalize string quotes according to quote_style, which defaults to :double.
|
|
260
270
|
|
|
261
271
|
### Fixed
|
|
262
|
-
- Fix printing of extraneous trailing semicolons from inline classes, modules, methods (
|
|
263
|
-
- Fix unhandled white space between array getter/setters `x[0] [0]` (
|
|
264
|
-
- Fix comma printing for heredocs when inside a hash (
|
|
272
|
+
- Fix printing of extraneous trailing semicolons from inline classes, modules, methods ([#59](https://github.com/ruby-formatter/rufo/issues/59))
|
|
273
|
+
- Fix unhandled white space between array getter/setters `x[0] [0]` ([#62](https://github.com/ruby-formatter/rufo/issues/62))
|
|
274
|
+
- Fix comma printing for heredocs when inside a hash ([#61](https://github.com/ruby-formatter/rufo/issues/61))
|
|
265
275
|
- Fix array literals against changes to Ruby 2.5.0
|
|
266
276
|
|
|
267
277
|
## [0.2.0] - 2017-11-13
|
|
@@ -302,8 +312,8 @@ The following configuration options have been **removed**, and replaced with non
|
|
|
302
312
|
|
|
303
313
|
### Fixed
|
|
304
314
|
- Fix crash in Ruby <= 2.3.4, <= 2.4.1 in the presence of certain squiggly doc (`<<~`) with multiple embedded expressions. The real fix here is to upgrade Ruby to >= 2.3.5 / >= 2.4.2
|
|
305
|
-
- Fix dedent bug and bad formatting caused by comments within chained calls (
|
|
306
|
-
- Fix formatting bug for `for i, in [[1, 2]] ; x ; end` (
|
|
315
|
+
- Fix dedent bug and bad formatting caused by comments within chained calls ([#49](https://github.com/ruby-formatter/rufo/issues/49))
|
|
316
|
+
- Fix formatting bug for `for i, in [[1, 2]] ; x ; end` ([#45](https://github.com/ruby-formatter/rufo/issues/45))
|
|
307
317
|
|
|
308
318
|
## [0.1.0] - 2017-10-08
|
|
309
319
|
Beginning of logging changes!
|
data/lib/rufo/formatter.rb
CHANGED
|
@@ -600,8 +600,8 @@ class Rufo::Formatter
|
|
|
600
600
|
needs_comma = !comma? && trailing_commas
|
|
601
601
|
|
|
602
602
|
if inside_literal_elements_list && needs_comma
|
|
603
|
-
write ","
|
|
604
603
|
@last_was_heredoc = true
|
|
604
|
+
@end_of_heredoc_position = @output.length
|
|
605
605
|
end
|
|
606
606
|
|
|
607
607
|
@output << captured_output
|
|
@@ -2847,7 +2847,13 @@ class Rufo::Formatter
|
|
|
2847
2847
|
@literal_elements_level = nil
|
|
2848
2848
|
|
|
2849
2849
|
if needs_trailing_comma
|
|
2850
|
-
|
|
2850
|
+
if !wrote_comma && trailing_commas
|
|
2851
|
+
if @last_was_heredoc
|
|
2852
|
+
@output.insert(@end_of_heredoc_position, ",")
|
|
2853
|
+
else
|
|
2854
|
+
write ","
|
|
2855
|
+
end
|
|
2856
|
+
end
|
|
2851
2857
|
|
|
2852
2858
|
consume_end_of_line(first_space: first_space)
|
|
2853
2859
|
write_indent
|
|
@@ -3014,7 +3020,18 @@ class Rufo::Formatter
|
|
|
3014
3020
|
when :when
|
|
3015
3021
|
visit_comma_separated_list conds_or_pattern
|
|
3016
3022
|
when :in
|
|
3023
|
+
parens = current_token_kind == :on_lparen
|
|
3024
|
+
if parens
|
|
3025
|
+
consume_token :on_lparen
|
|
3026
|
+
skip_space_or_newline
|
|
3027
|
+
end
|
|
3028
|
+
|
|
3017
3029
|
visit conds_or_pattern
|
|
3030
|
+
|
|
3031
|
+
if parens
|
|
3032
|
+
skip_space_or_newline
|
|
3033
|
+
consume_token :on_rparen
|
|
3034
|
+
end
|
|
3018
3035
|
end
|
|
3019
3036
|
skip_space
|
|
3020
3037
|
end
|
data/lib/rufo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rufo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.16.
|
|
4
|
+
version: 0.16.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ary Borenszweig
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-04
|
|
11
|
+
date: 2023-05-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -171,7 +171,6 @@ files:
|
|
|
171
171
|
- README.md
|
|
172
172
|
- Rakefile
|
|
173
173
|
- bin/console
|
|
174
|
-
- bin/runtest
|
|
175
174
|
- bin/setup
|
|
176
175
|
- bin/verify-sample-code
|
|
177
176
|
- docs/developing-rufo.md
|
|
@@ -211,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
211
210
|
- !ruby/object:Gem::Version
|
|
212
211
|
version: '0'
|
|
213
212
|
requirements: []
|
|
214
|
-
rubygems_version: 3.4.
|
|
213
|
+
rubygems_version: 3.4.10
|
|
215
214
|
signing_key:
|
|
216
215
|
specification_version: 4
|
|
217
216
|
summary: Ruby code formatter
|