From 8e322e2da279a6df22d80bab9be5ecbceae55508 Mon Sep 17 00:00:00 2001 From: Denis Smet Date: Sat, 10 Feb 2024 21:41:24 +0400 Subject: [PATCH 1/2] Add splint to linting process and update tasks Splint has been integrated into the linting process. Changes were made in the Github workflows, project.clj and bb.edn files. Tasks for style checking, linting, and fixing have been reshuffled and updated accordingly. --- .github/workflows/main.yml | 3 +++ bb.edn | 38 ++++++++++++++++++++++---------------- project.clj | 6 ++++-- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c482801..aebef8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -107,3 +107,6 @@ jobs: - name: 🧪 Unit tests (bb + test-runner) run: bb test + + - name: 🧪 splint + run: bb style:splint || true diff --git a/bb.edn b/bb.edn index fa29eb7..4197db4 100644 --- a/bb.edn +++ b/bb.edn @@ -1,16 +1,22 @@ -{:tasks {test (shell "clojure -X:test") - lint (do (run 'style:cljfmt) - (run 'style:cljstyle) - (run 'lint:eastwood) - (run 'lint:kondo)) - style:fix (do (run 'style:fix:cljfmt) - (run 'style:fix:cljstyle)) - style:cljfmt (shell "cljfmt check") - style:cljstyle (shell "cljstyle check") - style:fix:cljfmt (shell "cljfmt fix") - style:fix:cljstyle (shell "cljstyle fix") - lint:eastwood (shell "clojure -M:test:eastwood") - lint:kondo (shell "clj-kondo --lint test src") - pre-push (do (run 'style:fix) - (run 'test) - (run 'lint))}} +{:tasks {test (shell "lein test") + ; Check style + style:cljfmt (shell "cljfmt check") + style:cljstyle (shell "cljstyle check") + style:splint (shell "lein splint ./src ./test") + lint (do (run 'style:splint) + (run 'style:cljfmt) + (run 'style:cljstyle) + (run 'lint:eastwood) + (run 'lint:kondo)) + ; Autofix style + fix:cljfmt (shell "cljfmt fix") + fix:cljstyle (shell "cljstyle fix") + fix (do (run 'fix:cljfmt) + (run 'fix:cljstyle)) + ; Linters + lint:eastwood (shell "lein eastwood") + lint:kondo (shell "clj-kondo --lint test src") + ; Local development + pre-push (do (run 'fix) + (run 'lint) + (run 'test))}} diff --git a/project.clj b/project.clj index e173447..62c64a1 100644 --- a/project.clj +++ b/project.clj @@ -9,8 +9,10 @@ :main ^:skip-aot sicp :target-path "build/%s" :plugins [[jonase/eastwood "1.4.2"]] - :profiles {:dev {:dependencies [[jonase/eastwood "1.4.2"]]} + :profiles {:dev {:dependencies [[org.clojure/clojure "1.11.1"] + [io.github.noahtheduke/splint "1.12"]]} :test {:main-opts ["-m" "cognitect.test-runner"]} :eastwood {:main-opts ["-m" "eastwood.lint" {}]} :uberjar {:aot :all} - :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}) + :jvm-opts ["-Dclojure.compiler.direct-linking=true"]} + :aliases {"splint" ["run" "-m" "noahtheduke.splint"]}) From 854e07bc52828f8fe073184db93132955936485b Mon Sep 17 00:00:00 2001 From: Denis Smet Date: Sat, 10 Feb 2024 21:43:33 +0400 Subject: [PATCH 2/2] Remove Eastwood profile and update test tasks The Eastwood profile was removed from the project.clj file. Also, the tasks in the bb.edn file were updated for testing and linting using clojure command instead of lein. The task changes provide more unified task execution and reduce dependencies. --- bb.edn | 4 ++-- project.clj | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bb.edn b/bb.edn index 4197db4..9bde4cd 100644 --- a/bb.edn +++ b/bb.edn @@ -1,4 +1,4 @@ -{:tasks {test (shell "lein test") +{:tasks {test (shell "clojure -X:test") ; Check style style:cljfmt (shell "cljfmt check") style:cljstyle (shell "cljstyle check") @@ -14,7 +14,7 @@ fix (do (run 'fix:cljfmt) (run 'fix:cljstyle)) ; Linters - lint:eastwood (shell "lein eastwood") + lint:eastwood (shell "clojure -M:test:eastwood") lint:kondo (shell "clj-kondo --lint test src") ; Local development pre-push (do (run 'fix) diff --git a/project.clj b/project.clj index 62c64a1..b5d13af 100644 --- a/project.clj +++ b/project.clj @@ -12,7 +12,6 @@ :profiles {:dev {:dependencies [[org.clojure/clojure "1.11.1"] [io.github.noahtheduke/splint "1.12"]]} :test {:main-opts ["-m" "cognitect.test-runner"]} - :eastwood {:main-opts ["-m" "eastwood.lint" {}]} :uberjar {:aot :all} :jvm-opts ["-Dclojure.compiler.direct-linking=true"]} :aliases {"splint" ["run" "-m" "noahtheduke.splint"]})