rufo 0.16.2 → 0.17.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: d9809eb345a055711f4ad309391cb96106eb90aff1cf09bcce15b537bad34e30
4
- data.tar.gz: d77f6a70aeeb5fb6143f1dec1f29d8d645fa834f7a2fd467200c7d02b99a165b
3
+ metadata.gz: 2415782555ad95778ec90751f3c438320fb1797c44213c458c0d0a7f956cf2fc
4
+ data.tar.gz: 6e2bed742d8efedef98b59b74acaef679764eeb5911e6fc0b596da1a9cec7807
5
5
  SHA512:
6
- metadata.gz: 5f43322e74c6cbdd90ca355caa0e4d17a9c625e4ea487a40807ecad7a75915531954ac287818c56a1e72566d1f25a6add653fe186d717406f9f3d4c11b8474bf
7
- data.tar.gz: c9cd5e085bfe77882b5b1215e5de7d3939ba4de9bae634d750e74bac5000511fdcbc376f6f53e2cdd1ad4703dc1b6d344da96007a2147d579c52ee7113e21510
6
+ metadata.gz: f103da0397ad0415a031601e14016d0080c9c22cac9d4b3af45a01f7f32a6fd851118d871d09272a8c41c7373ab8e77caac81b815899634eac66941e1f67121c
7
+ data.tar.gz: dcc1b6e6430818500a3238c1d403dd23abdfc840757318e1746bd388e0d1f4ce9a0df12a232bad5f6691dc69cd9cf6421ea1c74df8ed58c29453ac5260c91c4b
@@ -13,7 +13,7 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  strategy:
15
15
  matrix:
16
- ruby_version: ['3.2', '3.1', '3.0', '2.7']
16
+ ruby_version: ['3.3', '3.2', '3.1', '3.0', '2.7']
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v3
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
@@ -1,17 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
  repos = {
4
- "rspec/rspec-core" => {
5
- "--exclude-pattern" => [
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
 
@@ -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
- visit key
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
@@ -4,7 +4,7 @@ module Rufo::Settings
4
4
  align_case_when: [false, true],
5
5
  align_chained_calls: [false, true],
6
6
  trailing_commas: [true, false],
7
- quote_style: [:double, :single],
7
+ quote_style: [:double, :single, :mixed],
8
8
  includes: nil,
9
9
  excludes: nil,
10
10
  }
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.16.2"
4
+ VERSION = "0.17.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.16.2
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: 2023-07-29 00:00:00.000000000 Z
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.5.0.dev
213
+ rubygems_version: 3.4.10
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Ruby code formatter