Skip to content

Commit

Permalink
All: Formatting adjusted (#267)
Browse files Browse the repository at this point in the history
* Update all zprintrcs

* Formatting done

* code alias error fixed
  • Loading branch information
Kaspazza committed Jan 18, 2024
1 parent bcede8b commit 0a1da57
Show file tree
Hide file tree
Showing 309 changed files with 9,846 additions and 5,292 deletions.
1 change: 1 addition & 0 deletions .clj-kondo/babashka/fs/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:lint-as {babashka.fs/with-temp-dir clojure.core/let}}
1 change: 1 addition & 0 deletions .clj-kondo/babashka/sci/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:hooks {:macroexpand {sci.core/copy-ns sci.core/copy-ns}}}
9 changes: 9 additions & 0 deletions .clj-kondo/babashka/sci/sci/core.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(ns sci.core)

(defmacro copy-ns
([ns-sym sci-ns]
`(copy-ns ~ns-sym ~sci-ns nil))
([ns-sym sci-ns opts]
`[(quote ~ns-sym)
~sci-ns
(quote ~opts)]))
7 changes: 7 additions & 0 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{:lint-as {me.raynes.conch/programs clojure.core/declare
me.raynes.conch/let-programs clojure.core/let
day8.re-frame.tracing/fn-traced clojure.core/fn
outpace.config/defconfig clojure.core/def
spade.core/defclass clojure.core/defn
mount.core/defstate clojure.core/def
spade.core/defglobal clojure.core/def}}
2 changes: 2 additions & 0 deletions .clj-kondo/hiccup/hiccup/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:lint-as {hiccup.def/defhtml clojure.core/defn}
:hooks {:analyze-call {hiccup.def/defelem hiccup.hooks/defelem}}}
38 changes: 38 additions & 0 deletions .clj-kondo/hiccup/hiccup/hiccup/hooks.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(ns hiccup.hooks
(:require [clj-kondo.hooks-api :as api]
[clojure.set :as set]))

;; See https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md

(defn- parse-defn [elems]
(let [[fhead fbody] (split-with #(not (or (api/vector-node? %)
(api/list-node? %)))
elems)
arities (if (api/vector-node? (first fbody))
(list (api/list-node fbody))
fbody)]
[fhead arities]))

(defn- count-args [arity]
(let [args (first (api/sexpr arity))]
(if (= '& (fnext (reverse args)))
true ; unbounded args
(count args))))

(defn- dummy-arity [arg-count]
(api/list-node
(list
(api/vector-node
(vec (repeat arg-count (api/token-node '_)))))))

(defn defelem [{:keys [node]}]
(let [[_ & rest] (:children node)
[fhead arities] (parse-defn rest)
arg-counts (set (filter number? (map count-args arities)))
dummy-arg-counts (set/difference (set (map inc arg-counts)) arg-counts)
dummy-arities (for [n dummy-arg-counts] (dummy-arity n))]
{:node
(api/list-node
(list*
(api/token-node 'clojure.core/defn)
(concat fhead arities dummy-arities)))}))
3 changes: 3 additions & 0 deletions .clj-kondo/http-kit/http-kit/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

{:hooks
{:analyze-call {org.httpkit.server/with-channel httpkit.with-channel/with-channel}}}
16 changes: 16 additions & 0 deletions .clj-kondo/http-kit/http-kit/httpkit/with_channel.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(ns httpkit.with-channel
(:require [clj-kondo.hooks-api :as api]))

(defn with-channel [{node :node}]
(let [[request channel & body] (rest (:children node))]
(when-not (and request channel) (throw (ex-info "No request or channel provided" {})))
(when-not (api/token-node? channel) (throw (ex-info "Missing channel argument" {})))
(let [new-node
(api/list-node
(list*
(api/token-node 'let)
(api/vector-node [channel (api/vector-node [])])
request
body))]

{:node new-node})))
2 changes: 2 additions & 0 deletions .clj-kondo/metosin/malli/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:lint-as {malli.experimental/defn schema.core/defn}
:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}
5 changes: 5 additions & 0 deletions .clj-kondo/rewrite-clj/rewrite-clj/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{:lint-as
{rewrite-clj.zip/subedit-> clojure.core/->
rewrite-clj.zip/subedit->> clojure.core/->>
rewrite-clj.zip/edit-> clojure.core/->
rewrite-clj.zip/edit->> clojure.core/->>}}
15 changes: 15 additions & 0 deletions .github/workflows/commit_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Commit validation
run-name: ${{ github.event.head_commit.message }} pushed by ${{ github.actor }}, to test and lint - $${{ github.sha }}
on: [push]
jobs:
run-bb:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir, See https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Base image
uses: docker://hephaistox/gha-automaton-build:v0.0.1
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ docs/codox
**/.cpcache/
**/.cache
**/*.class
**/*.main.css
**/*.styles.css

# Log files
**/*.log
Expand Down Expand Up @@ -43,4 +43,3 @@ docs/codox
#tmp-directory
tmp
repos
containers
12 changes: 12 additions & 0 deletions .zprintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
;;See [doc](https://github.com/kkinnear/zprint/blob/d0bb27e51ac97b1cdae5ea32b9b953f66cd650b2/doc/reference.md#introduction-to-configuration) for more details
{:style [:community
:how-to-ns
:require-justify
:sort-dependencies
:backtranslate
:hiccup]
:map {:comma? false
:force-nl? true}
:pair {:force-nl? true}
:pair-fn {:hang? false}
:comment {:wrap? false}}
63 changes: 55 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,55 @@
# Monorepo tools
This subproject contains code factorized for CI/CD, it is meant for:
* Development using `everything` project,
* To manage all `bb` tasks of all customer projects,
* Manage `bb` tasks of automaton projects
* Manage all complimentary tasks, like templating, docker image creation and so on.
* Clojure root directory is where all clojure code should be stored. So `everything` project can gather all of it
* Root directory is different as some commands should be executed from there.
# automaton-build

Project used by all other Hephaistox projects to build, publish, update them

It has many use-cases:

* cust-app projects
* automaton projects
* automaton-build itself
* the monorepo

## Project design decisions

automaton-build has the following objectives:
* being usable for all kind of projects
* Description:
* shadow-cljs is not necessary or meaningful for all projects
* even if there are shadow-cljs, there may be no target build in that project (like automaton-web, automaton-core, ...)
* Rationale:
* most of that features are the same for all projects, our one source of truth apply to it
* Consequences:
* Each project has full control on what's the list of tasks, their name, comments,
* We can simply reuse tasks
* project flexibility
* Description:
* Even if all projects could comply to the standard tasks, it is flexible to add its own, or change the existing ones
* Rationale:
* even if most of the time all projects are identical, we may have some specificites due to certain technologies,
* or some specificies for some customers,
* Consequences :
* `build_config.edn` is different for each app, and contains main differentiators
* the code of each task could be wrapped or rewritten
* bb.edn are as simple as possible, so update, copy of them is quite simple
* Description:
* to have only the description of the tasks to use
* Rationale:
* as few code there is in bb.edn, as it is easy to copy paste a new version in it,
* Consequences:
* nearly all code is stored in automaton_build

## How to use the project

* Adding tasks in a project consists in is
* task selection
* reuse a task in a project is simple, just pick a function with `opts` parameter in tasks directories
* and add that entry in the `bb.edn` file
* parameters updating in `build_config.edn`

## Creates a new tasks
* First prepare all the building blocks in the appropriate namespaces
* Then, a task should be created in the `tasks` directory, in an existing namespace or a new one, the grouping should be done logically so that the tasks are easy to find,
* By default, tasks are added without the `:clj` options, meaning that everything is run in babashka, you'll need to change it to `:clj` to execute it in clojure mode if
* the dependencies are not compatible with babashka
* so the function should be changed to a namespace with a `_clj` suffix, so that the babashka functions are not polluted with the dependency
* Consider to add this task in `la` for testing
13 changes: 13 additions & 0 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{:deps {djblue/portal {:mvn/version "0.51.1"}
io.github.clojure/tools.build {:mvn/version "0.9.6"}
metosin/malli {:mvn/version "0.13.0"}
org.clojure/tools.cli {:mvn/version "1.0.219"}}
:paths ["src/clj" "test_la/clj"]
:tasks {:requires [[automaton-build.tasks.launcher.bb-entrypoint :as build-task-bb-entrypoint] [babashka.process :as babahska-process]]
heph-task {:doc "Launch an Hephaistox task"
:task (System/exit (build-task-bb-entrypoint/-main *command-line-args*))}
lconnect {:doc
"Repl in case automaton-build is failing. Using -f or --force cli arguments to force start if some part are failing"
:task (try (-> (babahska-process/shell "clojure" "-M:common-test:env-development-repl:build" *command-line-args*)
System/exit)
(catch Exception e (println "Repl failed also - error during repl startup" (ex-message e))))}}}
25 changes: 18 additions & 7 deletions build_config.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{:monorepo {:app-dir "automaton/automaton-build"}
:publication {:repo-address "[email protected]:hephaistox/automaton-build.git"
:as-lib hephaistox/automaton-build
:branch "main"}
:app-name "automaton-build"
:build? true
:cust-app? false}
{:app-name "automaton-build"
:task-shared {:gha {}
:publication {:as-lib org.clojars.hephaistox/automaton-build
:deploy-to :clojars
:license {}
:major-version "0.0.%d"
:repo
"[email protected]:hephaistox/automaton-build.git"}
:repl-aliases [:common-test :env-development-repl :build]
:storage-datomic {}}
:tasks {:clean {:dirs [".cpcache/"
".clj-kondo/.cache/"
"tmp/"
"target/"
"node_modules/"
".shadow-cljs/builds/"]}
:reports {:forbiddenwords-words #{"automaton-core" "automaton-web"
"landing" "tap>"}}}}
89 changes: 61 additions & 28 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,28 +1,61 @@
{:paths ["src/clj"
"src/cljc"
"test/clj"
"test/resources"]
:aliases {:repl {:extra-paths ["env/dev/src/clj"
"env/dev/resources"]}}

:deps {hephaistox/automaton-core {:sha "f9923f55226b4ba531a1a985490052597885d72d"
:git/url "https://github.com/hephaistox/automaton-core"}
babashka/fs {:mvn/version "0.2.12"}
babashka/process {:mvn/version "0.3.11"}
;; Log
org.apache.logging.log4j/log4j-api {:mvn/version "2.19.0"}
org.clojure/tools.logging {:mvn/version "1.2.4"}
org.apache.logging.log4j/log4j-core {:mvn/version "2.19.0"}
org.slf4j/slf4j-nop {:mvn/version "2.0.4"}

codox/codox #:mvn{:version "0.10.8"},
metosin/malli #:mvn{:version "0.9.2"}
com.github.liquidz/antq {:mvn/version "2.2.962"}
danlentz/clj-uuid #:mvn{:version "0.1.9"}
zprint/zprint {:mvn/version "1.2.7"}
clj-htmltopdf/clj-htmltopdf #:mvn{:version "0.2.1"}
hiccup/hiccup #:mvn{:version "2.0.0-RC1"}
markdown-clj/markdown-clj #:mvn{:version "1.11.4"}}
:jvm-opts ["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
"-Dlog4j.configurationFile=log4j2-build.xml"]
:ns-default automaton-build.monorepo.core}
{:aliases
{:bb-deps {:extra-deps {djblue/portal {:mvn/version "0.51.1"}
io.github.clojure/tools.build {:mvn/version "0.9.6"}
metosin/malli {:mvn/version "0.13.0"}
org.clojure/tools.cli {:mvn/version "1.0.219"}}}
:build {:extra-deps {}}
:common-test
{:exec-fn cognitect.test-runner.api/test
:extra-deps {clj-htmltopdf/clj-htmltopdf {:mvn/version "0.2.1"}
com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner"
:sha "7284cda41fb9edc0f3bc6b6185cfb7138fc8a023"}
markdown-clj/markdown-clj {:mvn/version "1.11.7"}
org.clojure/tools.namespace {:mvn/version "1.4.4"}
org.clojure/tools.reader {:mvn/version "1.3.7"}}
:extra-paths ["test/clj" "test/resources"]
:jvm-opts ["-Dheph-conf=env/test/config.edn,env/common_config.edn"]}
:env-development-repl
{:extra-deps {cider/cider-nrepl {:mvn/version "0.30.0"}
djblue/portal {:mvn/version "0.51.0"}
org.clojure/core.async {:mvn/version "1.6.681"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}}
:extra-paths ["env/development/resources"
"env/development/src/clj"
"env/development/src/cljc"]
:jvm-opts ["-Dheph-conf=env/development/config.edn,env/common_config.edn"]
:main-opts ["-m" "automaton-build.repl"]}
:env-development-test
{:jvm-opts
["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
"-Dhephaistox-in-test=true"
"-Dlog4j.configurationFile=resources/log_config/appenders.properties,resources/log_config/logging-tests.properties"]
:main-opts ["-m"
"cognitect.test-runner"
"-r"
".*-test.*"
"-d"
"test/clj"
"-d"
"test/cljc"]}
:user/vizns {:deps {io.dominic/vizns
{:git/url "https://github.com/SevereOverfl0w/vizns.git"
:sha "34706190d41cb243f6270fe5a7324601a8404d30"}}
:main-opts ["-m" "io.dominic.vizns.core"]}}
:deps {babashka/fs {:mvn/version "0.5.20"}
djblue/portal {:mvn/version "0.51.1"} ;; developer tooling lib
babashka/process {:mvn/version "0.5.21"}
clj-htmltopdf/clj-htmltopdf {:mvn/version "0.2.1"}
codox/codox {:mvn/version "0.10.8"}
com.github.liquidz/antq {:mvn/version "2.7.1133"}
dev.weavejester/medley {:mvn/version "1.7.0"}
hiccup/hiccup {:mvn/version "2.0.0-RC2"}
io.dominic/vizns {:git/url "https://github.com/SevereOverfl0w/vizns.git"
:sha "34706190d41cb243f6270fe5a7324601a8404d30"}
io.github.clojure/tools.build {:mvn/version "0.9.6"}
slipset/deps-deploy {:mvn/version "0.2.2"}
markdown-clj/markdown-clj {:mvn/version "1.11.7"}
metosin/malli {:mvn/version "0.13.0"}
zprint/zprint {:mvn/version "1.2.8"}}
:ns-default automaton-build.core
:paths ["src/clj" "test_la/clj"]}
Loading

0 comments on commit 0a1da57

Please sign in to comment.