Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Adams committed Dec 23, 2024
1 parent dd613bf commit ad3f29b
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/deps.edn') }}
- name: Lint
run: bin/lint
- name: Run All Tests
run: clojure -M:dev:test:test-runner
# - name: Run All Tests
# run: clojure -M:dev:test:test-runner
2 changes: 1 addition & 1 deletion bases/app/src/sepal/app/routes/accession/create.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
:x-on:click "dirty && confirm('Are you sure you want to lose your changes?') && history.back()"}
"Cancel"]])

(defn render [& {:keys [errors org values]}]
(defn render [& {:keys [errors values]}]
(-> (page/page :attrs {:x-data "accessionFormData"}
:content (page-content :errors errors
:values values)
Expand Down
13 changes: 5 additions & 8 deletions bases/app/src/sepal/app/routes/accession/detail/media.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
:key :media
:href (z/url-for accession.routes/detail-media {:id (:accession/id accession)})}])

(defn page-content [& {:keys [media org page page-size accession]}]
(defn page-content [& {:keys [media page page-size accession]}]
[:div {:x-data (json/js {:selected nil})
:class "flex flex-col gap-8"}

Expand All @@ -60,11 +60,10 @@
[:script {:type "module"
:src (html/static-url "app/routes/media/media.ts")}]])

(defn render [& {:keys [org page page-size media accession]}]
(defn render [& {:keys [page page-size media accession]}]
(page/page :page-title "Media"
:page-title-buttons (title-buttons)
:content (page-content :org org
:page page
:content (page-content :page page
:page-size page-size
:media media
:accession accession)))
Expand All @@ -75,7 +74,7 @@
[:page-size {:default 10} :int]])

(defn handler [{:keys [::z/context htmx-boosted? htmx-request? query-params]}]
(let [{:keys [db imgix-media-domain organization resource]} context
(let [{:keys [db imgix-media-domain resource]} context
{:keys [page page-size]} (params/decode Params query-params)
offset (* page-size (- page 1))
limit page-size
Expand All @@ -90,16 +89,14 @@
;; TODO: if a media instance is unlinked then we need to remove it from the
;; resource media list page

;; TODO: Need to make sure the media are owned by the organization
(if (and htmx-request? (not htmx-boosted?))
(-> (media.ui/media-list-items :media media
:next-page-url (when (>= (count media) page-size)
(next-page-url :accession resource
:current-page page))
:page page)
(html/render-partial))
(render :org organization
:media media
(render :media media
:page 1
:page-size page-size
:accession resource))))
3 changes: 1 addition & 2 deletions bases/app/src/sepal/app/routes/activity/index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[sepal.app.routes.accession.routes :as accession.routes]
[sepal.app.routes.location.routes :as location.routes]
[sepal.app.routes.material.routes :as material.routes]
[sepal.app.routes.media.routes :as media.routes]
[sepal.app.routes.taxon.routes :as taxon.routes]
[sepal.app.ui.icons.heroicons :as heroicons]
[sepal.app.ui.page :as page]
Expand Down Expand Up @@ -149,7 +148,7 @@

(defmethod activity-description material.activity/updated
[& {:keys [activity]}]
(let [{:keys [accession material user]} activity]
(let [{:keys [material user]} activity]
(timeline-activity :title [:span (str (:user/email user) " updated material ")
[:a {:class "spl-link"
:href (z/url-for material.routes/detail
Expand Down
4 changes: 2 additions & 2 deletions bases/app/src/sepal/app/routes/auth/login.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
[sepal.user.interface :as user.i]
[zodiac.core :as z]))

(defn send-verification-email [email]
#_(defn send-verification-email [email]
;; TODO: bump
)
)

;; TODO: Use htmx to submit so we don't do a full page reload

Expand Down
8 changes: 3 additions & 5 deletions bases/app/src/sepal/app/routes/location/index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:onclick "document.getElementById('q').value = null; this.form.submit()"}
(heroicons/outline-x :size 20)]])

(defn create-button [& {:keys [org]}]
(defn create-button [& {:keys []}]
[:a {:class (html/attr "inline-flex" "items-center" "justify-center" "rounded-md"
"border" "border-transparent" "bg-green-700" "px-4" "py-2"
"text-sm" "font-medium" "text-white" "shadow-sm" "hover:bg-green-700"
Expand Down Expand Up @@ -57,19 +57,18 @@
:page-size page-size
:total total))])

(defn render [& {:keys [href org page-num page-size rows total]}]
(defn render [& {:keys [href page-num page-size rows total]}]
(pages.list/render :content (table :href href
:page-num page-num
:page-size page-size
:rows rows
:total total)
:page-title "Locations"
:page-title-buttons (create-button :org org)
:page-title-buttons (create-button)
:table-actions (search-field (-> href uri/query-map :q))))

(defn handler [& {:keys [::z/context headers query-params uri]}]
(let [{:keys [db]} context
org (:organization context)
;; TODO: validate page and page size
{:strs [page page-size q]
:or {page-size default-page-size}} query-params
Expand Down Expand Up @@ -99,7 +98,6 @@
:description (:location/description location)}))
(render :href (uri/uri-str {:path uri
:query (uri/map->query-string query-params)})
:org org
:rows rows
:page-num page-num
:page-size page-size
Expand Down
8 changes: 3 additions & 5 deletions bases/app/src/sepal/app/routes/material/index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
:onclick "document.getElementById('q').value = null; this.form.submit()"}
(heroicons/outline-x :size 20)]])

(defn create-button [& {:keys [org]}]
(defn create-button [& {:keys []}]
[:a {:class (html/attr "inline-flex" "items-center" "justify-center" "rounded-md"
"border" "border-transparent" "bg-green-700" "px-4" "py-2"
"text-sm" "font-medium" "text-white" "shadow-sm" "hover:bg-green-700"
Expand Down Expand Up @@ -73,19 +73,18 @@
:page-size page-size
:total total))])

(defn render [& {:keys [href org page-num page-size rows total]}]
(defn render [& {:keys [href page-num page-size rows total]}]
(pages.list/render :content (table :href href
:page-num page-num
:page-size page-size
:rows rows
:total total)
:page-title "Materials"
:page-title-buttons (create-button :org org)
:page-title-buttons (create-button)
:table-actions (search-field (-> href uri/query-map :q))))

(defn handler [& {:keys [::z/context headers query-params uri]}]
(let [{:keys [db]} context
org (:organization context)
;; TODO: validate page and page size
{:strs [page page-size q]
:or {page-size default-page-size}} query-params
Expand Down Expand Up @@ -125,7 +124,6 @@
:accession-id (:material/accession-id material)}))
(render :href (uri/uri-str {:path uri
:query (uri/map->query-string query-params)})
:org org
:rows rows
:page-num page-num
:page-size page-size
Expand Down
2 changes: 1 addition & 1 deletion bases/app/src/sepal/app/routes/media/detail.clj
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
:dl-url dl-url)))

(defn handler [& {:keys [::z/context request-method] :as _request}]
(let [{:keys [db organization resource imgix-media-domain s3-client]} context
(let [{:keys [db resource imgix-media-domain s3-client]} context
srcset-opts {;;:h 2048
;;:w 2048
;; :fit "clip"
Expand Down
12 changes: 5 additions & 7 deletions bases/app/src/sepal/app/routes/taxon/detail/media.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
:key :media
:href (z/url-for taxon.routes/detail-media {:id (:taxon/id taxon)})}])

(defn page-content [& {:keys [media org page page-size taxon]}]
(defn page-content [& {:keys [media page page-size taxon]}]
[:div {:x-data (json/js {:selected nil})
:class "flex flex-col gap-8"}

Expand All @@ -60,11 +60,10 @@
[:script {:type "module"
:src (html/static-url "app/routes/media/media.ts")}]])

(defn render [& {:keys [org page page-size media taxon]}]
(defn render [& {:keys [page page-size media taxon]}]
(page/page :page-title "Media"
:page-title-buttons (title-buttons)
:content (page-content :org org
:page page
:content (page-content :page page
:page-size page-size
:media media
:taxon taxon)))
Expand All @@ -75,7 +74,7 @@
[:page-size {:default 10} :int]])

(defn handler [{:keys [::z/context htmx-boosted? htmx-request? query-params]}]
(let [{:keys [db imgix-media-domain organization resource]} context
(let [{:keys [db imgix-media-domain resource]} context
{:keys [page page-size]} (params/decode Params query-params)
offset (* page-size (- page 1))
limit page-size
Expand All @@ -99,8 +98,7 @@
:current-page page))
:page page)
(html/render-partial))
(render :org organization
:media media
(render :media media
:page 1
:page-size page-size
:taxon resource))))
3 changes: 1 addition & 2 deletions bases/app/src/sepal/app/ui/sidebar/mobile.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns sepal.app.ui.sidebar.mobile
(:require [sepal.app.globals :as g]
[sepal.app.routes.accession.routes :as accession.routes]
(:require [sepal.app.routes.accession.routes :as accession.routes]
[sepal.app.routes.activity.routes :as activity.routes]
[sepal.app.routes.location.routes :as location.routes]
[sepal.app.routes.material.routes :as material.routes]
Expand Down
4 changes: 1 addition & 3 deletions bases/app/test/sepal/app/routes/auth/register_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
[malli.generator :as mg]
[matcher-combinators.test :refer [match?]]
[peridot.core :as peri]
[ring.middleware.session.store :as store]
[sepal.app.test.system :refer [*app* *db* *system* default-system-fixture]]
[sepal.user.interface :as user.i]
[sepal.user.interface.spec :as user.spec])
(:import [org.jsoup Jsoup]))

(use-fixtures :once default-system-fixture)

(deftest register-test
(let [db *db*]
(let [_db *db*]
(testing "get"
(let [resp (*app* {:request-method :get
:uri "/register"})
Expand Down
5 changes: 3 additions & 2 deletions components/activity/test/sepal/activity/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns sepal.activity.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.activity.interface :as activity]))
(:require
#_[sepal.activity.interface :as activity]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
5 changes: 3 additions & 2 deletions components/aws-s3/test/sepal/aws_s3/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns sepal.aws-s3.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.aws-s3.interface :as aws-s3]))
(:require
#_[sepal.aws-s3.interface :as aws-s3]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
5 changes: 3 additions & 2 deletions components/config/test/sepal/config/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(ns sepal.config.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.config.interface :as config]))
(:require
#_[sepal.config.interface :as config]
[clojure.test :as test :refer :all]))
5 changes: 3 additions & 2 deletions components/database/test/sepal/database/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns sepal.database.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.database.interface :as database]))
(:require
#_[sepal.database.interface :as database]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
5 changes: 3 additions & 2 deletions components/error/test/sepal/error/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns sepal.error.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.error.interface :as error]))
(:require
#_[sepal.error.interface :as error]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
2 changes: 1 addition & 1 deletion components/location/src/sepal/location/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(create-ns 'sepal.location.interface)
(alias 'loc.i 'sepal.location.interface)

(defn factory [{:keys [db organization] :as args}]
(defn factory [{:keys [db] :as args}]
(let [data (mg/generate spec/CreateLocation)
result (create! db data)]
(vary-meta result assoc :db db)))
Expand Down
1 change: 0 additions & 1 deletion components/location/test/sepal/location/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns sepal.location.interface-test
(:require [clojure.test :as test :refer :all]
[integrant.core :as ig]
[malli.core :as m]
[malli.generator :as mg]
[matcher-combinators.test :refer [match?]]
Expand Down
6 changes: 1 addition & 5 deletions components/media/src/sepal/media/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
[malli.generator :as mg]
[malli.transform :as mt]
[next.jdbc.sql :as jdbc.sql]
[sepal.accession.interface :as accession.i]
[sepal.database.interface :as db.i]
[sepal.error.interface :as error.i]
[sepal.location.interface :as location.i]
[sepal.material.interface :as material.i]
[sepal.media.interface.spec :as spec]
[sepal.store.interface :as store.i]
[sepal.taxon.interface :as taxon.i]))
[sepal.store.interface :as store.i]))

(defn get-by-id [db id]
(store.i/get-by-id db :media id spec/Media))
Expand Down
4 changes: 2 additions & 2 deletions components/postmark/test/sepal/postmark/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns sepal.postmark.interface-test
(:require [clojure.test :as test :refer :all]
[sepal.postmark.interface :as postmark]))
(:require #_[sepal.postmark.interface :as postmark]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
3 changes: 1 addition & 2 deletions components/store/src/sepal/store/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
(:require [malli.core :as m]
[malli.transform :as mt]
[next.jdbc.sql :as jdbc.sql]
[sepal.database.interface :as db.i]
[sepal.error.interface :as error.i]))
[sepal.database.interface :as db.i]))

(def transformer
(mt/transformer
Expand Down
4 changes: 2 additions & 2 deletions components/store/test/sepal/store/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns sepal.store.interface-test
(:require [clojure.test :as test :refer :all]
[sepal.store.interface :as store]))
(:require #_[sepal.store.interface :as store]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
1 change: 0 additions & 1 deletion components/taxon/test/sepal/taxon/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns sepal.taxon.interface-test
(:require [clojure.test :as test :refer :all]
[integrant.core :as ig]
[malli.generator :as mg]
[matcher-combinators.test :refer [match?]]
[next.jdbc.sql :as jdbc.sql]
Expand Down
5 changes: 3 additions & 2 deletions components/test/test/sepal/test/interface_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns sepal.test.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.test.interface :as test]))
(:require
#_[sepal.test.interface :as test]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
3 changes: 1 addition & 2 deletions components/user/src/sepal/user/interface/spec.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns sepal.user.interface.spec
(:require [sepal.store.interface :as store.i]
[sepal.validation.interface :refer [email-re]]))
(:require [sepal.validation.interface :refer [email-re]]))

(def id pos-int?)
(def email [:re {:error/message "invalid email"} email-re])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns sepal.validation.interface-test
(:require [clojure.test :as test :refer :all]
#_[sepal.validation.interface :as validation]))
(:require
#_[sepal.validation.interface :as validation]
[clojure.test :as test :refer :all]))

(deftest dummy-test
(is (= 1 1)))
Loading

0 comments on commit ad3f29b

Please sign in to comment.