rufo 0.6.1 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ac44f22208635f26f7ba5e61ef3a2b8d1b545a1d9d5c9f467f7ca81103d769e
4
- data.tar.gz: 020f099699c5f3274179abe580a05fc971becd4528f354388102ffed6ee45301
3
+ metadata.gz: 4651dcdf170f65e4e0da813add1f99623939ab8704b78c48572188a65de85252
4
+ data.tar.gz: 0d846bca50b9f15142e94894866280afb1a7963b9c729d0de84d3f469c7c0aad
5
5
  SHA512:
6
- metadata.gz: c2332c7d55b1ac87ecaab7eaa01a27ef962cdd93bd3a6a697c1cc34afd5a104ca59b443d3a3d158cea72eccabad49e73b7a8e8e2f5954474258acebb73de3ced
7
- data.tar.gz: 78ecfe030356e77f2ad2d3d7b04899714d2028d5cd63c8788cd3150ec9897c209b55896a3c90971ffd2c5c4a1de03b405dbec46a6fc5b8c9bb08c48bf08996b6
6
+ metadata.gz: af569cb8f398b61616546c2ba098e3fbe6ff576b0c7e0b467ef5bd181e6df90d4edae49f3e72a05b45de52c875e01cd9ed88ce2343af19a889efba571cdc4207
7
+ data.tar.gz: 75caf9bd7891406ee099eb8d707744ecf29f557a925b6c6b7d9108b7196ae52e793c7b53566af358f7676566e492c61b7a74af4ffbece87c6fb6c1b24b7f0e98
data/CHANGELOG.md CHANGED
@@ -8,10 +8,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8
8
 
9
9
  ### Fixed
10
10
 
11
+ ### Changed
12
+
11
13
  ### Added
12
14
 
15
+ ## [0.7.0] - 2019-04-28
16
+
17
+ ### Fixed
18
+ - Argument align with splat (issue [123](https://github.com/ruby-formatter/rufo/issues/123))
19
+
13
20
  ### Changed
14
21
 
22
+ ### Added
23
+ - Support jbuilder files (issue [173](https://github.com/ruby-formatter/rufo/issues/173))
24
+
15
25
  ## [0.6.1] - 2019-04-27
16
26
 
17
27
  ### Fixed
@@ -20,6 +20,7 @@ class Rufo::FileFinder
20
20
  ".rb",
21
21
  ".gemspec",
22
22
  ".rake",
23
+ ".jbuilder",
23
24
  ]
24
25
 
25
26
  EXCLUDED_DIRS = [
@@ -1513,24 +1513,32 @@ class Rufo::Formatter
1513
1513
  # [:args_add_star, args, star, post_args]
1514
1514
  _, args, star, *post_args = node
1515
1515
 
1516
+ if newline? || comment?
1517
+ needs_indent = true
1518
+ base_column = next_indent
1519
+ else
1520
+ base_column = @column
1521
+ end
1516
1522
  if !args.empty? && args[0] == :args_add_star
1517
1523
  # arg1, ..., *star
1518
1524
  visit args
1519
- else
1525
+ elsif !args.empty?
1520
1526
  visit_comma_separated_list args
1527
+ else
1528
+ consume_end_of_line if needs_indent
1521
1529
  end
1522
1530
 
1523
1531
  skip_space
1524
1532
 
1525
1533
  write_params_comma if comma?
1526
-
1534
+ write_indent(base_column) if needs_indent
1527
1535
  consume_op "*"
1528
1536
  skip_space_or_newline
1529
1537
  visit star
1530
1538
 
1531
1539
  if post_args && !post_args.empty?
1532
1540
  write_params_comma
1533
- visit_comma_separated_list post_args
1541
+ visit_comma_separated_list post_args, needs_indent: needs_indent, base_column: base_column
1534
1542
  end
1535
1543
  end
1536
1544
 
@@ -1747,16 +1755,16 @@ class Rufo::Formatter
1747
1755
  end
1748
1756
  end
1749
1757
 
1750
- def visit_comma_separated_list(nodes)
1751
- needs_indent = false
1752
-
1758
+ def visit_comma_separated_list(nodes, needs_indent: false, base_column: nil)
1753
1759
  if newline? || comment?
1754
1760
  indent { consume_end_of_line }
1755
1761
  needs_indent = true
1756
1762
  base_column = next_indent
1757
1763
  write_indent(base_column)
1764
+ elsif needs_indent
1765
+ write_indent(base_column)
1758
1766
  else
1759
- base_column = @column
1767
+ base_column ||= @column
1760
1768
  end
1761
1769
 
1762
1770
  nodes = to_ary(nodes)
@@ -1775,7 +1783,7 @@ class Rufo::Formatter
1775
1783
  check :on_comma
1776
1784
  write ","
1777
1785
  next_token
1778
- skip_space_or_newline_using_setting(:one, base_column || @indent)
1786
+ skip_space_or_newline_using_setting(:one, base_column)
1779
1787
  end
1780
1788
  end
1781
1789
 
data/lib/rufo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rufo
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
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.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ary Borenszweig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-27 00:00:00.000000000 Z
11
+ date: 2019-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler