This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-29
Channels
- # announcements (35)
- # aws (40)
- # babashka (10)
- # beginners (119)
- # calva (25)
- # cider (13)
- # clj-kondo (15)
- # cljsrn (23)
- # clojure (205)
- # clojure-dev (3)
- # clojure-europe (15)
- # clojure-germany (3)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-uk (58)
- # clojurescript (193)
- # community-development (2)
- # conjure (147)
- # core-async (49)
- # cursive (47)
- # datomic (27)
- # duct (1)
- # fulcro (19)
- # graalvm (3)
- # graphql (1)
- # helix (3)
- # hoplon (11)
- # jackdaw (1)
- # joker (1)
- # juxt (5)
- # kaocha (1)
- # keechma (3)
- # lambdaisland (6)
- # local-first-clojure (27)
- # malli (5)
- # off-topic (41)
- # rdf (27)
- # re-frame (7)
- # reagent (15)
- # reitit (5)
- # rum (11)
- # shadow-cljs (157)
- # spacemacs (18)
- # sql (4)
- # xtdb (8)
We're using (and loving) clj-kondo, but I was wondering if anybody has found a nice, automated, way for clj-kondo to play well with HugSQL?
HugSQL defines functions at namespace load-time, and tickles the undeclared-var linter.
We can declare
the vars before invoking HugSQL, or we can configure clj-kondo to ignore those particular vars, but neither solution is particularly elegant, they both need manual updating if we add more HugSQL functions.
@gordonsyme_clojurians I use hugsql
and I do use declare. Another way is to just turn the unresolved symbol linter off for that namespace. Another workaround:
use a small namespace foo.db.hugsql
in which you let hugsql create the functions. then you require that namespace from foo.db
as [foo.db.hugsql :as queries]
and voila, no more warnings. you just type queries/select-users
and clj-kondo won't complain anymore
I just thought about that last way while typing, I think I'm going to try that myself as well
We also use HugSQL. That is a neat idea! We currently use the declare
approach (which was originally suggested to me by @borkdude). It works great and, though it requires some discipline to keep in sync with the corresponding file, does have the nice side benefit of providing a .clj
file where a person could look to see what functions are available without having to look through the SQL.
Our namespacing is similar, which makes it very easy to navigate the code. Generally, our (Hug) .sql
files are kept on a path project/sql/schema_name/table_name.sql
and are then loaded by a .clj
file located at project.queries.schema_name.table_name
. Any namespace that needs to interact with the specified table includes the project.queries.*
namespace and has all the functions they need. Has made it pretty simple (i.e. predictable) for devs to navigate the various HugSQL functions within a project.
hello, Im trying to work with slingshot/try+ and Id like to know If there is a macro in clojure like
(catch [:type error/not-found] {:keys [msg]}
...)
so I can use lint-asI don't think there is. Probably the :unresolved-symbol
config is what you need here
did this, the warning went away, but what happens then? everything inside the try+
block is ignored?
slingshot/try+ seems like a library that is used quite a lot, so I'd be happy to get built-in support for that. feel free to post an issue about it
https://github.com/borkdude/clj-kondo/issues/874 hope its descriptive enough