Skip to content

Commit

Permalink
Merge pull request #32 from 40ants/ignore-missing-source-locations
Browse files Browse the repository at this point in the history
Added 40ants-doc:*symbols-with-ignored-missing-locations* variable to…
  • Loading branch information
svetlyak40wt authored Jun 5, 2023
2 parents 1db487a + 3cbd48f commit 199decb
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
1 change: 1 addition & 0 deletions full/doc.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ See full list of changes in the 40ANTS-DOC/CHANGELOG::@CHANGELOG section.
(40ants-doc:defsection macro)
(40ants-doc:defsection-copy macro)
(40ants-doc:*discard-documentation-p* variable)
(40ants-doc:*symbols-with-ignored-missing-locations* variable)
(40ants-doc/ignored-words:ignored-words generic-function)
(40ants-doc/ignored-words:supports-ignored-words-p generic-function)
(40ants-doc/ignored-words:ignore-words-in-package macro))
Expand Down
13 changes: 8 additions & 5 deletions full/github.lisp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
(uiop:define-package #:40ants-doc-full/github
(:use #:cl)
(:import-from #:40ants-doc
#:*symbols-with-ignored-missing-locations*
#:defsection)
(:import-from #:cl-fad)
(:import-from #:40ants-doc-full/source)
(:import-from #:40ants-doc/reference)
(:import-from #:40ants-doc/reference
#:reference-object)
(:import-from #:40ants-doc/source-api)
(:import-from #:cl-ppcre)
(:import-from #:str)
Expand All @@ -13,8 +15,7 @@
(:import-from #:40ants-doc/reference-api
#:*source-uri-fn*
#:source-uri)
(:export
#:make-github-source-uri-fn))
(:export #:make-github-source-uri-fn))
(in-package #:40ants-doc-full/github)


Expand Down Expand Up @@ -136,8 +137,10 @@
(null source-location)
;; SBCL, AllegroCL
(eq (first source-location) :error))
(warn "~@<No source location found for reference ~:_~A: ~:_~A~%~@:>"
reference (second source-location)))
(unless (member (reference-object reference)
*symbols-with-ignored-missing-locations*)
(warn "~@<No source location found for reference ~:_~A: ~:_~A~%~@:>"
reference (second source-location))))
(t
(assert (eq (first source-location) :location))
(let* ((filename (second (assoc :file (rest source-location))))
Expand Down
8 changes: 6 additions & 2 deletions full/locatives/slots.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@

(defmethod locate-and-find-source (symbol (locative-type (eql 'reader))
locative-args)
(find-source (find-method (symbol-function symbol)
'() (list (find-class (first locative-args))))))
(let ((generic-function (symbol-function symbol))
(arguments (list (find-class (first locative-args))))
(specializers nil))
(find-source (find-method generic-function
specializers
arguments))))

(defmethod locate-and-find-source (symbol (locative-type (eql 'writer))
locative-args)
Expand Down
5 changes: 5 additions & 0 deletions src/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
"*DOCUMENT-DOWNCASE-UPPERCASE-CODE*"
;; These objects are not documented yet:
"40ANTS-DOC/COMMONDOC/XREF:XREF"))
(0.14.0 2023-06-04
"* Added 40ANTS-DOC:*SYMBOLS-WITH-IGNORED-MISSING-LOCATIONS* variable to ignore warnings on missing source location.
This might be useful for autogenerated methods. For example, Mito does generate such reader methods
[here](https://github.com/fukamachi/mito/blob/6835d2c8120454e93c69d4f22cccb10d9ee24526/src/core/dao/mixin.lisp#L71).")
(0.13.0 2023-06-04
"* Support for variables was added to autodoc subsystem.")
(0.12.0 2023-04-22
Expand Down
19 changes: 18 additions & 1 deletion src/core.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#:*discard-documentation-p*
#:section-ignore-words
#:defsection-copy
#:section-external-docs))
#:section-external-docs
#:*symbols-with-ignored-missing-locations*))
(in-package #:40ants-doc)


Expand All @@ -30,6 +31,22 @@
building a binary application.")


(defvar *symbols-with-ignored-missing-locations* nil
"Sometimes code might be generated without source location attached.
For example Mito generates slot readers this way.
Such symbols should be added to this list to skip warnings during the documentation build.
Use such code to add a new symbol to ignore:
```lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(pushnew 'reblocks-auth/models:profile-user
40ants-doc:*symbols-with-ignored-missing-locations*))
```
")


(eval-when (:compile-toplevel :load-toplevel :execute)
(defun ensure-package (package)
(etypecase package
Expand Down

0 comments on commit 199decb

Please sign in to comment.