Skip to content

Commit eb16c51

Browse files
committed
Lint using `package-lint'
1 parent 775bdc4 commit eb16c51

File tree

2 files changed

+37
-31
lines changed

2 files changed

+37
-31
lines changed

Makefile

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ ELC := $(FILES:.el=.elc)
1919

2020
PACKAGE_INIT := -f package-initialize
2121

22-
INSTALL_DEPENDENCIES := ${PACKAGE_INIT} --eval '(progn \
23-
(load "seq" nil t) \
24-
(load "project" nil t) \
25-
(unless (and (fboundp `seq-contains-p) (fboundp `project-name)) \
26-
(package-refresh-contents) \
27-
(package-install (cadr (assoc `project package-archive-contents))) \
28-
(package-install (cadr (assoc `map package-archive-contents))) \
29-
(package-install (cadr (assoc `seq package-archive-contents)))) \
30-
(unless (package-installed-p `ivy) \
31-
(package-refresh-contents) \
22+
INSTALL_DEPENDENCIES := ${PACKAGE_INIT} --eval '(progn \
23+
(load "seq" nil t) \
24+
(load "project" nil t) \
25+
(unless (and (fboundp `seq-contains-p) \
26+
(fboundp `project-name) \
27+
(package-installed-p (quote package-lint))) \
28+
(push (quote ("melpa" . "https://melpa.org/packages/")) package-archives)\
29+
(package-refresh-contents) \
30+
(package-install (quote package-lint)) \
31+
(package-install (cadr (assoc `project package-archive-contents))) \
32+
(package-install (cadr (assoc `map package-archive-contents))) \
33+
(package-install (cadr (assoc `seq package-archive-contents)))) \
34+
(unless (package-installed-p `ivy) \
35+
(package-refresh-contents) \
3236
(package-install `ivy)))'
3337
3438
LIBS := $(patsubst %.el,-l %,${FILES})
@@ -50,28 +54,29 @@ check: compile
5054
--eval '(setq byte-compile-error-on-warn t)' \
5155
-f batch-byte-compile $<
5256
53-
lint:
54-
set -e; \
55-
files=( \
56-
asm-data.el \
57-
asm-jump.el \
58-
asm-x86.el \
59-
asm2src.el \
60-
bdx.el \
61-
binfile.el \
62-
compdb.el \
63-
untemplatize-cxx.el \
64-
); \
65-
for f in $${files[@]}; do \
66-
lint=$$(mktemp) \
67-
&& ${emacs} -Q --batch $$f \
57+
%.lint-checkdoc: %.el
58+
@lint=$$(mktemp); \
59+
${emacs} -Q --batch $< \
6860
--eval '(checkdoc-file (buffer-file-name))' 2>&1 | tee $$lint \
69-
&& test -z "$$(cat $$lint)"; \
70-
done; \
71-
for f in $${files[@]}; do \
72-
sed '1{s/.*//}' $$f | grep -n -E "^.{80,}" `# Catch long lines` \
73-
| sed -r 's/^([0-9]+).*/'$$f':\1: Too long/;q1'; \
74-
done
61+
&& test -z "$$(cat $$lint)"
62+
63+
%.lint-long-lines: %.el
64+
@sed '1{s/.*//}' $< | grep -n -E "^.{80,}" `# Catch long lines` \
65+
| sed -r 's/^([0-9]+).*/'$<':\1: Too long/;q1';
66+
67+
68+
%.lint-package: %.el
69+
@file=$$(mktemp) \
70+
&& ${emacs} -Q --batch ${PACKAGE_INIT} \
71+
-f 'package-lint-batch-and-exit' $< 2>$$file || true \
72+
&& sed -i "/^Entering directory/d" $$file \
73+
&& cat $$file \
74+
&& test -z "$$(cat $$file)"
75+
76+
%.lint: %.el %.lint-checkdoc %.lint-long-lines %.lint-package
77+
@true
78+
79+
lint: $(patsubst %.el,%.lint,$(filter-out %-test.el,$(FILES)))
7580
7681
clean:
7782
rm -f *.elc

asm-data.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
;; Author: Michał Krzywkowski <[email protected]>
66
;; Keywords: languages, tools
7+
;; Package-Requires: ((emacs "27") (seq "2.24"))
78

89
;; This program is free software; you can redistribute it and/or modify
910
;; it under the terms of the GNU General Public License as published by

0 commit comments

Comments
 (0)