This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-30
Channels
- # announcements (4)
- # babashka (8)
- # beginners (124)
- # calva (13)
- # cider (10)
- # circleci (6)
- # clj-kondo (193)
- # cljdoc (1)
- # cljs-dev (4)
- # clojure (50)
- # clojure-europe (28)
- # clojure-serbia (1)
- # clojure-spec (22)
- # clojure-uk (30)
- # clojurescript (11)
- # clojureverse-ops (3)
- # community-development (1)
- # conjure (5)
- # cursive (1)
- # datomic (11)
- # depstar (1)
- # events (2)
- # fulcro (7)
- # graalvm (2)
- # graphql (10)
- # helix (43)
- # hyperfiddle (14)
- # introduce-yourself (6)
- # jobs (2)
- # jobs-discuss (14)
- # kaocha (4)
- # luminus (2)
- # malli (24)
- # meander (6)
- # off-topic (4)
- # pathom (1)
- # polylith (13)
- # re-frame (6)
- # releases (1)
- # remote-jobs (1)
- # sci (14)
- # shadow-cljs (209)
- # tools-deps (30)
- # xtdb (26)
seems to work well.
one thing that I noticed which works well, but I was expecting to fail is that (do x)
warns that the do
is redundant. However if a macro expands to something containing a singleton do
this warning is thankfully suppressed. Is that an accident or by design?
how does it know?
the generated nodes are marked as "generated" and the redundant do linter doesn't warn if the node was generated
cool.
so if the macro does something like
`(foo (do 41) ~@user-code)
and user-code contains a (do 42)
does it know to flag (do 42)
but not (do 41)
?with :macroexpand
it doesn't but with :analyze-call
it does, because you can re-use the incoming node
I haven't read the HOW-TO yet.
this sort of limitation could be worth noting
indeed.
but it may be good for people like yourself who are not yet familiar with :analyze-hook
and want to get started more quickly
note that :macroexpand
will still provide linter warnings for the majority of linters
yes it seems like a powerful feature, and easy to use.
can you give me the link to the HOWTO again please?
I'd like to add some things to this doc. What should I do?
if you're not familiar with this, there are some docs on the internet explaining how this works. e.g.: https://opensource.com/article/19/7/create-pull-request-github
I have a patch for backtick/template
which makes it compatible with clj-kondo
Is that something we should include in the clj-kondo
repo, or should I try to convince the backtick
folks to take it?
it provides a macro expansion for cli-kondo to use. you can't simply copy the default backtick.clj
file into the .clj-kondo directory because the interpreter can't underhand direct references to java class names, and a few more issues. I replace (instance? x Boolean)
with (boolean? x)
and several similar things. These changes theoretically could but sent upstream to the backtick maintainers. However, I had to change one of the throw exception
calls in a way which would probably break the code, but doesn't break it as far as clj-kondo
is concerned.
seems backtick was last touched 6 years ago.
modifying that library in that way would make it incompatible with clojure 1.8 for example, but that's a trade-off for the lib maintainer to make
@jimka.issy But you could try to provide a "config" with a macro that that library will export
And then users of that library will receive the config automatically, e.g. if they use clojure-lsp
could that be made invisible to the users of backtick
? I.e. somewhere in the backtick download would be a .clj-kondo configuration which the system would implicitly know about? Or would each user need to modify his .clj-kondo directory to include copies of the files, or entries in the deps.edn
file?
@jimka.issy if the library includes the config in its resources under clj-kondo.exports
then it works automatically when you lint the classpath
or would it be something that I (Jim) would provide independent and in parallel to backtick?
in the latter case, you could also contribute it to https://github.com/clj-kondo/config
and if users then include that library on their classpath, or install the config for backtick manually it will also work
ah, so if the maintainers of that library are amenable, I could submit a PR to backtick
including this configuration?
you could also make your own clj-kondo config project and include that on your own classpath
but it's better if people improved one single config over time, probably in the repo of the original library
again, would I hard code a particular sha1 into the deps.edn
file of that library? wouldn't that conflict with the sha found elsewhere?
according to https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration I need to create a deps.edn
file at the top level directory of the backtick
library with the following content:
{:deps {clj-kondo/config {:git/url ""
:sha "e2e156c53c6c228fee7242629b41013f3e55051d"}}}
right?ahhhh. good thing I asked.
this is when you would include the clj-kondo/config library which would then contain the config for the backtick library
but if you would contribute the config to the backtick library itself, you wouldn't need the clj-kondo/config library
during the linting of dependencies, clj-kondo checks for this and then copies these files into your local config dir
so clj-kondo --copy-configs --lint $(clojure -Spath)
should copy configs from all dependencies that provide them
ahhh. and I need config.edn
inside clj-kondo.exports
which contains
{:hooks {
;; {:macroexpand {app.bar/baz hook.bar/baz}}}
:macroexpand {backtick/template backtick/template}}}
along with the backtick.clj
file which contains the (defmacro ...)
simple, but I'm not sure how I can test it before submitting the PR
@jimka.issy You can test this by making a local project using :local/root
and then calling clj-kondo --copy-configs --lint $(clojure -Spath)
should dump the config from /Users/jim/dev/backtick/resources/clj-kondo.exports/backtick/backtick
into your local .clj-kondo
dir
Note that the backtick library should add a resources
directory to accomodate this config
also you will need to add a deps.edn
with :paths ["src" "resources"]
in backtick or produce a pom.xml
from the lein project with lein pom
to make :local/root
understand it
bash-3.2$ clojure -Spath Error building classpath. Manifest type not detected when finding deps for backtick/backtick in coordinate #:local{:root "/Users/jnewton/Repos/backtick"} bash-3.2$
after added deps.edn
to backtick, I have the following:
bash-3.2$ clojure -Spath
src:/Users/jnewton/Repos/backtick/src:/Users/jnewton/Repos/backtick/resources:/Users/jnewton/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar:/Users/jnewton/.m2/repository/org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar:/Users/jnewton/.m2/repository/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar
what do you mean by: Note that the backtick library should add a `resources` directory to accomodate this config
do I need to create a resources
directory in backtick
?
I see the following unexpected but understandable message: Imported config to .clj-kondo/backtick/backtick. To activate, add "backtick/backtick" to :config-paths in .clj-kondo/config.edn.
yes, that is expected. In your local config.edn
you should then have :config-dirs ["backtick/backtick"]
Here is my current config.edn
{:hooks {
;; {:macroexpand {app.bar/baz hook.bar/baz}}}
:macroexpand {clojure-rte.util/print-vals clojure-rte.util/print-vals,
clojure-rte.util/defn-memoized clojure-rte.util/defn-memoized,
clojure-rte.util/defmethod-memoized clojure-rte.util/defmethod-memoized,
clojure-rte.util/exists clojure-rte.util/exists,
clojure-rte.util/setof clojure-rte.util/setof,
clojure-rte.util/forall clojure-rte.util/forall,
clojure-rte.util/forall-pairs clojure-rte.util/forall-pairs,
clojure-rte.util/exists-pair clojure-rte.util/exists-pair,
clojure-rte.util/casep clojure-rte.util/casep,
clojure-rte.cl-compat/cl-cond clojure-rte.cl-compat/cl-cond,
clojure-rte.cl-compat/with-escape clojure-rte.cl-compat/with-escape
clojure-rte.rte-case/rte-case clojure-rte.rte-case/rte-case
clojure-rte.rte-case/destructuring-case clojure-rte.rte-case/destructuring-case
clojure-rte.rte-case/destructuring-fn clojure-rte.rte-case/destructuring-fn
clojure-rte.rte-case/-destructuring-fn-many clojure-rte.rte-case/-destructuring-fn-many
clojure-rte.rte-case/dsfn clojure-rte.rte-case/dsfn
clojure-rte.rte-case/dscase clojure-rte.rte-case/dscase
clojure-rte.typecase/typecase clojure-rte.typecase/typecase
;; backtick/template backtick/template
}}}
what do I need to add where?added :config-dirs
parallel with :hooks
?
hmmm here is my config.edn
now
{:config-dirs ["backtick/backtick"]
:hooks {
;; {:macroexpand {app.bar/baz hook.bar/baz}}}
:macroexpand {clojure-rte.util/print-vals clojure-rte.util/print-vals,
clojure-rte.util/defn-memoized clojure-rte.util/defn-memoized,
clojure-rte.util/defmethod-memoized clojure-rte.util/defmethod-memoized,
clojure-rte.util/exists clojure-rte.util/exists,
clojure-rte.util/setof clojure-rte.util/setof,
clojure-rte.util/forall clojure-rte.util/forall,
clojure-rte.util/forall-pairs clojure-rte.util/forall-pairs,
clojure-rte.util/exists-pair clojure-rte.util/exists-pair,
clojure-rte.util/casep clojure-rte.util/casep,
clojure-rte.cl-compat/cl-cond clojure-rte.cl-compat/cl-cond,
clojure-rte.cl-compat/with-escape clojure-rte.cl-compat/with-escape
clojure-rte.rte-case/rte-case clojure-rte.rte-case/rte-case
clojure-rte.rte-case/destructuring-case clojure-rte.rte-case/destructuring-case
clojure-rte.rte-case/destructuring-fn clojure-rte.rte-case/destructuring-fn
clojure-rte.rte-case/-destructuring-fn-many clojure-rte.rte-case/-destructuring-fn-many
clojure-rte.rte-case/dsfn clojure-rte.rte-case/dsfn
clojure-rte.rte-case/dscase clojure-rte.rte-case/dscase
clojure-rte.typecase/typecase clojure-rte.typecase/typecase
;; backtick/template backtick/template
}}}
However, when I run
clojure -M:clj-kondo --copy-configs --lint $(clojure -Spath)
I still see the first line of output
Imported config to .clj-kondo/backtick/backtick. To activate, add "backtick/backtick" to :config-paths in .clj-kondo/config.edn.
ahhhhh config-paths, not config-dirs ..... hold on
bash-3.2$ clojure -M:clj-kondo --copy-configs --lint $(clojure -Spath)
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:30:1: warning: redefined var #'backtick/*resolve*
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:32:1: warning: redefined var #'backtick/*gensyms*
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:37:1: warning: redefined var #'backtick/resolve
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:48:1: warning: redefined var #'backtick/unquote?
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:53:1: warning: redefined var #'backtick/unquote-splicing?
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:102:1: warning: redefined var #'backtick/quote-fn
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:107:1: warning: redefined var #'backtick/defquote
/U
maybe I need to remove some caches somewhere?
removing .cache
and .cpcache
seems to have no effect.
bash-3.2$ clojure -M:clj-kondo --copy-configs --lint src
src/clojure_rte/genus.clj:35:31: warning: Unresolved var: template
src/clojure_rte/genus_spec.clj:27:31: warning: Unresolved var: template
src/clojure_rte/rte_case.clj:29:31: warning: Unresolved var: template
src/clojure_rte/rte_construct.clj:37:31: warning: Unresolved var: template
src/clojure_rte/rte_construct.clj:2113:34: warning: unused binding sink-state-id
src/clojure_rte/rte_extract.clj:32:9: warning: unused binding canonicalize-pattern
src/clojure_rte/typecase.clj:25:31: warning: Unresolved var: template
src/clojure_rte/xymbolyco.clj:34:31: warning: Unresolved var: template
linting took 1742ms, errors: 0, warnings: 8
yes, this is the same problem basically. the hook namespace replaces the real namespace. instead, we should just never save the results from linted hook code to the cache
I wonder if clojure if finding the correct template library now?
so far this wasn't a problem since the hook namespaces were always called differently than application code
sorry, me no understand.
ok, what happens is that clj-kondo lints the backtick library. but while linting it, it also lints the hook namespace code and mistakes it for the original namespace since it has the same name
and then when you use this library from your code, you will see some vars are "unresolved" because they are not in the hook code
instead, clj-kondo should never "replace" the results of linted hook code in the cache
so what triggered clj-kondo to lint the backtick library?
ahhh was that the --lint $(clojure -Spath)
?
yes, that code is on the classpath. which was the point, because else it wouldn't have been copied
@jimka.issy Can you test commit 07fd7d0ca055e09072d9ea9779e9e5c73e0c0026
of clj-kondo?
oops was away from desk.
bash-3.2$ clojure -M:clj-kondo --copy-configs --lint src
Checking out: at 07fd7d0ca055e09072d9ea9779e9e5c73e0c0026
src/clojure_rte/genus.clj:35:31: warning: Unresolved var: template
src/clojure_rte/genus_spec.clj:27:31: warning: Unresolved var: template
src/clojure_rte/rte_case.clj:29:31: warning: Unresolved var: template
src/clojure_rte/rte_construct.clj:37:31: warning: Unresolved var: template
src/clojure_rte/rte_construct.clj:2113:34: warning: unused binding sink-state-id
src/clojure_rte/rte_extract.clj:32:9: warning: unused binding canonicalize-pattern
src/clojure_rte/typecase.clj:25:31: warning: Unresolved var: template
src/clojure_rte/xymbolyco.clj:34:31: warning: Unresolved var: template
linting took 1758ms, errors: 0, warnings: 8
Do I need something else other than just changing the sha code?bash-3.2$ clojure -M:clj-kondo --copy-configs --lint $(clojure -Spath)
/Users/jnewton/Repos/backtick/src/backtick.clj:58:11: error: Unresolved symbol: template
/Users/jnewton/Repos/backtick/src/backtick.clj:101:11: error: Unresolved symbol: syntax-quote
clojure/core.clj:35:17: warning: unused binding &form
clojure/core.clj:35:23: warning: unused binding &env
clojure/core.clj:40:18: warning: unused binding &form
clojure/core.clj:40:24: warning: unused binding &env
clojure/core.clj:45:20: warning: unused binding &env
clojure/core.clj:210:9: warning: Missing else branch.
clojure/core.clj:223:27: warning: unused binding fdecl
clojure/core.clj:294:17: warning: unused binding &form
clojure/core.clj:294:23: warning: unused binding &env
clojure/core.clj:325:23: warning: Missing else branch.
bash-3.2$ clojure -M:clj-kondo --lint src
src/clojure_rte/genus.clj:35:31: warning: Unresolved var: template
src/clojure_rte/genus_spec.clj:27:31: warning: Unresolved var: template
src/clojure_rte/rte_case.clj:29:31: warning: Unresolved var: template
src/clojure_rte/rte_construct.clj:37:31: warning: Unresolved var: template
src/clojure_rte/rte_construct.clj:2113:34: warning: unused binding sink-state-id
src/clojure_rte/rte_extract.clj:32:9: warning: unused binding canonicalize-pattern
src/clojure_rte/typecase.clj:25:31: warning: Unresolved var: template
src/clojure_rte/xymbolyco.clj:34:31: warning: Unresolved var: template
linting took 1690ms, errors: 0, warnings: 8
{:aliases
{:clj-kondo
{:replace-deps
{clj-kondo/clj-kondo
{:git/url ""
:sha "07fd7d0ca055e09072d9ea9779e9e5c73e0c0026" ;; "30c878d719c7630ee5f5e51876ba780c5667b23f"
}}
:main-opts ["-m" "clj-kondo.main"]}}
:deps {backtick/backtick {:local/root "/Users/jnewton/Repos/backtick"}}
}
did you make a copy of my repo?
I have pushed everything if you'd like to take a lookoops but you don't have my local backtick directory. details 🤪
The template
var is defined using a custom macro.
https://github.com/brandonbloom/backtick/blob/b927924949a86eb3706dec3f6c224ff79b1de7ae/src/backtick.clj#L58
You can solve that one using :lint-as {backtick/defquote clojure.core/declare}
config
yes indeed.
I will revert my previous commit to get this sorted out better and not to confuse things
but wait. why is that file being linted anyway?
so I need to add :lint-as {backtick/defquote clojure.core/declare}
in the file backtick/resources/clj-kondo.exports/backtick/backtick/config.edn
?
and :lint-as is parallel with :macroexpand, or rather parallel with :hooks ?
hmmmm. now
clojure -M:clj-kondo --copy-configs --lint $(clojure -Spath)
gives the following output
bash-3.2$ clojure -M:clj-kondo --copy-configs --lint $(clojure -Spath)
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:30:1: warning: redefined var #'backtick/*resolve*
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:32:1: warning: redefined var #'backtick/*gensyms*
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:37:1: warning: redefined var #'backtick/resolve
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:48:1: warning: redefined var #'backtick/unquote?
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:53:1: warning: redefined var #'backtick/unquote-splicing?
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:102:1: warning: redefined var #'backtick/quote-fn
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:107:1: warning: redefined var #'backtick/defquote
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:116:1: warning: redefined var #'backtick/class-symbol
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:119:1: warning: redefined var #'backtick/namespace-name
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:122:1: warning: redefined var #'backtick/var-namespace
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:125:1: warning: redefined var #'backtick/var-name
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:128:1: warning: redefined var #'backtick/var-symbol
/Users/jnewton/Repos/backtick/resources/clj-kondo.exports/backtick/backtick/backtick.clj:131:1: warning: redefined var #'backtick/ns-resolve-sym
clojure/core.clj:35:17: warning: unused binding &form
clojure/core.clj:35:23: warning: unused binding &env
clojure/core.clj:40:18: warning: unused binding &form
clojure/core.clj:40:24: warning: unused binding &env
clojure/core.clj:45:20: warning: unused binding &env
clojure/core.clj:210:9: warning: Missing else branch.
is that what you expect?
got distracted with work.
OK, here is the output
bash-3.2$ clojure -M:clj-kondo --copy-configs --lint $(clojure -Spath)
Checking out: at d5e0ec443fecbc01f8fc5aae4de69cce2e1e72be
clojure/core.clj:35:17: warning: unused binding &form
clojure/core.clj:35:23: warning: unused binding &env
clojure/core.clj:40:18: warning: unused binding &form
clojure/core.clj:40:24: warning: unused binding &env
clojure/core.clj:45:20: warning: unused binding &env
clojure/core.clj:210:9: warning: Missing else branch.
clojure/core.clj:223:27: warning: unused binding fdecl
clojure/core.clj:294:17: warning: unused binding &form
clojure/core.clj:294:23: warning: unused binding &env
clojure/core.clj:325:23: warning: Missing else branch.
clojure/core.clj:454:16: warning: unused binding &form
clojure/core.clj:454:22: warning: unused binding &env
clojure/core.clj:544:4: warning: unused binding x
clojure/core.clj:794:5: warning: unused binding x
clojure/core.clj:826:5: warning: unused binding x
clojure/core.clj:908:5: warning: unused binding x
clojure/core.clj:1063:5: warning: unused binding x
clojure/core.clj:1078:5: warning: unused binding x
clojure/core.clj:1093:5: warning: unused binding x
clojure/core.clj:1108:5: warning: unused binding x
clojure/core.clj:1451:14: warning: unused binding args
clojure/core.clj:2307:56: warning: unused binding e
clojure/core.clj:2511:4: warning: unused binding flags-ignored-for-now
clojure/core.clj:2731:1: warning: redefined var #'clojure.core/map
clojure/core.clj:3301:1: warning: redefined var #'clojure.core/dotimes
clojure/core.clj:3651:31: warning: unused binding writer
clojure/core.clj:3654:28: warning: unused binding writer
clojure/core.clj:3937:12: error: Unresolved symbol: setInt
perhaps those are real errors from that library?
bash-3.2$ clojure -M:clj-kondo --lint src
src/clojure_rte/rte_construct.clj:2113:34: warning: unused binding sink-state-id
src/clojure_rte/rte_extract.clj:32:9: warning: unused binding canonicalize-pattern
linting took 1641ms, errors: 0, warnings: 2
indeed, those are two error/issues in my code. I don't yet know how to solve them. I think they indicate something is wrong more than just lint.
do you think there are other widely used macros which clj-kondo users might be exploiting, or is template the only one. My gut feel is there are several widely used macros. if clj-kondo knew how to support them it might be easier the convincing maintainers of xyzzy-library to adopt support for clj-kondo which they no nothing about ????
I'm happy to submit my template support for clj-kondo. Not sure what I need to change.
clj-kondo has built-in support for some macros but we can't possible support all of the macros from the ecosystem. for that the library has to be widely used. I don't think backtick is that widely used
I don't see such a directory. how do the contents of clj-kondo/config relate the the contents of backtick/resources/clj-kondo.exports ?
I mean this repo: https://github.com/clj-kondo/config
@borkdude maybe you'd like to join this discussion, in case I've given some false information. https://github.com/brandonbloom/backtick/issues/8
What is the standard way of developing a hook. I added clj-kondo to my deps. I am getting Could not locate clj_kondo/hooks_api....
when evaluating
(ns hooks.macros
(:require [clj-kondo.hooks-api :as api]))
Following the example here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#transformation
@finn.volkel The hook code runs in an interpreter during linting. You don't actually call it as a library from clojure. You call the API from within the lint config code.
so I added the following line to my config :hooks {:analyze-call {ramper.util.macros/cond-let hooks.macros/cond-let}}
, wrote the hook code and tried with
cat src/clj/ramper/util/macros.clj | clj-kondo --lint -
I am still getting errors. How I do figure out where stuff goes awry? Is my hook code bad if so how do I check that?Sorry, maybe not clear from the above. I also have an example of call cond-let
in macros.clj
.
also changed hooks.macros/cond-let
to hooks.cond-let/cond-let
. I don't know if that is important.
I got the thing to work from the command line, but in emacs + flycheck I am getting (in case of uneven forms, i.e. it should report an error):
Suspicious state from syntax checker clj-kondo-clj: Flycheck checker clj-kondo-clj returned 3, but its output contained no errors: /home/fv/Code/Clojure/ramper/src/clj/ramper/util/macros.clj::: error: cond-let requires an even number of forms
linting took 23ms, errors: 1, warnings: 0
Try installing a more recent version of clj-kondo-clj, and please open a bug report if the issue persists in the latest release. Thanks!
How do I fix that? I upgraded my emacs packages. I am off for the day, so not urgent.There’s a reference. to clj-kondo.hooks-api
in the https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#custom-lint-warnings. Should that be a reference to a different namespace now?
@ajarosinski No. This namespace is exposed to hook code which is configured to run using the :hooks
config
@borkdude Thanks for the quick reply; I see. There’s some notification that when using api/sexpr
it can’t be resolved, but maybe that’s a Cursive warning
It seems like it might be possible to highlight a finding containing multiple nodes on a hook using a row
, end-row
, col
, and end-col
. I’m having a bit of trouble doing that.
For example, below I’d like to highlight from [:img#pic]
through [:#pic-col
. Is that possible?
(m/deftemplate
test-fn
(resource "")
[{:keys [data test-data]}]
[:img#pic] (if data (m/set :src data) nil)
[:#pic-col])
Here’s how I’m attempting to register the finding
(when-not (even? (count body))
(let [{:keys [row col]} (some-> node :children (nth 4) meta)
end-metadata (some-> node :children last meta)]
(api/reg-finding! {:message "Must have an even number of arguments in the body"
:type :m-template
:row row
:end-row (:end-row end-metadata)
:col col
:end-col (:end-col end-metadata)})))