generated from parenthesin/microservice-boilerplate-malli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3c00981
Showing
47 changed files
with
1,574 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{:hooks | ||
{:analyze-call | ||
{next.jdbc/with-transaction | ||
hooks.com.github.seancorfield.next-jdbc/with-transaction | ||
next.jdbc/with-transaction+options | ||
hooks.com.github.seancorfield.next-jdbc/with-transaction+options}} | ||
:lint-as {next.jdbc/on-connection clojure.core/with-open | ||
next.jdbc/on-connection+options clojure.core/with-open}} |
18 changes: 18 additions & 0 deletions
18
.clj-kondo/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns hooks.com.github.seancorfield.next-jdbc | ||
(:require [clj-kondo.hooks-api :as api])) | ||
|
||
(defn with-transaction | ||
"Expands (with-transaction [tx expr opts] body) | ||
to (let [tx expr] opts body) pre clj-kondo examples." | ||
[{:keys [:node]}] | ||
(let [[binding-vec & body] (rest (:children node)) | ||
[sym val opts] (:children binding-vec)] | ||
(when-not (and sym val) | ||
(throw (ex-info "No sym and val provided" {}))) | ||
(let [new-node (api/list-node | ||
(list* | ||
(api/token-node 'let) | ||
(api/vector-node [sym val]) | ||
opts | ||
body))] | ||
{:node new-node}))) |
34 changes: 34 additions & 0 deletions
34
...kondo/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj_kondo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns hooks.com.github.seancorfield.next-jdbc | ||
(:require [clj-kondo.hooks-api :as api])) | ||
|
||
(defn with-transaction | ||
"Expands (with-transaction [tx expr opts] body) | ||
to (let [tx expr] opts body) per clj-kondo examples." | ||
[{:keys [:node]}] | ||
(let [[binding-vec & body] (rest (:children node)) | ||
[sym val opts] (:children binding-vec)] | ||
(when-not (and sym val) | ||
(throw (ex-info "No sym and val provided" {}))) | ||
(let [new-node (api/list-node | ||
(list* | ||
(api/token-node 'let) | ||
(api/vector-node [sym val]) | ||
opts | ||
body))] | ||
{:node new-node}))) | ||
|
||
(defn with-transaction+options | ||
"Expands (with-transaction+options [tx expr opts] body) | ||
to (let [tx expr] opts body) per clj-kondo examples." | ||
[{:keys [:node]}] | ||
(let [[binding-vec & body] (rest (:children node)) | ||
[sym val opts] (:children binding-vec)] | ||
(when-not (and sym val) | ||
(throw (ex-info "No sym and val provided" {}))) | ||
(let [new-node (api/list-node | ||
(list* | ||
(api/token-node 'let) | ||
(api/vector-node [sym val]) | ||
opts | ||
body))] | ||
{:node new-node}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{:config-paths ["com.github.seancorfield/next.jdbc" | ||
"nubank/state-flow" | ||
"marick/midje" | ||
"metosin/malli-types"] | ||
:hooks {:analyze-call {integration.microservice-boilerplate.aux/init-flow nubank.state-flow/defflow | ||
state-flow.api/defflow nubank.state-flow/defflow}} | ||
:linters {:unsorted-required-namespaces {:level :warning} | ||
:unresolved-var {:exclude [honeysql.helpers/select | ||
honeysql.helpers/from]}} | ||
:lint-as {honeysql.helpers/defhelper clj-kondo.lint-as/def-catch-all | ||
clojure.test.check.properties/for-all clojure.core/let | ||
clojure.test.check.clojure-test/defspec clojure.test/deftest}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{:lint-as {cats.core/mlet clojure.core/let | ||
cats.core/alet clojure.core/let | ||
cats.core/ap-> clojure.core/-> | ||
cats.core/ap->> clojure.core/->> | ||
cats.core/as-ap-> clojure.core/as-> | ||
cats.core/->= clojure.core/-> | ||
cats.core/->>= clojure.core/->> | ||
cats.core/as->= clojure.core/as-> | ||
cats.core/for clojure.core/for}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{:hooks {:analyze-call {midje.sweet/tabular marick.midje/tabular}} | ||
:lint-as {midje.checking.checkers.defining/defchecker clojure.core/defn} | ||
:linters {:unresolved-symbol {:exclude [(midje.sweet/fact | ||
[throws | ||
contains | ||
as-checker | ||
exactly | ||
has | ||
has-sufix | ||
has-prefix | ||
just | ||
one-of | ||
two-of | ||
roughly | ||
truthy | ||
falsey | ||
irrelevant | ||
anything | ||
=> | ||
=not=> | ||
=deny=> | ||
=expands-to=> | ||
=future=> | ||
=contains=> | ||
=streams=> | ||
=throws=> | ||
=test=> | ||
=throw-parse-exception=>]) | ||
(midje.sweet/facts | ||
[throws | ||
contains | ||
exactly | ||
has | ||
has-sufix | ||
has-prefix | ||
just | ||
one-of | ||
two-of | ||
roughly | ||
as-checker | ||
truthy | ||
falsey | ||
irrelevant | ||
anything | ||
=> | ||
=not=> | ||
=deny=> | ||
=expands-to=> | ||
=future=> | ||
=contains=> | ||
=streams=> | ||
=throws=> | ||
=test=> | ||
=throw-parse-exception=>]) | ||
(midje.sweet/tabular | ||
[throws | ||
contains | ||
exactly | ||
has | ||
has-sufix | ||
has-prefix | ||
just | ||
one-of | ||
two-of | ||
roughly | ||
as-checker | ||
truthy | ||
falsey | ||
irrelevant | ||
anything | ||
=> | ||
=not=> | ||
=deny=> | ||
=expands-to=> | ||
=future=> | ||
=contains=> | ||
=streams=> | ||
=throws=> | ||
=test=> | ||
=throw-parse-exception=>])]}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
(ns marick.midje | ||
(:require [clj-kondo.hooks-api :as hooks] | ||
[clojure.string :as string])) | ||
|
||
(def arrows '#{=> | ||
=not=> | ||
=deny=> | ||
=expands-to=> | ||
=future=> | ||
=contains=> | ||
=streams=> | ||
=throws=> | ||
=test=> | ||
=throw-parse-exception=>}) | ||
|
||
(defn ^:private let-form [body bindings] | ||
(let [new-bindings (vec (reduce (fn [acc i] | ||
(concat acc [i (hooks/token-node 'identity)])) | ||
[] bindings))] | ||
(hooks/list-node | ||
[(hooks/token-node 'let) | ||
(hooks/vector-node new-bindings) | ||
body]))) | ||
|
||
(defn ^:private do-form [forms] | ||
(hooks/list-node | ||
(concat [(hooks/token-node 'do)] | ||
forms))) | ||
|
||
(defn ^:private table-variable? [node] | ||
(let [sexpr (hooks/sexpr node)] | ||
(and (symbol? sexpr) | ||
(string/starts-with? (str sexpr) "?")))) | ||
|
||
(defn ^:private tabular-node [first-bindings bindings body] | ||
(if (hooks/vector-node? first-bindings) | ||
{:node (->> (hooks/sexpr first-bindings) | ||
(map hooks/token-node) | ||
(let-form body))} | ||
{:node (->> bindings | ||
(filter table-variable?) | ||
(let-form body))})) | ||
|
||
(defn ^:private handle-fact-outside-tabular [children arrow] | ||
(let [body (do-form children) | ||
bindings (->> children | ||
(drop-while #(not (= arrow %))) | ||
rest | ||
(drop 1))] | ||
(tabular-node (first bindings) bindings body))) | ||
|
||
(defn fact-tabular [fact vec-bindings bindings] | ||
(let [body (do-form (cons fact bindings))] | ||
(tabular-node vec-bindings (cons vec-bindings bindings) body))) | ||
|
||
(defn ^:private handle-fact-inside-tabular [children] | ||
(if (hooks/string-node? (first children)) | ||
(let [[_name fact vec-bindings & bindings] children] | ||
(fact-tabular fact vec-bindings bindings)) | ||
(let [[fact vec-bindings & bindings] children] | ||
(fact-tabular fact vec-bindings bindings)))) | ||
|
||
(defn tabular [{:keys [node]}] | ||
(let [children (rest (:children node)) | ||
fact-outside (first (filter #(contains? arrows (hooks/sexpr %)) children))] | ||
(if fact-outside | ||
(handle-fact-outside-tabular children fact-outside) | ||
(handle-fact-inside-tabular children)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.