rfmt 1.7.0 → 2.0.0.beta1

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Cargo.lock +90 -1225
  4. data/Cargo.toml +6 -0
  5. data/README.md +32 -28
  6. data/ext/rfmt/Cargo.toml +9 -28
  7. data/ext/rfmt/src/ast/mod.rs +2 -0
  8. data/ext/rfmt/src/config/mod.rs +267 -30
  9. data/ext/rfmt/src/error/mod.rs +14 -3
  10. data/ext/rfmt/src/format/formatter.rs +22 -11
  11. data/ext/rfmt/src/format/registry.rs +8 -0
  12. data/ext/rfmt/src/format/rule.rs +208 -136
  13. data/ext/rfmt/src/format/rules/call.rs +14 -22
  14. data/ext/rfmt/src/format/rules/fallback.rs +4 -11
  15. data/ext/rfmt/src/format/rules/if_unless.rs +25 -3
  16. data/ext/rfmt/src/format/rules/loops.rs +3 -1
  17. data/ext/rfmt/src/format/rules/variable_write.rs +16 -9
  18. data/ext/rfmt/src/lib.rs +45 -12
  19. data/ext/rfmt/src/parser/mod.rs +2 -0
  20. data/ext/rfmt/src/parser/native_adapter.rs +2735 -0
  21. data/ext/rfmt/src/parser/prism_adapter.rs +5 -0
  22. data/ext/rfmt/src/validation.rs +69 -0
  23. data/ext/rfmt/tests/fixtures/parity/comments_mixed.rb +9 -0
  24. data/ext/rfmt/tests/fixtures/parity/constructs.rb +50 -0
  25. data/ext/rfmt/tests/fixtures/parity/embdoc.rb +12 -0
  26. data/ext/rfmt/tests/fixtures/parity/heredoc_assign.rb +15 -0
  27. data/ext/rfmt/tests/fixtures/parity/heredoc_call_args.rb +17 -0
  28. data/ext/rfmt/tests/fixtures/parity/metadata_classes.rb +30 -0
  29. data/ext/rfmt/tests/fixtures/parity/metadata_conditionals.rb +14 -0
  30. data/ext/rfmt/tests/fixtures/parity/metadata_defs.rb +33 -0
  31. data/ext/rfmt/tests/fixtures/parity/multibyte.rb +14 -0
  32. data/ext/rfmt/tests/fixtures/parity/numeric.rb +6 -0
  33. data/ext/rfmt/tests/fixtures/parity/plain.rb +31 -0
  34. data/ext/rfmt/tests/native_parity.rs +245 -0
  35. data/ext/rfmt/tests/ruby_prism_smoke.rs +66 -0
  36. data/lib/rfmt/cli.rb +37 -7
  37. data/lib/rfmt/configuration.rb +2 -20
  38. data/lib/rfmt/version.rb +1 -1
  39. data/lib/rfmt.rb +47 -19
  40. metadata +17 -18
  41. data/lib/rfmt/prism_bridge.rb +0 -529
  42. data/lib/rfmt/prism_node_extractor.rb +0 -115
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0859791a44c6bb50fb43c42d132ed44da02bd39c61c48fd23258bf6277dddfa
4
- data.tar.gz: fa2ecf36f2cf0bb5c478470a80587c7939a533e613341139598aebd95c07b5c1
3
+ metadata.gz: 678881f120ed1adc5a4409bca84a9b3db43aceb787127f24b5e1da47b255bf9a
4
+ data.tar.gz: a049b27468de19a7c000e680d281bd526b8852496d63d059c7d031492e59e401
5
5
  SHA512:
6
- metadata.gz: 067c43a9db65ff398d3a4c7ab4166084cb0796dbdeb4908aa925f93f0b833bcd8f65b4abf254f786b17d0adc122958979d8d922af65183531b51bfd7adfae222
7
- data.tar.gz: e1d7acad6ca7efa9885f25e3408638842875aa801ec73506d4fb29010bd31efd51a91d59b200ab318e0e5cbb22433447dadf7128bf1d0ad76c88217d75dd9a42
6
+ metadata.gz: ec032838e0d79378a07aad055f242cb607311bb61f57a404a561273c57f5cc205670d71d4e3ac5118c7a9425ff43e3b41b80e2989684cbe7612d60b09fb06a40
7
+ data.tar.gz: 4e9126f811656e0bf14015f8eb264184070b2387194f0c1c977c3939197dfa7ec91f9e8147624c94ed4c5dd879fdeb3dc8cfc51be1e6195f62b4be7acade2a0b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [2.0.0.beta1] - 2026-07-22
4
+
5
+ Parsing now happens natively in Rust. The Ruby-side Prism parse and JSON handoff have been replaced by the ruby-prism crate with prism statically linked into the extension; Ruby remains the CLI/LSP shell.
6
+
7
+ ### Changed
8
+
9
+ - Native parsing via the ruby-prism crate: in-process formatting is about 22x faster: 0.19 ms/file measured with `scripts/bench_format.rb`, against a historical pre-migration baseline of 4.28 ms/file
10
+ - `--config` is now honored when formatting
11
+ - File writes are atomic (write to a temp file, then rename)
12
+
13
+ ### Added
14
+
15
+ - Output-validation guard: formatted output is re-parsed and rejected if it fails to parse
16
+ - Corpus check (`scripts/corpus_check.rb`): reformats every Ruby file in the repository and verifies AST equivalence with the prism gem; runs in CI alongside the parity fixtures
17
+
18
+ ### Fixed
19
+
20
+ - The `__END__` data section is no longer dropped from formatted output; everything from `__END__` to EOF is preserved byte-for-byte
21
+ - Method chain continuation indentation is now computed from the statement's output position instead of its input column, so misindented input converges in a single pass; heredoc bodies inside a reformatted chain keep their content byte-identical
22
+ - A trailing comment on an `else` line stays on that line instead of moving below it
23
+
24
+ ### Removed
25
+
26
+ - prism gem runtime dependency; it remains a development-only dependency for the corpus check and parity fixtures
27
+
3
28
  ## [1.7.0] - 2026-06-04
4
29
 
5
30
  rfmt now ships a standalone LSP server. Point any LSP-capable editor at `rfmt-lsp` and you get format-on-save — no Ruby LSP, no Gemfile, and no editor-specific plugin required. This makes rfmt usable from Helix, Neovim, Emacs, and any other LSP client, including in projects that don't bundle rfmt.