rufo 0.17.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/bin/verify-sample-code +2 -3
- data/lib/rufo/formatter.rb +8 -70
- data/lib/rufo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5df151931108df0740d8602c1bf8b931503e3bede6a337f25a9bf75cb549c70
|
4
|
+
data.tar.gz: 73a321c4a0960f8fc021b062149ccbe3f96ccfc231c780e2612de00e011f590b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a2176ae1780bce5ec076052b63576fc54370a4a5b2a7837166e8d42ec4f6f4f47cc1b4590f5742a6b7a263d7cb2b59fc7985a2dd9f1a37fa41939c502515253
|
7
|
+
data.tar.gz: aad26fad18830aad211ba7d16f65643b78648b4f755d0a43ac1b65edbba1d7f97e05535f7c2f499dc3a5a7fa2cfff295e2a5da1aa63af859090873598406ab60
|
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
12
12
|
|
13
13
|
### Added
|
14
14
|
|
15
|
+
## [0.17.1] - 2024-02-03
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- Fix incorrect indentation methods call with splat ([#320](https://github.com/ruby-formatter/rufo/pull/320))
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- Remove unused internal methods from `Rufo::Formatter` ([#321](https://github.com/ruby-formatter/rufo/pull/321))
|
22
|
+
- This change may affect behavior with versions of Ruby not currently supported by Rufo (< 2.7)
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
15
26
|
## [0.17.0] - 2024-01-06
|
16
27
|
|
17
28
|
### Fixed
|
data/bin/verify-sample-code
CHANGED
data/lib/rufo/formatter.rb
CHANGED
@@ -396,8 +396,6 @@ class Rufo::Formatter
|
|
396
396
|
visit_module(node)
|
397
397
|
when :mrhs_new_from_args
|
398
398
|
visit_mrhs_new_from_args(node)
|
399
|
-
when :mlhs_paren
|
400
|
-
visit_mlhs_paren(node)
|
401
399
|
when :mlhs
|
402
400
|
visit_mlhs(node)
|
403
401
|
when :mrhs_add_star
|
@@ -457,8 +455,6 @@ class Rufo::Formatter
|
|
457
455
|
visit_alias(node)
|
458
456
|
when :undef
|
459
457
|
visit_undef(node)
|
460
|
-
when :mlhs_add_star
|
461
|
-
visit_mlhs_add_star(node)
|
462
458
|
when :rest_param
|
463
459
|
visit_rest_param(node)
|
464
460
|
when :kwrest_param
|
@@ -906,26 +902,6 @@ class Rufo::Formatter
|
|
906
902
|
end
|
907
903
|
end
|
908
904
|
|
909
|
-
def indentable_value?(value)
|
910
|
-
return unless current_token_kind == :on_kw
|
911
|
-
|
912
|
-
case current_token_value
|
913
|
-
when "if", "unless", "case"
|
914
|
-
true
|
915
|
-
when "begin"
|
916
|
-
# Only indent if it's begin/rescue
|
917
|
-
return false unless value[0] == :begin
|
918
|
-
|
919
|
-
body = value[1]
|
920
|
-
return false unless body[0] == :bodystmt
|
921
|
-
|
922
|
-
_, _, rescue_body, else_body, ensure_body = body
|
923
|
-
rescue_body || else_body || ensure_body
|
924
|
-
else
|
925
|
-
false
|
926
|
-
end
|
927
|
-
end
|
928
|
-
|
929
905
|
def current_comment_aligned_to_previous_one?
|
930
906
|
@last_comment &&
|
931
907
|
@last_comment[0][0] + 1 == current_token_line &&
|
@@ -1541,7 +1517,8 @@ class Rufo::Formatter
|
|
1541
1517
|
|
1542
1518
|
skip_space
|
1543
1519
|
|
1544
|
-
write_params_comma
|
1520
|
+
# Disable indentation in write_params_comma to avoid double indentation with write_indent
|
1521
|
+
write_params_comma(with_indent: !needs_indent) if comma?
|
1545
1522
|
write_indent(base_column) if needs_indent
|
1546
1523
|
consume_op "*"
|
1547
1524
|
skip_space_or_newline
|
@@ -1551,7 +1528,8 @@ class Rufo::Formatter
|
|
1551
1528
|
end
|
1552
1529
|
|
1553
1530
|
if post_args && !post_args.empty?
|
1554
|
-
write_params_comma
|
1531
|
+
# Disable indentation in write_params_comma to avoid double indentation with visit_comma_separated_list
|
1532
|
+
write_params_comma(with_indent: !needs_indent)
|
1555
1533
|
visit_comma_separated_list post_args, needs_indent: needs_indent, base_column: base_column
|
1556
1534
|
end
|
1557
1535
|
end
|
@@ -1659,23 +1637,10 @@ class Rufo::Formatter
|
|
1659
1637
|
end
|
1660
1638
|
end
|
1661
1639
|
|
1662
|
-
def visit_mlhs_paren(node)
|
1663
|
-
# [:mlhs_paren,
|
1664
|
-
# [[:mlhs_paren, [:@ident, "x", [1, 12]]]]
|
1665
|
-
# ]
|
1666
|
-
_, args = node
|
1667
|
-
|
1668
|
-
visit_mlhs_or_mlhs_paren(args)
|
1669
|
-
end
|
1670
|
-
|
1671
1640
|
def visit_mlhs(node)
|
1672
1641
|
# [:mlsh, *args]
|
1673
1642
|
_, *args = node
|
1674
1643
|
|
1675
|
-
visit_mlhs_or_mlhs_paren(args)
|
1676
|
-
end
|
1677
|
-
|
1678
|
-
def visit_mlhs_or_mlhs_paren(args)
|
1679
1644
|
# Sometimes a paren comes, some times not, so act accordingly.
|
1680
1645
|
has_paren = current_token_kind == :on_lparen
|
1681
1646
|
if has_paren
|
@@ -1819,35 +1784,6 @@ class Rufo::Formatter
|
|
1819
1784
|
end
|
1820
1785
|
end
|
1821
1786
|
|
1822
|
-
def visit_mlhs_add_star(node)
|
1823
|
-
# [:mlhs_add_star, before, star, after]
|
1824
|
-
_, before, star, after = node
|
1825
|
-
|
1826
|
-
if before && !before.empty?
|
1827
|
-
# Maybe a Ripper bug, but if there's something before a star
|
1828
|
-
# then a star shouldn't be here... but if it is... handle it
|
1829
|
-
# somehow...
|
1830
|
-
if op?("*")
|
1831
|
-
star = before
|
1832
|
-
else
|
1833
|
-
visit_comma_separated_list to_ary(before)
|
1834
|
-
write_params_comma
|
1835
|
-
end
|
1836
|
-
end
|
1837
|
-
|
1838
|
-
consume_op "*"
|
1839
|
-
|
1840
|
-
if star
|
1841
|
-
skip_space_or_newline
|
1842
|
-
visit star
|
1843
|
-
end
|
1844
|
-
|
1845
|
-
if after && !after.empty?
|
1846
|
-
write_params_comma
|
1847
|
-
visit_comma_separated_list after
|
1848
|
-
end
|
1849
|
-
end
|
1850
|
-
|
1851
1787
|
def visit_rest_param(node)
|
1852
1788
|
# [:rest_param, name]
|
1853
1789
|
|
@@ -2250,12 +2186,14 @@ class Rufo::Formatter
|
|
2250
2186
|
end
|
2251
2187
|
end
|
2252
2188
|
|
2253
|
-
def write_params_comma
|
2189
|
+
def write_params_comma(with_indent: true)
|
2254
2190
|
skip_space
|
2255
2191
|
check :on_comma
|
2256
2192
|
write ","
|
2257
2193
|
next_token
|
2258
|
-
|
2194
|
+
|
2195
|
+
indent_size = with_indent ? @indent : 0
|
2196
|
+
skip_space_or_newline_using_setting(:one, indent_size)
|
2259
2197
|
end
|
2260
2198
|
|
2261
2199
|
def visit_array(node)
|
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.17.
|
4
|
+
version: 0.17.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: 2024-
|
11
|
+
date: 2024-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
- !ruby/object:Gem::Version
|
211
211
|
version: '0'
|
212
212
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
213
|
+
rubygems_version: 3.5.3
|
214
214
|
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: Ruby code formatter
|