misc small code cleanups

This commit is contained in:
riscy 2020-10-18 21:59:55 -07:00
parent 32a976753b
commit 94f8e84135
3 changed files with 16 additions and 17 deletions

View file

@ -1,3 +1,2 @@
(add-to-list 'load-path (getenv "ELISP_PATH"))
(package-initialize)
(require 'melpazoid)

View file

@ -80,8 +80,9 @@
(ignore-errors (kill-buffer "*Warnings*"))
(let ((sentence-end-double-space nil) ; be a little more lenient
(checkdoc-proper-noun-list nil)
(checkdoc-common-verbs-wrong-voice nil))
(let ((inhibit-message t)) (ignore-errors (checkdoc-file filename))))
(checkdoc-common-verbs-wrong-voice nil)
(inhibit-message t))
(ignore-errors (checkdoc-file filename)))
(if (not (get-buffer "*Warnings*"))
(melpazoid-insert "- No issues!")
(with-current-buffer "*Warnings*"
@ -233,16 +234,16 @@ then also scan comments for REGEXP; similar for INCLUDE-STRINGS."
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(when (save-excursion
(goto-char (match-beginning 0))
(and
(save-excursion
(goto-char (match-beginning 0))
(when (and
(or include-comments (not (nth 4 (syntax-ppss))))
(or include-strings (not (nth 3 (syntax-ppss))))))
;; print a header unless it's already been printed:
(unless melpazoid--misc-header-printed-p
(melpazoid-insert "Other possible lints:")
(setq melpazoid--misc-header-printed-p t))
(melpazoid--annotate-line msg)))))
(or include-strings (not (nth 3 (syntax-ppss)))))
;; print a header unless it's already been printed:
(unless melpazoid--misc-header-printed-p
(melpazoid-insert "Other possible lints:")
(setq melpazoid--misc-header-printed-p t))
(melpazoid--annotate-line msg))))))
(defun melpazoid--annotate-line (msg)
"Annotate the current line with MSG."
@ -278,7 +279,7 @@ OBJECTS are objects to interpolate into the string using `format'."
(set-buffer (find-file filename))
(melpazoid-byte-compile filename)
(melpazoid-checkdoc filename)
;; (melpazoid--check-declare)
;; (melpazoid-check-declare)
(melpazoid-package-lint)
(melpazoid-check-sharp-quotes)
(melpazoid-check-misc))

View file

@ -253,9 +253,8 @@ def _main_file(files: List[str], recipe: str) -> str:
# looks for name-pkg.el, then name-pkg.el.in, and then name.el,
# which happens to match sorted() order:
for el in sorted(files)
if os.path.basename(el) == f"{name}-pkg.el"
or os.path.basename(el) == f"{name}-pkg.el.in"
or os.path.basename(el) == f"{name}.el"
if os.path.basename(el)
in (f"{name}-pkg.el", f"{name}-pkg.el.in", f"{name}.el")
)
except StopIteration:
return ''
@ -715,7 +714,7 @@ def _clone(repo: str, into: str, branch: str, fetcher: str = 'github') -> bool:
if branch:
_note(f"CI workflow detected; using branch '{branch}'", CLR_INFO)
subprocess.run(['mkdir', '-p', into])
os.makedirs(into, exist_ok=True)
scm = 'hg' if fetcher == 'hg' else 'git'
if scm == 'git':
# If a package's repository doesn't use the master branch, then the