rufo 0.12.0 → 0.13.0

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: 87b9e11a2d83bf366134074b750fca515da61d65c626ad4a85cb029b3246f314
4
- data.tar.gz: 5f2caf3f22b5b7e8411e7a35f9e73c27bfd7a92f7f8246f3099ed98ecacef359
3
+ metadata.gz: 67f0bac262d71b5c91c9babdc6d975e88d1b7f04e903b8111f7ccf4f56aa2a35
4
+ data.tar.gz: c437092573d817e16b05bf2ddc6a1b5a084bc8a81a06836b2e84528f65db1dca
5
5
  SHA512:
6
- metadata.gz: 00742ceee28433e130ccceffd31ee41a8a827135d3f986f552d42821e62acc6b5a7c795771c5bdea5ec46069374a1ca014f964ca21fcd425240ffeedc101b72f
7
- data.tar.gz: ade0daa5611c2cbe51f9bf59de4df7750aaac6ecec829eaad97b9f478cba2d5f5a4671ac054c9d2850f5b1758b07881b51474e94a1cbe754f02a6348ccaa1607
6
+ metadata.gz: 4e14f22cc80b1566449f65c5b5eb7ceaa4b3f7ed9e98c9dbce35161830049d155c7cc83dd6fe5c3e965ebc085b7cda787b18d4a705b71daebdc1571060a7b545
7
+ data.tar.gz: a49e26fe230db7e7c42d6f0a8cb700dec11caac98dfc6bfdc7eda7a0cfe80c3fb7b5da675acf0fd29da6b70253c893183279fd1b042d1f6e450f66b1e6e29813
data/.circleci/config.yml CHANGED
@@ -58,42 +58,34 @@
58
58
 
59
59
  version: 2
60
60
  jobs:
61
- build-2-7-0:
61
+ build-3-0-1:
62
62
  <<: *dockerbuild
63
63
  docker:
64
- - image: circleci/ruby:2.7.0
64
+ - image: circleci/ruby:3.0.1
65
65
  environment:
66
66
  BUNDLE_JOBS: "3"
67
67
  BUNDLE_RETRY: "3"
68
68
  BUNDLE_PATH: /home/circleci/project/vendor/bundle
69
- build-2-6-3:
69
+ build-2-7-3:
70
70
  <<: *dockerbuild
71
71
  docker:
72
- - image: circleci/ruby:2.6.3
72
+ - image: circleci/ruby:2.7.3
73
73
  environment:
74
74
  BUNDLE_JOBS: "3"
75
75
  BUNDLE_RETRY: "3"
76
76
  BUNDLE_PATH: /home/circleci/project/vendor/bundle
77
- build-2-6-1:
78
- <<: *dockerbuild
79
- docker:
80
- - image: circleci/ruby:2.6.1
81
- environment:
82
- BUNDLE_JOBS: "3"
83
- BUNDLE_RETRY: "3"
84
- BUNDLE_PATH: vendor/bundle
85
- build-2-5-3:
77
+ build-2-6-7:
86
78
  <<: *dockerbuild
87
79
  docker:
88
- - image: circleci/ruby:2.5.3
80
+ - image: circleci/ruby:2.6.7
89
81
  environment:
90
82
  BUNDLE_JOBS: "3"
91
83
  BUNDLE_RETRY: "3"
92
- BUNDLE_PATH: vendor/bundle
93
- build-2-4-5:
84
+ BUNDLE_PATH: /home/circleci/project/vendor/bundle
85
+ build-2-6-1:
94
86
  <<: *dockerbuild
95
87
  docker:
96
- - image: circleci/ruby:2.4.5
88
+ - image: circleci/ruby:2.6.1
97
89
  environment:
98
90
  BUNDLE_JOBS: "3"
99
91
  BUNDLE_RETRY: "3"
@@ -103,8 +95,7 @@ workflows:
103
95
  version: 2
104
96
  test:
105
97
  jobs:
106
- - build-2-7-0
107
- - build-2-6-3
98
+ - build-3-0-1
99
+ - build-2-7-3
100
+ - build-2-6-7
108
101
  - build-2-6-1
109
- - build-2-5-3
110
- - build-2-4-5
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ AllCops:
2
2
  Exclude:
3
3
  - "spec/**/*"
4
4
  - "vendor/**/*"
5
- TargetRubyVersion: 2.4
5
+ TargetRubyVersion: 2.6
6
6
 
7
7
  Layout:
8
8
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -12,9 +12,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
12
12
 
13
13
  ### Added
14
14
 
15
+ ## [0.13.0] - 2021-05-07
16
+
17
+ ### Fixed
18
+
19
+ - Properly format comma when a heredoc is passed as a call argument
20
+ - Correctly interpret case statements with multiple when clauses in ERB files
21
+
22
+ ### Changed
23
+
24
+ - Dropped support for Ruby 2.4 and 2.5 as they are end of life.
25
+
26
+ ### Added
27
+
28
+ - Add Ruby 3.0.1 to test runs on CI.
29
+
15
30
  ## [0.12.0] - 2020-03-08
16
31
 
17
32
  ### Fixed
33
+
18
34
  - File.read default encode UTF-8
19
35
  - Handle case where the code is invalid but ripper does not raise an error.
20
36
  - Removed implicit dependency on `rake`.
@@ -8,6 +8,7 @@ repos = {
8
8
  "spec/rspec/core/formatters/snippet_extractor_spec.rb",
9
9
  "spec/rspec/core/metadata_spec.rb",
10
10
  "spec/rspec/core/formatters/html_formatter_spec.rb",
11
+ "spec/rspec/core/formatters_spec.rb",
11
12
  ].join(","),
12
13
  },
13
14
  }
data/docs/settings.md CHANGED
@@ -23,7 +23,7 @@ See https://github.com/ruby-formatter/rufo/issues/2 for more context!
23
23
  - [parens_in_def](#parens_in_def)
24
24
  - [trailing_commas](#trailing_commas)
25
25
  - [quote_style](#quote_style)
26
- - [includes and excludes](#includes%20and%20excludes)
26
+ - [includes and excludes](#includes-and-excludes)
27
27
 
28
28
  ### align_case_when
29
29
 
@@ -284,5 +284,5 @@ Files can be excluded or included in formatting with rufo by specifying glob pat
284
284
  For example:
285
285
  ```
286
286
  includes [*.txt,*.text]
287
- excludes [*.rb]
287
+ excludes [**/*.erb]
288
288
  ```
@@ -111,6 +111,7 @@ class Rufo::ErbFormatter
111
111
  return "begin", nil if Ripper.sexp("begin #{code_str}")
112
112
  return "begin\n", "\nend" if Ripper.sexp("begin\n#{code_str}\nend")
113
113
  return "if a\n", "\nend" if Ripper.sexp("if a\n#{code_str}\nend")
114
+ return "case a\n", "\nend" if Ripper.sexp("case a\n#{code_str}\nend")
114
115
  raise_syntax_error!(code_str)
115
116
  end
116
117
 
@@ -212,7 +212,7 @@ class Rufo::Formatter
212
212
  when :@float
213
213
  # Float literal
214
214
  #
215
- # [:@int, "123.45", [1, 0]]
215
+ # [:@float, "123.45", [1, 0]]
216
216
  consume_token :on_float
217
217
  when :@rational
218
218
  # Rational literal
@@ -1126,11 +1126,14 @@ class Rufo::Formatter
1126
1126
 
1127
1127
  found_comma = comma?
1128
1128
 
1129
+ heredoc_needs_newline = true
1130
+
1129
1131
  if found_comma
1130
1132
  if needs_trailing_newline
1131
1133
  write "," if trailing_commas && !block_arg
1132
1134
 
1133
1135
  next_token
1136
+ heredoc_needs_newline = !newline?
1134
1137
  indent(next_indent) do
1135
1138
  consume_end_of_line
1136
1139
  end
@@ -1142,7 +1145,7 @@ class Rufo::Formatter
1142
1145
  end
1143
1146
 
1144
1147
  if newline? || comment?
1145
- if needs_trailing_newline
1148
+ if needs_trailing_newline && !@last_was_heredoc
1146
1149
  write "," if trailing_commas && want_trailing_comma
1147
1150
 
1148
1151
  indent(next_indent) do
@@ -1154,7 +1157,7 @@ class Rufo::Formatter
1154
1157
  end
1155
1158
  else
1156
1159
  if needs_trailing_newline && !found_comma
1157
- write "," if trailing_commas && want_trailing_comma
1160
+ write "," if trailing_commas && want_trailing_comma && !@last_was_heredoc
1158
1161
  consume_end_of_line
1159
1162
  write_indent
1160
1163
  end
@@ -1169,8 +1172,9 @@ class Rufo::Formatter
1169
1172
  call_info << @line
1170
1173
  end
1171
1174
 
1172
- if @last_was_heredoc
1175
+ if @last_was_heredoc && heredoc_needs_newline
1173
1176
  write_line
1177
+ write_indent
1174
1178
  end
1175
1179
  consume_token :on_rparen
1176
1180
  end
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.12.0"
4
+ VERSION = "0.13.0"
5
5
  end
data/rufo.gemspec CHANGED
@@ -20,12 +20,13 @@ Gem::Specification.new do |spec|
20
20
  spec.bindir = "exe"
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
- spec.required_ruby_version = ">= 2.4.5"
23
+ spec.required_ruby_version = ">= 2.6.0"
24
24
 
25
25
  spec.add_development_dependency "bundler", ">= 1.15"
26
26
  spec.add_development_dependency "byebug", "~> 11.0.1"
27
27
  spec.add_development_dependency "guard-rspec", "~> 4.0"
28
28
  spec.add_development_dependency "rake", "~> 13.0"
29
+ spec.add_development_dependency "rexml", "~> 3.2.5"
29
30
  spec.add_development_dependency "rspec", "~> 3.0"
30
31
  spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
31
32
  spec.add_development_dependency "rubocop", "~> 0.79.0"
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.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ary Borenszweig
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-08 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rexml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.2.5
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.2.5
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -180,7 +194,7 @@ homepage: https://github.com/ruby-formatter/rufo
180
194
  licenses:
181
195
  - MIT
182
196
  metadata: {}
183
- post_install_message:
197
+ post_install_message:
184
198
  rdoc_options: []
185
199
  require_paths:
186
200
  - lib
@@ -188,15 +202,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
202
  requirements:
189
203
  - - ">="
190
204
  - !ruby/object:Gem::Version
191
- version: 2.4.5
205
+ version: 2.6.0
192
206
  required_rubygems_version: !ruby/object:Gem::Requirement
193
207
  requirements:
194
208
  - - ">="
195
209
  - !ruby/object:Gem::Version
196
210
  version: '0'
197
211
  requirements: []
198
- rubygems_version: 3.1.2
199
- signing_key:
212
+ rubygems_version: 3.2.17
213
+ signing_key:
200
214
  specification_version: 4
201
215
  summary: Ruby code formatter
202
216
  test_files: []