diff options
-rw-r--r-- | .dir-locals.el | 18 | ||||
-rw-r--r-- | .github/PULL_REQUEST_TEMPLATE.md | 5 | ||||
-rw-r--r-- | .travis.yml | 44 | ||||
-rw-r--r-- | Cask | 1 | ||||
-rw-r--r-- | Makefile | 19 | ||||
-rw-r--r-- | doc/hacking_on_cider.md | 4 | ||||
-rw-r--r-- | test/scripts/cider-bytecomp-warnings.el | 46 | ||||
-rw-r--r-- | test/scripts/cider-checks.el | 33 |
8 files changed, 67 insertions, 103 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index 384200a7..4eefbbfe 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -10,6 +10,24 @@ (checkdoc-symbol-words . ("top-level" "major-mode" "macroexpand-all" "print-level" "print-length")) (checkdoc-package-keywords-flag) (checkdoc-arguments-in-order-flag) + (checkdoc-verb-check-experimental-flag) + (elisp-lint-indent-specs . ((if-let* . 2) + (when-let* . 1) + (let* . defun) + (nrepl-dbind-response . 2) + (cider-save-marker . 1) + (cider-propertize-region . 1) + (cider--make-result-overlay . 1) + ;; need better solution for indenting cl-flet bindings + (multiline-comment-handler . defun) ;; cl-flet + (insert-label . defun) ;; cl-flet + (insert-align-label . defun) ;; cl-flet + (insert-rect . defun) ;; cl-flet + (cl-defun . 2) + (with-parsed-tramp-file-name . 2) + (thread-first . 1) + (thread-last . 1)))) + (emacs-lisp-mode (bug-reference-bug-regexp . "#\\(?2:[[:digit:]]+\\)"))) ;; To use the bug-reference stuff, do: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 69e1ea1e..d0a5e169 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,9 +9,8 @@ by checking the relevant checkboxes): - [ ] The commits are consistent with our [contribution guidelines][1] - [ ] You've added tests (if possible) to cover your change(s) - [ ] All tests are passing (`make test`) -- [ ] The new code is does not generate warnings from: - - [byte-compilation](https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html) (`make test-bytecomp`) - - [`checkdoc`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html) (`make test-checks`) +- [ ] All code passes the linter (`make lint`) which is based on [`elisp-lint`](https://github.com/gonewest818/elisp-lint) and includes + - [byte-compilation](https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html), [`checkdoc`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html), [check-declare](https://www.gnu.org/software/emacs/manual/html_node/elisp/Declaring-Functions.html), packaging metadata, indentation, and trailing whitespace checks. - [ ] You've updated the [changelog][3] (if adding/changing user-visible functionality) - [ ] You've updated the [user manual][4] (if adding/changing user-visible functionality) diff --git a/.travis.yml b/.travis.yml index ad31a0ad..e2729072 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,22 +23,46 @@ env: - PATH=$HOME/local/bin:$HOME/local/evm/bin:$HOME/local/cask/bin:$PATH matrix: - EMACS_BINARY=emacs-24.4-travis MAKE_TEST=test - - EMACS_BINARY=emacs-24.4-travis MAKE_TEST=test-bytecomp - EMACS_BINARY=emacs-24.5-travis MAKE_TEST=test - - EMACS_BINARY=emacs-24.5-travis MAKE_TEST=test-bytecomp - EMACS_BINARY=emacs-25.1-travis MAKE_TEST=test - - EMACS_BINARY=emacs-25.1-travis MAKE_TEST=test-bytecomp - EMACS_BINARY=emacs-25.2-travis MAKE_TEST=test - - EMACS_BINARY=emacs-25.2-travis MAKE_TEST=test-bytecomp - EMACS_BINARY=emacs-25.3-travis MAKE_TEST=test - - EMACS_BINARY=emacs-25.3-travis MAKE_TEST=test-bytecomp - - EMACS_BINARY=emacs-25.3-travis MAKE_TEST=test-checks - EMACS_BINARY=emacs-26-pretest-travis MAKE_TEST=test - - EMACS_BINARY=emacs-26-pretest-travis MAKE_TEST=test-bytecomp - - EMACS_BINARY=emacs-26-pretest-travis MAKE_TEST=test-checks - EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test - - EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test-bytecomp - - EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test-checks + +stages: + - check + - test + +jobs: + include: + # linting for code quality + - stage: check + env: EMACS_BINARY=emacs-24.4-travis MAKE_TEST=lint + - stage: check + env: EMACS_BINARY=emacs-24.5-travis MAKE_TEST=lint + - stage: check + env: EMACS_BINARY=emacs-25.1-travis MAKE_TEST=lint + - stage: check + env: EMACS_BINARY=emacs-25.2-travis MAKE_TEST=lint + - stage: check + env: EMACS_BINARY=emacs-25.3-travis MAKE_TEST=lint + - stage: check + env: EMACS_BINARY=emacs-26-pretest-travis MAKE_TEST=lint + - stage: check + env: EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=lint + + # "matrix" of tests is implicit in the "test" stage + +# be lenient with lint until we've dialed it in + allow_failures: + - env: EMACS_BINARY=emacs-24.4-travis MAKE_TEST=lint + - env: EMACS_BINARY=emacs-24.5-travis MAKE_TEST=lint + - env: EMACS_BINARY=emacs-25.1-travis MAKE_TEST=lint + - env: EMACS_BINARY=emacs-25.2-travis MAKE_TEST=lint + - env: EMACS_BINARY=emacs-25.3-travis MAKE_TEST=lint + - env: EMACS_BINARY=emacs-26-pretest-travis MAKE_TEST=lint + - env: EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=lint before_script: - sh travis-ci/install-gnutls.sh @@ -6,5 +6,6 @@ (files "*.el" (:exclude ".dir-locals.el")) (development + (depends-on "elisp-lint") (depends-on "buttercup") (depends-on "markdown-mode")) @@ -5,9 +5,10 @@ VERSION = $(shell git describe --tags --abbrev=0 | sed 's/^v//') PACKAGE_NAME = cider-$(VERSION) ELS = $(wildcard *.el) +LINTELS = $(filter-out cider-autoloads.el,$(ELS)) OBJECTS = $(ELS:.el=.elc) -.PHONY: elpa build version test test-checks test-bytecomp test-all clean elpaclean run-cider +.PHONY: elpa build version test lint clean elpaclean run-cider .depend: $(ELS) @echo Compute dependencies @@ -34,15 +35,15 @@ version: test: version build $(CASK) exec buttercup -L . -L ./test/utils/ -test-checks: version elpa - $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \ - -l test/scripts/cider-checks.el ./ +lint: version elpa + $(CASK) exec $(EMACS) -Q --batch \ + --eval "(setq enable-local-variables :safe)" \ + -l elisp-lint.el -f elisp-lint-files-batch \ + --no-package-format \ + --no-fill-column \ + $(LINTELS) -test-bytecomp: version elpa - $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \ - -l test/scripts/cider-bytecomp-warnings.el $(ELS) - -test-all: test-checks test-bytecomp test +test-all: lint test clean: rm -f .depend $(OBJECTS) diff --git a/doc/hacking_on_cider.md b/doc/hacking_on_cider.md index 908e49ff..b6825300 100644 --- a/doc/hacking_on_cider.md +++ b/doc/hacking_on_cider.md @@ -71,10 +71,10 @@ $ make test (Note: tests may not run correctly inside Emacs' `shell-mode` buffers. Running them in a terminal is recommended.) -You can also check for the presence of byte-compilation warnings in batch mode: +You can also check for compliance with a variety of coding standards in batch mode (including docstrings and byte-compilation warnings): ``` -$ make test-bytecomp +$ make lint ``` #### Running the tests in Travis CI diff --git a/test/scripts/cider-bytecomp-warnings.el b/test/scripts/cider-bytecomp-warnings.el deleted file mode 100644 index ec47e646..00000000 --- a/test/scripts/cider-bytecomp-warnings.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; cider-bytecomp-warnings.el --- Check for byte-compilation problems - -;; Copyright © 2012-2018 Bozhidar Batsov and contributors -;; -;; 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 of the License, 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 <http://www.gnu.org/licenses/>. - -;; This file is not part of GNU Emacs. - -;;; Commentary: - -;; This is a script to be loaded while visiting a CIDER source file. It will -;; prepare all requirements and then byte-compile the file and signal an error -;; on any warning. For example: -;; -;; emacs -Q --batch -l test/cider-bytecomp-warnings.el cider-mode.el - -;; This assumes that all CIDER dependencies are already on the package dir -;; (probably from running `cask install'). - -(setq load-prefer-newer t) -(add-to-list 'load-path (expand-file-name "./")) -(require 'package) -(package-generate-autoloads 'cider default-directory) -(package-initialize) -(load-file "cider-autoloads.el") -(setq byte-compile-error-on-warn t) - -;; Avoid spurious unused lexical arg warning from `condition-case' -;; See: https://emacs.stackexchange.com/a/10058/10269 -(when (version< emacs-version "25.1") - (setq byte-compile--use-old-handlers nil)) - -(batch-byte-compile) - -;;; cider-bytecomp-warnings.el ends here diff --git a/test/scripts/cider-checks.el b/test/scripts/cider-checks.el deleted file mode 100644 index d7e29980..00000000 --- a/test/scripts/cider-checks.el +++ /dev/null @@ -1,33 +0,0 @@ -;; This is a script to be loaded from the root CIDER directory. It will prepare -;; all requirements and then run `check-declare-directory' on -;; `default-directory'. For example: -;; emacs -Q --batch -l test/cider-checks.el - -;; This assumes that all CIDER dependencies are already on the package dir -;; (probably from running `cask install'). - -(add-to-list 'load-path (expand-file-name "./")) -(require 'package) -(require 'check-declare) -(require 'seq) -(package-initialize) - -;; disable some annoying (or non-applicable) checkdoc checks -(setq checkdoc-package-keywords-flag nil) -(setq checkdoc-arguments-in-order-flag nil) -(setq checkdoc-verb-check-experimental-flag nil) - -(let ((files (seq-filter - (lambda (el) (not (string-match-p "autoloads" el))) - (directory-files default-directory t - "\\`[^.].*\\.el\\'" t)))) - ;; `checkdoc-file' was introduced in Emacs 25 - (when (fboundp 'checkdoc-file) - (dolist (file files) - (checkdoc-file file)) - (when (get-buffer "*Warnings*") - (message "Failing due to checkdoc warnings...") - (kill-emacs 1))) - - (when (apply #'check-declare-files files) - (kill-emacs 1))) |