branch: elpa/evil-matchit commit 11f04d25d38198abf6e1a54788c48b99cdbd3d5f Author: Chen Bin <chenbin...@gmail.com> Commit: Chen Bin <chenbin...@gmail.com>
elint and byte-compile added into CI --- Makefile | 26 ++++++++++++++++++------- evil-matchit-ocaml.el | 2 +- tests/my-byte-compile.el | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/my-elint.el | 34 +++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 66f37fb7ae..803cc54b0c 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,20 @@ SHELL = /bin/sh EMACS ?= emacs +.PHONY: deps clean test + +EMACS_BATCH_OPTS=--batch -Q \ +-L . \ +-L deps/evil-1.14.2 \ +-l deps/yaml-mode.el \ +-l deps/lua-mode.el \ +-l deps/markdown-mode.el \ +-L deps/tuareg-2.2.0 \ +-l evil-matchit.el + clean: - @rm -f *~ - @rm -f \#*\# - @rm -f *.elc + @rm -f "*~" "\#*\#" "*.elc" -.PHONY: deps deps: @mkdir -p deps; @if [ ! -f deps/evil-1.14.2/evil.el ]; then curl -L https://stable.melpa.org/packages/evil-1.14.2.tar | tar x -C deps/; fi; @@ -16,7 +24,11 @@ deps: @if [ ! -f deps/tuareg-2.2.0/tuareg.el ]; then curl -L https://stable.melpa.org/packages/tuareg-2.2.0.tar | tar x -C deps/; fi; @if [ ! -f deps/yaml-mode.el ]; then curl -L https://stable.melpa.org/packages/yaml-mode-0.0.15.el > deps/yaml-mode.el; fi; +lint: deps + @$(EMACS) ${EMACS_BATCH_OPTS} -l tests/my-elint.el 2>&1 | grep -E "([Ee]rror|[Ww]arning):" && exit 1 || exit 0 + +compile: deps clean + @$(EMACS) ${EMACS_BATCH_OPTS} -l tests/my-byte-compile.el 2>&1 | grep -E "([Ee]rror|[Ww]arning):" && exit 1 || exit 0 -.PHONY: test -test: deps clean - @$(EMACS) -batch -Q -L . -L deps/evil-1.14.2 -l deps/yaml-mode.el -l deps/lua-mode.el -l deps/markdown-mode.el -L deps/tuareg-2.2.0 -l evil-matchit.el -l tests/evil-matchit-tests.el +test: compile deps clean + @$(EMACS) ${EMACS_BATCH_OPTS} -l evil-matchit.el -l tests/evil-matchit-tests.el diff --git a/evil-matchit-ocaml.el b/evil-matchit-ocaml.el index a558c093b4..af9dc53dd8 100644 --- a/evil-matchit-ocaml.el +++ b/evil-matchit-ocaml.el @@ -98,7 +98,7 @@ such keyword is available." (defun evilmi-ocaml-is-keyword (l keyword) "Checks if the keyword belongs to a row." - (cl-find-if (lambda (w) (string-equal w keyword)) (apply 'append l))) + (cl-find-if (lambda (w) (string= w keyword)) (apply 'append l))) (defun evilmi-ocaml-get-tag-info (keyword) "Find the row in the evilmi-ocaml-keywords." diff --git a/tests/my-byte-compile.el b/tests/my-byte-compile.el new file mode 100644 index 0000000000..6b5df852f5 --- /dev/null +++ b/tests/my-byte-compile.el @@ -0,0 +1,49 @@ +;;; my-elint.el --- syntax check the code -*- lexical-binding: t -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. +;; +;; Author: Chen Bin <chenbin...@gmail.com> +;; URL: https://github.com/tumashu/pyim + +;; This file is NOT part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: +;; Syntax check the pyim code. It's used in Emacs cli. +;; + +;;; Code: + +(require 'find-lisp) + +(let ((files (find-lisp-find-files-internal + "." + (lambda (file dir) + (and (not (file-directory-p (expand-file-name file dir))) + (string-match "\\.el$" file) + (not (string-match "\\.dir-locals.el" file)))) + (lambda (dir parent) + (not (or (string= dir ".") + (string= dir "..") + (string= dir ".git") + (string= dir ".svn") + (string= dir "deps") + (string= dir "tests") + (file-symlink-p (expand-file-name dir parent)))))))) + (dolist (file files) + (byte-compile-file file))) + +(provide 'my-byte-compile) +;;; my-elint.el ends here diff --git a/tests/my-elint.el b/tests/my-elint.el new file mode 100644 index 0000000000..4b5d906378 --- /dev/null +++ b/tests/my-elint.el @@ -0,0 +1,34 @@ +;;; my-elint.el --- syntax check the code -*- lexical-binding: t -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. +;; +;; Author: Chen Bin <chenbin...@gmail.com> +;; URL: https://github.com/tumashu/pyim + +;; This file is NOT part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: +;; Syntax check the pyim code. It's used in Emacs cli. +;; + +;;; Code: +(require 'elint) + +(let ((elint-directory-skip-re "\\(\\.dir-locals\\|ldefs-boot\\|loaddefs\\)\\.el\\'")) + (elint-directory ".")) + +(provide 'my-elint) +;;; my-elint.el ends here