org-lint: Add checker for spurious colons in tags
* lisp/org-lint.el (org-lint--checkers): Add checker. (org-lint-spurious-colons): New function. * testing/lisp/test-org-lint.el (test-org/spurious-colons): New test.
This commit is contained in:
parent
7143ae0355
commit
c46fcd9874
|
@ -100,6 +100,7 @@
|
|||
;; - indented diary-sexps
|
||||
;; - obsolete QUOTE section
|
||||
;; - obsolete "file+application" link
|
||||
;; - spurious colons in tags
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
@ -285,7 +286,10 @@
|
|||
(make-org-lint-checker
|
||||
:name 'file-application
|
||||
:description "Report obsolete \"file+application\" link"
|
||||
:categories '(link obsolete)))
|
||||
:categories '(link obsolete))
|
||||
(make-org-lint-checker
|
||||
:name 'spurious-colons
|
||||
:description "Report spurious colons in tags"))
|
||||
"List of all available checkers.")
|
||||
|
||||
(defun org-lint--collect-duplicates
|
||||
|
@ -1031,6 +1035,13 @@ Use \"export %s\" instead"
|
|||
reports))))))))))))
|
||||
reports))
|
||||
|
||||
(defun org-lint-spurious-colons (ast)
|
||||
(org-element-map ast '(headline inlinetask)
|
||||
(lambda (h)
|
||||
(when (member "" (org-element-property :tags h))
|
||||
(list (org-element-property :begin h)
|
||||
"Tags contain a spurious colon")))))
|
||||
|
||||
|
||||
|
||||
;;; Reports UI
|
||||
|
|
|
@ -487,6 +487,18 @@ SCHEDULED: <2012-03-29 thu.>"
|
|||
#+end_src"
|
||||
(org-lint '(wrong-header-value)))))
|
||||
|
||||
(ert-deftest test-org/spurious-colons ()
|
||||
"Test `org-list-spurious-colons' checker."
|
||||
(should-not
|
||||
(org-test-with-temp-text "* H :tag:tag2:"
|
||||
(org-lint '(spurious-colons))))
|
||||
(should
|
||||
(org-test-with-temp-text "* H :tag::tag2:"
|
||||
(org-lint '(spurious-colons))))
|
||||
(should
|
||||
(org-test-with-temp-text "* H :tag::"
|
||||
(org-lint '(spurious-colons)))))
|
||||
|
||||
|
||||
(provide 'test-org-lint)
|
||||
;;; test-org-lint.el ends here
|
||||
|
|
Loading…
Reference in New Issue