Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cljstyle for Clojure code #333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].

## Unreleased
### Formatters
* [cljstyle](https://github.com/greglook/cljstyle)
for clojure, clojurescript, edn files.

## 4.3 (released 2024-11-12)
### Features
* New user option `apheleia-skip-functions`, like
Expand Down
1 change: 1 addition & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
(apheleia-formatters-mode-extension)
".c")))
(cljfmt . ("cljfmt" "fix" "-"))
(cljstyle . ("cljstyle" "pipe"))
(cmake-format . ("cmake-format" "-"))
(crystal-tool-format . ("crystal" "tool" "format" "-"))
(css-beautify "css-beautify" "--file" "-" "--end-with-newline"
Expand Down
1 change: 1 addition & 0 deletions test/formatters/installers/cljstyle.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl -sLO "https://raw.githubusercontent.com/greglook/cljstyle/main/util/install-cljstyle" && chmod +x install-cljstyle && ./install-cljstyle
12 changes: 12 additions & 0 deletions test/formatters/samplecode/cljstyle/in.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(ns hello
(:require [java-time.api :as t]))

(defn time-str
"Returns a string representation of a datetime in the local time zone."
[instant]
(t/format
(t/with-zone (t/formatter "hh:mm a") (t/zone-id))
instant))

(defn run [opts]
(println "Hello world, the time is" (time-str (t/instant))))
6 changes: 6 additions & 0 deletions test/formatters/samplecode/cljstyle/in.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(ns hello-world.core
(:require react-dom))

(.render js/ReactDOM
(.createElement js/React "h2" nil "Hello, React!")
(.getElementById js/document "app"))
4 changes: 4 additions & 0 deletions test/formatters/samplecode/cljstyle/in.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:deps {clojure.java-time/clojure.java-time
{:mvn/version "1.1.0"}
}
}
16 changes: 16 additions & 0 deletions test/formatters/samplecode/cljstyle/out.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(ns hello
(:require
[java-time.api :as t]))


(defn time-str
"Returns a string representation of a datetime in the local time zone."
[instant]
(t/format
(t/with-zone (t/formatter "hh:mm a") (t/zone-id))
instant))


(defn run
[opts]
(println "Hello world, the time is" (time-str (t/instant))))
8 changes: 8 additions & 0 deletions test/formatters/samplecode/cljstyle/out.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns hello-world.core
(:require
[react-dom]))


(.render js/ReactDOM
(.createElement js/React "h2" nil "Hello, React!")
(.getElementById js/document "app"))
2 changes: 2 additions & 0 deletions test/formatters/samplecode/cljstyle/out.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:deps {clojure.java-time/clojure.java-time
{:mvn/version "1.1.0"}}}
Loading