aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohsin Kaleem <mohkale@kisara.moe>2023-04-22 11:56:29 +0100
committerGitHub <noreply@github.com>2023-04-22 11:56:29 +0100
commite9e595f003605a7e366776c7a1715dc7093e29d5 (patch)
tree720d95dc5b4b30dee901b66c4f82892518adffe7
parent95bea3371b65ff562f91a74d52cf31cd3b883f8c (diff)
Add rufo formatter (#177)
-rw-r--r--CHANGELOG.md3
-rw-r--r--apheleia.el1
-rw-r--r--test/formatters/installers/rufo.bash2
l---------test/formatters/samplecode/rufo/in.rb1
-rw-r--r--test/formatters/samplecode/rufo/out.rb14
5 files changed, 21 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 59bff6a..977ba33 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,8 @@ The format is based on [Keep a Changelog].
* [`perltidy`](https://perltidy.sourceforge.net/) for
[perl](https://www.perl.org/) ([#175]).
* [`rubocop`](https://github.com/rubocop/rubocop) for [ruby](https://www.ruby-lang.org/en/) ([#176]).
+* [`rufo`](https://github.com/ruby-formatter/rufo) for
+ [Ruby](https://www.ruby-lang.org/en/) ([#177]).
[#168]: https://github.com/radian-software/apheleia/pull/168
[#169]: https://github.com/radian-software/apheleia/pull/169
@@ -42,6 +44,7 @@ The format is based on [Keep a Changelog].
[#174]: https://github.com/radian-software/apheleia/pull/174
[#175]: https://github.com/radian-software/apheleia/pull/175
[#176]: https://github.com/radian-software/apheleia/pull/176
+[#177]: https://github.com/radian-software/apheleia/pull/177
[#182]: https://github.com/radian-software/apheleia/pull/182
[#187]: https://github.com/radian-software/apheleia/pull/187
diff --git a/apheleia.el b/apheleia.el
index 0c6d37e..b90d051 100644
--- a/apheleia.el
+++ b/apheleia.el
@@ -141,6 +141,7 @@
sh-basic-offset)
(t 4)))
"-"))
+ (rufo . ("rufo" "--filename" filepath "--simple-exit"))
(stylua . ("stylua" "-"))
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-")))
diff --git a/test/formatters/installers/rufo.bash b/test/formatters/installers/rufo.bash
new file mode 100644
index 0000000..0dd69d2
--- /dev/null
+++ b/test/formatters/installers/rufo.bash
@@ -0,0 +1,2 @@
+apt-get install -y ruby
+gem install rufo
diff --git a/test/formatters/samplecode/rufo/in.rb b/test/formatters/samplecode/rufo/in.rb
new file mode 120000
index 0000000..2881c83
--- /dev/null
+++ b/test/formatters/samplecode/rufo/in.rb
@@ -0,0 +1 @@
+../prettier-ruby/in.rb \ No newline at end of file
diff --git a/test/formatters/samplecode/rufo/out.rb b/test/formatters/samplecode/rufo/out.rb
new file mode 100644
index 0000000..3d18313
--- /dev/null
+++ b/test/formatters/samplecode/rufo/out.rb
@@ -0,0 +1,14 @@
+d = [30644250780, 9003106878,
+ 30636278846, 66641217692, 4501790980,
+ 671_24_603036, 131_61973916, 66_606629_920,
+ 30642677916, 30643069058]; a, s = [], $*[0]
+s.each_byte { |b|
+ a << ("%036b" % d[b.
+ chr.to_i]).scan(/\d{6}/)
+}
+a.transpose.each { |a|
+ a.join.each_byte { |i|
+ print i == 49 ? ($*[1] || "#") : 32.chr
+ }
+ puts
+}