rufo 0.16.2 → 0.17.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 +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/CHANGELOG.md +19 -0
- data/bin/verify-sample-code +2 -11
- data/docs/settings.md +3 -0
- data/lib/rufo/formatter.rb +20 -1
- data/lib/rufo/settings.rb +1 -1
- 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: 2415782555ad95778ec90751f3c438320fb1797c44213c458c0d0a7f956cf2fc
|
4
|
+
data.tar.gz: 6e2bed742d8efedef98b59b74acaef679764eeb5911e6fc0b596da1a9cec7807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f103da0397ad0415a031601e14016d0080c9c22cac9d4b3af45a01f7f32a6fd851118d871d09272a8c41c7373ab8e77caac81b815899634eac66941e1f67121c
|
7
|
+
data.tar.gz: dcc1b6e6430818500a3238c1d403dd23abdfc840757318e1746bd388e0d1f4ce9a0df12a232bad5f6691dc69cd9cf6421ea1c74df8ed58c29453ac5260c91c4b
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -12,6 +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.17.0] - 2024-01-06
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
### Added
|
22
|
+
- Add Ruby 3.3 to test runs on CI. ([#314](https://github.com/ruby-formatter/rufo/issues/314))
|
23
|
+
- Add `mixed` option for quote_style setting. ([#315](https://github.com/ruby-formatter/rufo/issues/315))
|
24
|
+
|
25
|
+
## [0.16.3] - 2023-11-09
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
- Fix Bug: Support hash literal pattern with quoted key ([#312](https://github.com/ruby-formatter/rufo/issues/312))
|
29
|
+
|
30
|
+
### Changed
|
31
|
+
|
32
|
+
### Added
|
33
|
+
|
15
34
|
## [0.16.2] - 2023-07-29
|
16
35
|
|
17
36
|
### Fixed
|
data/bin/verify-sample-code
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
repos = {
|
4
|
-
"
|
5
|
-
"--
|
6
|
-
"spec/rspec/core/world_spec.rb",
|
7
|
-
"spec/rspec/core/formatters/exception_presenter_spec.rb",
|
8
|
-
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
|
9
|
-
"spec/rspec/core/metadata_spec.rb",
|
10
|
-
"spec/rspec/core/formatters/html_formatter_spec.rb",
|
11
|
-
"spec/rspec/core/formatters_spec.rb",
|
12
|
-
"spec/rspec/core/formatters/documentation_formatter_spec.rb",
|
13
|
-
"spec/rspec/core/formatters/progress_formatter_spec.rb"
|
14
|
-
].join(","),
|
4
|
+
"lostisland/faraday" => {
|
5
|
+
"--format" => "progress",
|
15
6
|
},
|
16
7
|
}
|
17
8
|
|
data/docs/settings.md
CHANGED
@@ -227,6 +227,7 @@ Use the specified quotation marks.
|
|
227
227
|
|
228
228
|
- `:double`: (default) use doublequotations unless one or more escaped double-quotations are included
|
229
229
|
- `:single`: use single quotations unless one or more interpolations `#{}` or escaped single quotations are included
|
230
|
+
- `:mixed`: use mixed quotations if you don't want to change quotes
|
230
231
|
|
231
232
|
This does not affect `%q()` (single), `%Q()` (double), or quotation marks within heredocs.
|
232
233
|
|
@@ -278,6 +279,8 @@ code = <<CODE
|
|
278
279
|
CODE
|
279
280
|
```
|
280
281
|
|
282
|
+
With `:mixed`, the formatter will keep lines as is
|
283
|
+
|
281
284
|
### Includes and excludes
|
282
285
|
Files can be excluded or included in formatting with rufo by specifying glob patterns for the `includes` or `excludes` configuration options. Multiple patterns are separated by a comma.
|
283
286
|
|
data/lib/rufo/formatter.rb
CHANGED
@@ -636,6 +636,7 @@ class Rufo::Formatter
|
|
636
636
|
|
637
637
|
# should we format this string according to :quote_style?
|
638
638
|
def should_format_string?(string)
|
639
|
+
return if quote_style == :mixed
|
639
640
|
# don't format %q or %Q
|
640
641
|
return unless current_token_value == "'" || current_token_value == '"'
|
641
642
|
# don't format strings containing slashes
|
@@ -2315,6 +2316,12 @@ class Rufo::Formatter
|
|
2315
2316
|
write_indent next_indent
|
2316
2317
|
end
|
2317
2318
|
next_token
|
2319
|
+
|
2320
|
+
# fix for 3.3 ripper change. two :on_words_sep are generated for "#\n "
|
2321
|
+
while current_token_kind == :on_words_sep
|
2322
|
+
next_token
|
2323
|
+
end
|
2324
|
+
|
2318
2325
|
has_space = true if current_token_value.start_with?(" ")
|
2319
2326
|
end
|
2320
2327
|
|
@@ -2337,6 +2344,10 @@ class Rufo::Formatter
|
|
2337
2344
|
next_token
|
2338
2345
|
write_line
|
2339
2346
|
write_indent(column)
|
2347
|
+
# two :on_words_sep are generated for "#\n " on ruby 3.3
|
2348
|
+
while current_token_kind == :on_words_sep
|
2349
|
+
next_token
|
2350
|
+
end
|
2340
2351
|
else
|
2341
2352
|
next_token
|
2342
2353
|
write_space
|
@@ -3310,7 +3321,15 @@ class Rufo::Formatter
|
|
3310
3321
|
|
3311
3322
|
visit_literal_elements elements, inside_hash: true, token_column: token_column, keep_final_newline: expected_right_token.nil? do |element|
|
3312
3323
|
key, value = element
|
3313
|
-
|
3324
|
+
|
3325
|
+
if current_token_kind == :on_tstring_beg
|
3326
|
+
consume_token :on_tstring_beg
|
3327
|
+
visit key
|
3328
|
+
consume_token :on_label_end
|
3329
|
+
else
|
3330
|
+
visit key
|
3331
|
+
end
|
3332
|
+
|
3314
3333
|
if value
|
3315
3334
|
consume_space
|
3316
3335
|
visit value
|
data/lib/rufo/settings.rb
CHANGED
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.
|
4
|
+
version: 0.17.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:
|
11
|
+
date: 2024-01-06 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.4.10
|
214
214
|
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: Ruby code formatter
|