Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Eldev, Makefile, Tests and Update Github Actions #35

Merged
merged 6 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions .github/workflows/lint-emacs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint Emacs
name: CI

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
paths: ['**.el']

jobs:
test:
compile:
runs-on: ubuntu-latest
# continue-on-error: ${{matrix.emacs_version == 'snapshot'}}

Expand All @@ -25,7 +25,53 @@ jobs:
run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh

- name: Check out the source code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Compile the project
run: make compile

lint:
runs-on: ubuntu-latest
# continue-on-error: ${{matrix.emacs_version == 'snapshot'}}

strategy:
matrix:
emacs_version: ['29.1']

steps:
- name: Set up Emacs
uses: purcell/setup-emacs@master
with:
version: ${{matrix.emacs_version}}

- name: Install Eldev
run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh

- name: Check out the source code
uses: actions/checkout@v4

- name: Lint the project
run: eldev -dtT -C compile --warnings-as-errors
run: make lint

test:
runs-on: ubuntu-latest
# continue-on-error: ${{matrix.emacs_version == 'snapshot'}}

strategy:
matrix:
emacs_version: ['snapshot']

steps:
- name: Set up Emacs
uses: purcell/setup-emacs@master
with:
version: ${{matrix.emacs_version}}

- name: Install Eldev
run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh

- name: Check out the source code
uses: actions/checkout@v4

- name: Run tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we keep the tests here we should probably rename the workflow to something like "CI".

run: make test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
elpa*
/clojure-ts-mode-autoloads.el
/clojure-ts-mode-pkg.el

/.eldev
/Eldev-local
27 changes: 27 additions & 0 deletions Eldev
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; -*- mode: emacs-lisp; lexical-binding: t -*-

(eldev-require-version "1.8.2")

(eldev-use-package-archive 'gnu-elpa)
(eldev-use-package-archive 'nongnu-elpa)

(eldev-use-package-archive 'melpa-stable)
(eldev-use-package-archive 'melpa-unstable)

(eldev-use-plugin 'autoloads)

(eldev-add-extra-dependencies 'test 'buttercup)

(setq byte-compile-docstring-max-column 240)
(setq checkdoc-force-docstrings-flag nil)
(setq checkdoc-permit-comma-termination-flag t)
(setq checkdoc--interactive-docstring-flag nil)

(setf eldev-lint-default '(elisp))

(with-eval-after-load 'elisp-lint
;; We will byte-compile with Eldev.
(setf elisp-lint-ignored-validators '("fill-column" "check-declare")
enable-local-variables :safe))

(setq eldev-project-main-file "clojure-ts-mode.el")
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.PHONY: clean compile lint test all
.DEFAULT_GOAL := all

clean:
eldev clean

lint: clean
eldev lint -c

# Checks for byte-compilation warnings.
compile: clean
eldev -dtT compile --warnings-as-errors

test: clean
eldev -dtT -p test

all: clean compile lint test
12 changes: 6 additions & 6 deletions clojure-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ if a third argument (the value) is provided.
(defconst clojure-ts--typedef-symbol-regexp
(eval-and-compile
(rx line-start
(or "defprotocol" "defmulti" "deftype" "defrecord"
"definterface" "defmethod" "defstruct")
line-end))
(or "defprotocol" "defmulti" "deftype" "defrecord"
"definterface" "defmethod" "defstruct")
line-end))
"A regular expression matching a symbol used to define a type.")

(defconst clojure-ts--type-symbol-regexp
Expand Down Expand Up @@ -773,7 +773,7 @@ forms like deftype, defrecord, reify, proxy, etc."

(defun clojure-ts--match-fn-docstring (node)
"Match NODE when it is a docstring for PARENT function definition node."
;; A string that is the third node in a function defn block
;; A string that is the third node in a function defn block
(let ((parent (treesit-node-parent node)))
(and (treesit-node-eq node (treesit-node-child parent 2 t))
(let ((first-auncle (treesit-node-child parent 0 t)))
Expand Down Expand Up @@ -854,11 +854,11 @@ forms like deftype, defrecord, reify, proxy, etc."
(defconst clojure-ts--thing-settings
`((clojure
(sexp ,(regexp-opt clojure-ts--sexp-nodes)
text ,(regexp-opt '("comment"))))))
text ,(regexp-opt '("comment"))))))

(defvar clojure-ts-mode-map
(let ((map (make-sparse-keymap)))
;(set-keymap-parent map clojure-mode-map)
;;(set-keymap-parent map clojure-mode-map)
map))

(defvar clojure-ts-clojurescript-mode-map
Expand Down
29 changes: 29 additions & 0 deletions test/clojure-ts-mode-util-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
;;; clojure-ts-mode-util-test.el --- Clojure TS Mode: util test suite -*- lexical-binding: t; -*-

;; Copyright © 2022-2024 Danny Freeman

;; 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 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 <https://www.gnu.org/licenses/>.

;;; Commentary:

;; The unit test suite of Clojure TS Mode

(require 'clojure-ts-mode)
(require 'buttercup)

(describe "clojure-ts-mode-version"
(it "should not be nil"
(expect clojure-ts-mode-version)))