Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider :doc in attr-map? of defn #1265

Closed
serioga opened this issue Apr 25, 2021 · 3 comments
Closed

Consider :doc in attr-map? of defn #1265

serioga opened this issue Apr 25, 2021 · 3 comments
Projects

Comments

@serioga
Copy link

serioga commented Apr 25, 2021

Is your feature request related to a problem? Please describe.

clj-kondo v2021.04.23 ignores docstring specified in the attr-map? after name in the defn macro (see f3 below):

(ns clj-kondo-defn-meta)

(defn f1
  "Docstring"
  [])

(defn ^{:doc "Docstring"}
  f2
  [])

(defn f3
  {:doc "Docstring"}
  [])

(comment
  (-> #'f1 meta :doc) #_"Docstring"
  (-> #'f2 meta :doc) #_"Docstring"
  (-> #'f3 meta :doc) #_"Docstring")
>clj-kondo --lint src;dev
dev\clj_kondo_defn_meta.clj:11:1: warning: Missing docstring.

Describe the solution you'd like

I would like clj-kondo sees docstring for the function f3 above.

@borkdude borkdude added this to Needs triage in clj-kondo via automation Apr 25, 2021
@borkdude borkdude moved this from Needs triage to Medium priority (new / enhance) in clj-kondo Apr 25, 2021
@borkdude borkdude moved this from Medium priority (new / enhance) to High priority (next release) in clj-kondo Apr 25, 2021
@borkdude borkdude moved this from High priority (next release) to Low priority in clj-kondo May 29, 2021
@borkdude
Copy link
Member

@serioga Why would you ever write it like that instead of using the "idiomatic" location of the docstring?

@serioga
Copy link
Author

serioga commented May 30, 2021

Why would you ever write it like that instead of using the "idiomatic" location of the docstring?

Reason 1. I write metadata map with various fields including :doc (uniformity).
Reason 2. Sometimes I use not a plain string for the :doc field but data structure :-)

@borkdude
Copy link
Member

@serioga Good points.

@borkdude borkdude moved this from Low priority to Medium priority (new / enhance) in clj-kondo May 30, 2021
@borkdude borkdude moved this from Medium priority (new / enhance) to High priority (next release) in clj-kondo May 31, 2021
clj-kondo automation moved this from High priority (next release) to Done May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
clj-kondo
  
Done
Development

No branches or pull requests

2 participants