Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
background: true
- run: make migrate-db
- run: make check-dependabot
- run:
name: Check formatting
command: ./scripts/lint
- run: make lint
- run: make test
- store_test_results:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ check:
lint:
./bin/lint

.PHONY: tidy
tidy:
./scripts/tidy

.PHONY: migrate-db
migrate-db:
clojure -M:migrate-db
Expand Down
25 changes: 25 additions & 0 deletions cljfmt.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{;; Codebase keeps occasional double blank lines between top-level forms.
:remove-consecutive-blank-lines? false

:extra-indents
{;; Compojure route macros: existing style aligns the body under the
;; route path argument (default arg-alignment) rather than cljfmt's
;; built-in [:inner 0] (2-space body indent). Disable the built-in
;; rule by setting an inner depth that never matches.
ANY ^:replace [[:inner 99]]
DELETE ^:replace [[:inner 99]]
GET ^:replace [[:inner 99]]
HEAD ^:replace [[:inner 99]]
OPTIONS ^:replace [[:inner 99]]
PATCH ^:replace [[:inner 99]]
POST ^:replace [[:inner 99]]
PUT ^:replace [[:inner 99]]
context ^:replace [[:inner 99]]

;; clojure.test assertion forms: existing tests align the body
;; under the predicate's first arg.
thrown? [[:block 1]]
thrown-with-msg? [[:block 2]]

;; kerodon helper: body aligns under the selector vector.
within [[:block 1]]}}
7 changes: 5 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
;; & CVE-2024-36124
com.taoensso/nippy {:mvn/version "3.6.0"}
comb/comb {:mvn/version "1.0.0"}

digest/digest {:mvn/version "1.4.10"}
duct/duct {:mvn/version "0.8.2"}
duct/hikaricp-component {:mvn/version "0.1.2"
Expand All @@ -49,7 +49,7 @@
metosin/malli {:mvn/version "0.20.0"}
metosin/muuntaja {:mvn/version "0.6.11"}
metosin/muuntaja-yaml {:mvn/version "0.6.11"}

net.cgrand/regex {:mvn/version "1.1.0"}

;; This fork of http-kit supports :status-message to allow us to
Expand Down Expand Up @@ -105,6 +105,9 @@
:sha "d997df866b2a04b7ce7b17533093ee0a2e2cb729"}}
:main-opts ["-m" "clj-check.check"]}

:cljfmt {:extra-deps {dev.weavejester/cljfmt {:mvn/version "0.16.4"}}
:main-opts ["-m" "cljfmt.main"]}

:dev {:extra-deps
{clj-commons/pomegranate {:mvn/version "1.3.26"}

Expand Down
10 changes: 10 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Check Clojure formatting with cljfmt. See cljfmt.edn for the rule set.
# Run scripts/tidy to fix any reported issues.

set -euo pipefail

dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$dir/.."

exec clojure -M:cljfmt check src test dev build.clj
9 changes: 9 additions & 0 deletions scripts/tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Fix Clojure formatting with cljfmt. See cljfmt.edn for the rule set.

set -euo pipefail

dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$dir/.."

exec clojure -M:cljfmt fix src test dev build.clj
14 changes: 7 additions & 7 deletions src/clojars/admin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@

(defn handler [mapping]
(nrepl/default-handler
(with-meta
(fn [h]
(fn [{:keys [session] :as msg}]
(swap! session merge mapping)
(h msg)))
{:clojure.tools.nrepl.middleware/descriptor {:requires #{"clone"}
:expects #{"eval"}}})))
(with-meta
(fn [h]
(fn [{:keys [session] :as msg}]
(swap! session merge mapping)
(h msg)))
{:clojure.tools.nrepl.middleware/descriptor {:requires #{"clone"}
:expects #{"eval"}}})))

(defn init [db search storage]
(when-let [port (:nrepl-port (config))]
Expand Down