Fork me on GitHub
#clj-kondo
<
2024-03-17
>
Zachary10:03:49

Hiyo! Is there a way to tell clj-kondo to ignore misplaced docstrings? Looking through the readme/docs, not seeing any config settings for this?

borkdude10:03:29

This should work:

#_:clj-kondo/ignore "the-string"

borkdude10:03:41

why would you not just fix the misplaced docstring?

2
Zachary11:03:50

I have been putting #_:clj-kondo/ignore in front of functions with docstrings, so that works but is less desirable to pollute code with comments and obviates (one of the) reason why I like to have docstring following argument vector, which is better line compactness; and also, that’s how I’m used to writing my functions in other Lisps. :face_exhaling: 🤷

cjohansen11:03:37

Placing it there means it isn’t really available unless you’re looking at the source though

👀 1
1
Zachary11:03:47

I find readability more joyful with my arguments on the same line as my function name, perhaps out of habit in other Lisps. And also saves on screen real-estate.

cjohansen11:03:28

E.g. C-c C-d d will show you the docstring for any function in Emacs, but you have to stick it in the right place.

borkdude11:03:59

A string following the argvec is simply not a docstring. If you don’t want to follow this linter rule, which is off by default, why just not let it stay disabled?

cjohansen11:03:40

I’d say you’re throwing out good effort in the name of familiarity. Switch it up, and you’ll be familiar with the Clojure way in notime 😊

Zachary11:03:39

@U9MKYDN4Q Gut zu wissen… good to know, I s’pose. @U04V15CAJ I’m using LSP mode… so not sure exactly what linter rules they have set, or how to twiddle those knobs…. Anyways, thanks for the edification. I get why Clojure has its orderings as it does; internally quite consistent and nice and beautiful. tyty

borkdude11:03:48

Note that docstrjngs are saved as metadata on the var and used by tooling. Putting it in the wrong place will get you different results for (doc foo) for example

Zachary11:03:27

One good reason to not play loose with my docstrings, noted! 😉

lassemaatta16:03:33

I hesitate to suggest this, but: why not just make a macro with the desired syntax?

😅 1
1
weavejester15:03:51

Quick question around importing configurations from libraries: how does clj-kondo determine what dependencies a project has? Does it look for and parse a deps.edn ? Does it also work if the project only has a project.clj?

borkdude15:03:38

It doesn’t, it just looks at the classpath that you give it

weavejester15:03:34

Aha, the --lint $(clojure -Spath). I see.

borkdude15:03:18

you also need the --copy-configs and --dependencies flags for config to be copied, hope you managed to find that