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
(ns yvern.test-rules | |
(:require [clara.rules :refer [defrule insert!]] | |
[yvern.defrule :as check])) | |
(check/defrule | |
(defrule ok | |
[:a] | |
=> | |
(insert! {:fact-type :b}))) |
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
(ns hooks.defrule) | |
(def clara-inserts | |
"The forms we care about, capable of inserting facts." | |
#{'insert! 'insert-all!}) | |
(def descend* | |
"Transducer to descend into inner forms, looling for those we care about, the ones that insert facts. | |
Unfortunately we can't really figure out if someone defines another function that calls `insert!`." | |
(comp (map macroexpand) |
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
{:linters {:defrule/hidden-flow {:level :error}} | |
:hooks {:analyze-call {clara.rules/defrule hooks.defrule/defrule}} | |
:lint-as {clara.rules/defrule clj-kondo.lint-as/def-catch-all | |
clara.rules/defquery clj-kondo.lint-as/def-catch-all}} |
OlderNewer