(internal): make lint errors fail CI, and disable spellcheck during linting (#561)

- make lint errors fail CI
- disable indentation linting
- disable package linting for org-roam-macs.el
- disable spellcheck for checkdoc
- fixes compilation errors
This commit is contained in:
Jethro Kuan 2020-05-04 15:17:39 +08:00 committed by GitHub
parent a723199d68
commit 7df50c14ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 56 additions and 53 deletions

View file

@ -56,7 +56,7 @@ jobs:
# as failures, so linting and testing are run as separate steps. # as failures, so linting and testing are run as separate steps.
- name: Lint - name: Lint
continue-on-error: true continue-on-error: false
run: ./makem.sh -vv --sandbox $SANDBOX_DIR lint run: ./makem.sh -vv --sandbox $SANDBOX_DIR lint
- name: Test - name: Test

View file

@ -248,7 +248,7 @@ the default template, reproduced below.
3. =plain= text is inserted. Other options include Org headings via 3. =plain= text is inserted. Other options include Org headings via
=entry=. =entry=.
4. =(function org-roam--capture-get-point)= should not be changed. 4. =(function org-roam--capture-get-point)= should not be changed.
5. ="%?"= is the template inserted on each call to =org-roam--capture=. 5. ="%?"= is the template inserted on each call to =org-roam-capture--capture=.
This template means don't insert any content, but place the cursor This template means don't insert any content, but place the cursor
here. here.
6. =:file-name= is the file-name template for a new note, if it doesn't 6. =:file-name= is the file-name template for a new note, if it doesn't

View file

@ -422,7 +422,7 @@ The template is given a description of @samp{"default"}.
@samp{(function org-roam--capture-get-point)} should not be changed. @samp{(function org-roam--capture-get-point)} should not be changed.
@item @item
@samp{"%?"} is the template inserted on each call to @samp{org-roam--capture}. @samp{"%?"} is the template inserted on each call to @samp{org-roam-capture--capture}.
This template means don't insert any content, but place the cursor This template means don't insert any content, but place the cursor
here. here.

View file

@ -28,7 +28,7 @@ additional properties:
Org-roam's template definitions also extend org-capture's template Org-roam's template definitions also extend org-capture's template
syntax, to allow prefilling of strings. In many scenarios, syntax, to allow prefilling of strings. In many scenarios,
`org-roam--capture` is passed a mapping between variables and strings. `org-roam-capture--capture` is passed a mapping between variables and strings.
For example, during `org-roam-insert`, a title is prompted for. If the For example, during `org-roam-insert`, a title is prompted for. If the
title doesn't already exist, we would like to create a new file, title doesn't already exist, we would like to create a new file,
without prompting for the title again. without prompting for the title again.
@ -105,7 +105,7 @@ Here I walkthrough the default template, reproduced below.
3. `plain` text is inserted. Other options include Org headings via 3. `plain` text is inserted. Other options include Org headings via
`entry`. `entry`.
4. `(function org-roam--capture-get-point)` should not be changed. 4. `(function org-roam--capture-get-point)` should not be changed.
5. `"%?"` is the template inserted on each call to `org-roam--capture`. 5. `"%?"` is the template inserted on each call to `org-roam-capture--capture`.
This template means don't insert any content, but place the cursor This template means don't insert any content, but place the cursor
here. here.
6. `:file-name` is the file-name template for a new note, if it 6. `:file-name` is the file-name template for a new note, if it

View file

@ -155,7 +155,8 @@ function elisp-checkdoc-file {
(when makem-checkdoc-errors-p (when makem-checkdoc-errors-p
(kill-emacs 1)))) (kill-emacs 1))))
(setq checkdoc-spellcheck-documentation-flag t) (setq sentence-end-double-space nil)
(setq checkdoc-spellcheck-documentation-flag nil)
(makem-checkdoc-files-and-exit) (makem-checkdoc-files-and-exit)
EOF EOF
echo $file echo $file
@ -325,7 +326,7 @@ function dirnames {
function filter-files-exclude-default { function filter-files-exclude-default {
# Filter out paths (STDIN) which should be excluded by default. # Filter out paths (STDIN) which should be excluded by default.
egrep -v "(/\.cask/|-autoloads.el|.dir-locals)" egrep -v "(/\.cask/|-autoloads.el|-macs.el|.dir-locals)"
} }
function filter-files-exclude-args { function filter-files-exclude-args {
@ -694,7 +695,7 @@ function lint {
lint-checkdoc lint-checkdoc
lint-compile lint-compile
lint-declare lint-declare
lint-indent # lint-indent
lint-package lint-package
lint-regexps lint-regexps
} }

View file

@ -40,6 +40,8 @@
(defvar org-return-follows-link) (defvar org-return-follows-link)
(defvar org-roam-backlinks-mode) (defvar org-roam-backlinks-mode)
(defvar org-roam-last-window) (defvar org-roam-last-window)
(defvar org-ref-cite-types) ;; in org-ref-core.el
(declare-function org-roam-db--ensure-built "org-roam-db") (declare-function org-roam-db--ensure-built "org-roam-db")
(declare-function org-roam--extract-ref "org-roam") (declare-function org-roam--extract-ref "org-roam")
(declare-function org-roam--get-title-or-slug "org-roam") (declare-function org-roam--get-title-or-slug "org-roam")
@ -100,7 +102,7 @@ When non-nil, the window will not be closed when deleting other windows."
'font-lock-face 'font-lock-face
'org-document-title))) 'org-document-title)))
(defun org-roam--pluralize (string number) (defun org-roam-buffer--pluralize (string number)
"Conditionally pluralize STRING if NUMBER is above 1." "Conditionally pluralize STRING if NUMBER is above 1."
(let ((l (pcase number (let ((l (pcase number
((pred (listp)) (length number)) ((pred (listp)) (length number))
@ -124,7 +126,7 @@ When non-nil, the window will not be closed when deleting other windows."
(progn (progn
(insert (let ((l (length key-backlinks))) (insert (let ((l (length key-backlinks)))
(format "\n\n* %d %s\n" (format "\n\n* %d %s\n"
l (org-roam--pluralize "Cite backlink" l)))) l (org-roam-buffer--pluralize "Cite backlink" l))))
(dolist (group grouped-backlinks) (dolist (group grouped-backlinks)
(let ((file-from (car group)) (let ((file-from (car group))
(bls (cdr group))) (bls (cdr group)))
@ -150,7 +152,7 @@ When non-nil, the window will not be closed when deleting other windows."
(progn (progn
(insert (let ((l (length backlinks))) (insert (let ((l (length backlinks)))
(format "\n\n* %d %s\n" (format "\n\n* %d %s\n"
l (org-roam--pluralize "Backlink" l)))) l (org-roam-buffer--pluralize "Backlink" l))))
(dolist (group grouped-backlinks) (dolist (group grouped-backlinks)
(let ((file-from (car group)) (let ((file-from (car group))
(bls (cdr group))) (bls (cdr group)))

View file

@ -129,9 +129,11 @@ Details on how to specify for the template is given in `org-roam-capture-templat
(defun org-roam-capture--in-process-p () (defun org-roam-capture--in-process-p ()
"Return non-nil if a `org-roam-capture' buffer exists." "Return non-nil if a `org-roam-capture' buffer exists."
(cl-some (lambda (buffer) (cl-some (lambda (buffer)
(and (eq (buffer-local-value 'major-mode (current-buffer)) 'org-mode) (and (eq (buffer-local-value 'major-mode buffer)
(plist-get (buffer-local-value 'org-capture-current-plist (current-buffer)) :org-roam))) 'org-mode)
(buffer-list))) (plist-get (buffer-local-value 'org-capture-current-plist buffer)
:org-roam)))
(buffer-list)))
(defun org-roam-capture--fill-template (str &optional info) (defun org-roam-capture--fill-template (str &optional info)
"Expands the template STR, returning the string. "Expands the template STR, returning the string.
@ -311,7 +313,7 @@ Suitable for moving point."
:group 'org-roam :group 'org-roam
:type 'hook) :type 'hook)
(defun org-roam--capture (&optional goto keys) (defun org-roam-capture--capture (&optional goto keys)
"Create a new file, and return the path to the edited file. "Create a new file, and return the path to the edited file.
The templates are defined at `org-roam-capture-templates'. The The templates are defined at `org-roam-capture-templates'. The
GOTO and KEYS argument have the same functionality as GOTO and KEYS argument have the same functionality as
@ -337,7 +339,7 @@ This uses the templates defined at `org-roam-capture-templates'."
(cons 'file file-path))) (cons 'file file-path)))
(org-roam-capture--context 'capture)) (org-roam-capture--context 'capture))
(setq org-roam-capture-additional-template-props (list :capture-fn 'org-roam-capture)) (setq org-roam-capture-additional-template-props (list :capture-fn 'org-roam-capture))
(org-roam--capture)))) (org-roam-capture--capture))))
(provide 'org-roam-capture) (provide 'org-roam-capture)

View file

@ -73,17 +73,18 @@
"org-roam 1.0.0") "org-roam 1.0.0")
(define-obsolete-function-alias 'org-roam-find-index 'org-roam-jump-to-index (define-obsolete-function-alias 'org-roam-find-index 'org-roam-jump-to-index
"org-roam 1.1.0") "org-roam 1.1.0")
(define-obsolete-function-alias 'org-roam--pluralize 'org-roam-buffer--pluralize
"org-roam 1.1.0")
(define-obsolete-function-alias 'org-roam--capture 'org-roam-capture--capture
"org-roam 1.1.0")
;;;; Variables ;;;; Variables
(define-obsolete-variable-alias 'org-roam-graphviz-extra-options (define-obsolete-variable-alias 'org-roam-graphviz-extra-options
'org-roam-graph-extra-config "org-roam 1.0.0") 'org-roam-graph-extra-config "org-roam 1.0.0")
(define-obsolete-variable-alias 'org-roam-grapher-extra-options (define-obsolete-variable-alias 'org-roam-grapher-extra-options
'org-roam-graph-extra-config "org-roam 1.0.0") 'org-roam-graph-extra-config "org-roam 1.0.0")
(make-obsolete-variable 'org-roam-graph-node-shape 'org-roam-graph-node-extra-config "org-roam 1.0.0") (define-obsolete-variable-alias 'org-roam-graph-node-shape
(defcustom org-roam-graph-node-shape "ellipse" 'org-roam-graph-node-extra-config "org-roam 1.0.0")
"Shape of graph nodes."
:type 'string
:group 'org-roam)
(define-obsolete-variable-alias 'org-roam--db-connection (define-obsolete-variable-alias 'org-roam--db-connection
'org-roam-db--connection "org-roam 1.0.0") 'org-roam-db--connection "org-roam 1.0.0")
(define-obsolete-variable-alias 'org-roam--current-buffer (define-obsolete-variable-alias 'org-roam--current-buffer

View file

@ -1,4 +1,4 @@
;;; org-roam-dialies.el --- Roam Research replica with Org-mode -*- coding: utf-8; lexical-binding: t -*- ;;; org-roam-dailies.el --- Roam Research replica with Org-mode -*- coding: utf-8; lexical-binding: t -*-
;;; ;;;
;; Copyright © 2020 Jethro Kuan <jethrokuan95@gmail.com> ;; Copyright © 2020 Jethro Kuan <jethrokuan95@gmail.com>
@ -52,7 +52,7 @@
(org-roam-capture--info (list (cons 'time time))) (org-roam-capture--info (list (cons 'time time)))
(org-roam-capture--context 'dailies)) (org-roam-capture--context 'dailies))
(add-hook 'org-capture-after-finalize-hook #'org-roam-capture--find-file-h) (add-hook 'org-capture-after-finalize-hook #'org-roam-capture--find-file-h)
(org-roam--capture))) (org-roam-capture--capture)))
(defun org-roam-dailies-today () (defun org-roam-dailies-today ()
"Create and find the daily note for today." "Create and find the daily note for today."
@ -69,7 +69,7 @@ With numeric argument N, use N days in the future."
"Create and find the file for yesterday. "Create and find the file for yesterday.
With numeric argument N, use N days in the past." With numeric argument N, use N days in the past."
(interactive "p") (interactive "p")
(org-roam-tomorrow (- n))) (org-roam-dailies-tomorrow (- n)))
(defun org-roam-dailies-date () (defun org-roam-dailies-date ()
"Create the file for any date using the calendar interface." "Create the file for any date using the calendar interface."
@ -78,4 +78,5 @@ With numeric argument N, use N days in the past."
(org-roam-dailies--file-for-time time))) (org-roam-dailies--file-for-time time)))
(provide 'org-roam-dailies) (provide 'org-roam-dailies)
;;; org-roam-dailies.el ends here ;;; org-roam-dailies.el ends here

View file

@ -39,11 +39,12 @@
(defvar org-roam-directory) (defvar org-roam-directory)
(defvar org-roam-verbose) (defvar org-roam-verbose)
(declare-function org-roam--extract-titles "org-roam") (declare-function org-roam--org-roam-file-p "org-roam")
(declare-function org-roam--extract-ref "org-roam") (declare-function org-roam--extract-and-format-titles "org-roam")
(declare-function org-roam--extract-links "org-roam") (declare-function org-roam--extract-ref "org-roam")
(declare-function org-roam--list-files "org-roam") (declare-function org-roam--extract-links "org-roam")
(declare-function org-roam-buffer--update-maybe "org-roam-buffer") (declare-function org-roam--list-all-files "org-roam")
(declare-function org-roam-buffer--update-maybe "org-roam-buffer")
;;;; Options ;;;; Options
(defcustom org-roam-db-location nil (defcustom org-roam-db-location nil
@ -270,8 +271,9 @@ If the file does not have any connections, nil is returned."
files)) files))
(defun org-roam-db--links-with-max-distance (file max-distance) (defun org-roam-db--links-with-max-distance (file max-distance)
"Return all files reachable from/connected to FILE in at most MAX-DISTANCE steps, "Return all files connected to FILE in at most MAX-DISTANCE steps.
including the file itself. If the file does not have any connections, nil is returned." This includes the file itself. If the file does not have any
connections, nil is returned."
(let* ((query "WITH RECURSIVE (let* ((query "WITH RECURSIVE
links_of(file, link) AS links_of(file, link) AS
(WITH roamlinks AS (SELECT * FROM links WHERE \"type\" = '\"roam\"'), (WITH roamlinks AS (SELECT * FROM links WHERE \"type\" = '\"roam\"'),

View file

@ -62,7 +62,7 @@ It opens or creates a note with the given ref.
(org-roam-capture--info decoded-alist) (org-roam-capture--info decoded-alist)
(template (cdr (assoc 'template decoded-alist)))) (template (cdr (assoc 'template decoded-alist))))
(raise-frame) (raise-frame)
(org-roam--capture nil template) (org-roam-capture--capture nil template)
(message "Item captured."))) (message "Item captured.")))
nil) nil)

View file

@ -42,6 +42,7 @@
(require 's) (require 's)
(require 'f) (require 'f)
(require 'cl-lib) (require 'cl-lib)
;;;; org-roam features ;;;; org-roam features
(require 'org-roam-compat) (require 'org-roam-compat)
(require 'org-roam-macs) (require 'org-roam-macs)
@ -54,6 +55,8 @@
;; To detect cite: links ;; To detect cite: links
(require 'org-ref nil t) (require 'org-ref nil t)
(defvar org-ref-cite-types) ;; from org-ref-core.el
(declare-function org-ref-split-and-strip-string "ext:org-ref-utils" (string))
;;;; Customizable Variables ;;;; Customizable Variables
(defgroup org-roam nil (defgroup org-roam nil
@ -209,7 +212,8 @@ The search terminates when the first property is encountered."
"Crawl CONTENT for relative links and expand them. "Crawl CONTENT for relative links and expand them.
PATH should be the root from which to compute the relativity." PATH should be the root from which to compute the relativity."
(let ((dir (file-name-directory path)) (let ((dir (file-name-directory path))
(re org-roam--org-link-file-bracket-re)) (re org-roam--org-link-file-bracket-re)
link)
(with-temp-buffer (with-temp-buffer
(insert content) (insert content)
(goto-char (point-min)) (goto-char (point-min))
@ -403,7 +407,6 @@ current buffer is used."
(s-downcase slug)))) (s-downcase slug))))
;;; Interactive Commands ;;; Interactive Commands
;;;; org-roam-insert
(defun org-roam--format-link-title (title) (defun org-roam--format-link-title (title)
"Return the link title, given the file TITLE." "Return the link title, given the file TITLE."
(if (functionp org-roam-link-title-format) (if (functionp org-roam-link-title-format)
@ -455,17 +458,16 @@ which takes as its argument an alist of path-completions. See
(delete-region (car region) (cdr region))) (delete-region (car region) (cdr region)))
(insert (org-roam--format-link target-file-path link-description))) (insert (org-roam--format-link target-file-path link-description)))
(when (org-roam-capture--in-process-p) (when (org-roam-capture--in-process-p)
(user-error "Nested Org-roam capture processes not supported")) (user-error "Nested Org-roam capture processes not supported"))
(let ((org-roam-capture--info (list (cons 'title title) (let ((org-roam-capture--info (list (cons 'title title)
(cons 'slug (org-roam--title-to-slug title)))) (cons 'slug (org-roam--title-to-slug title))))
(org-roam-capture--context 'title)) (org-roam-capture--context 'title))
(add-hook 'org-capture-after-finalize-hook #'org-roam-capture--insert-link-h) (add-hook 'org-capture-after-finalize-hook #'org-roam-capture--insert-link-h)
(setq org-roam-capture-additional-template-props (list :region region (setq org-roam-capture-additional-template-props (list :region region
:link-description link-description :link-description link-description
:capture-fn 'org-roam-insert)) :capture-fn 'org-roam-insert))
(org-roam--capture))))) (org-roam-capture--capture)))))
;;;; org-roam-find-file
(defun org-roam--get-title-path-completions () (defun org-roam--get-title-path-completions ()
"Return a list of cons pairs for titles to absolute path of Org-roam files." "Return a list of cons pairs for titles to absolute path of Org-roam files."
(let* ((rows (org-roam-db-query [:select [file titles] :from titles])) (let* ((rows (org-roam-db-query [:select [file titles] :from titles]))
@ -502,15 +504,13 @@ which takes as its argument an alist of path-completions. See
(cons 'slug (org-roam--title-to-slug title)))) (cons 'slug (org-roam--title-to-slug title))))
(org-roam-capture--context 'title)) (org-roam-capture--context 'title))
(add-hook 'org-capture-after-finalize-hook #'org-roam-capture--find-file-h) (add-hook 'org-capture-after-finalize-hook #'org-roam-capture--find-file-h)
(org-roam--capture)))))) (org-roam-capture--capture))))))
;;;; org-roam-find-directory
(defun org-roam-find-directory () (defun org-roam-find-directory ()
"Find and open `org-roam-directory'." "Find and open `org-roam-directory'."
(interactive) (interactive)
(find-file org-roam-directory)) (find-file org-roam-directory))
;;;; org-roam-jump-to-index
(defcustom org-roam-index-file nil (defcustom org-roam-index-file nil
"Path to the Org-roam index file. "Path to the Org-roam index file.
The path can be a string or a function. If it is a string, it The path can be a string or a function. If it is a string, it
@ -555,7 +555,6 @@ command will offer you to create one."
(when (y-or-n-p "Index file does not exist. Would you like to create it? ") (when (y-or-n-p "Index file does not exist. Would you like to create it? ")
(org-roam-find-file "Index"))))) (org-roam-find-file "Index")))))
;;;; org-roam-find-ref
(defun org-roam--get-ref-path-completions () (defun org-roam--get-ref-path-completions ()
"Return a list of cons pairs for refs to absolute path of Org-roam files." "Return a list of cons pairs for refs to absolute path of Org-roam files."
(let ((rows (org-roam-db-query [:select [ref file] :from refs]))) (let ((rows (org-roam-db-query [:select [ref file] :from refs])))
@ -574,7 +573,6 @@ INFO is an alist containing additional information."
:require-match t)))) :require-match t))))
(find-file (cdr (assoc ref completions))))) (find-file (cdr (assoc ref completions)))))
;;;; org-roam-switch-to-buffer
(defun org-roam--get-roam-buffers () (defun org-roam--get-roam-buffers ()
"Return a list of buffers that are Org-roam files." "Return a list of buffers that are Org-roam files."
(--filter (and (with-current-buffer it (derived-mode-p 'org-mode)) (--filter (and (with-current-buffer it (derived-mode-p 'org-mode))
@ -833,10 +831,6 @@ Otherwise, behave as if called interactively."
(replace-match (format "[[file:%s][\\1]]" relative-path)))) (replace-match (format "[[file:%s][\\1]]" relative-path))))
(org-roam-db--update-file file-from))) (org-roam-db--update-file file-from)))
(org-roam-db--update-file new-path)))) (org-roam-db--update-file new-path))))
;;; -
(provide 'org-roam) (provide 'org-roam)
;;; org-roam.el ends here ;;; org-roam.el ends here
;; Local Variables:
;; outline-regexp: ";;;+ "
;; End: