Skip to content

Commit 395fc78

Browse files
committed
Add clj-kondo and lint code
1 parent ac5aa9e commit 395fc78

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

Diff for: clj/.clj-kondo/config.edn

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{:lint-as {vim-clojure-static.test/with-tempfile clojure.core/fn
2+
vim-clojure-static.test/defpredicates clojure.core/def
3+
vim-clojure-static.test/defsyntaxtest clojure.core/def
4+
}}

Diff for: clj/src/vim_clojure_static/generate.clj

+4-1
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,11 @@
332332
"Vimscript literal `setlocal lispwords=` statement."
333333
(str "setlocal lispwords=" (string/join \, (sort lispwords)) "\n"))
334334

335-
(defn- comprehensive-clojure-character-property-regexps []
335+
(defn- comprehensive-clojure-character-property-regexps
336336
"A string representing a Clojure literal vector of regular expressions
337337
containing all possible property character classes. For testing Vimscript
338338
syntax matching optimizations."
339+
[]
339340
(let [fmt (fn [prefix prop-key]
340341
(let [props (map (partial format "\\p{%s%s}" prefix)
341342
(sort (get character-properties prop-key)))]
@@ -456,6 +457,8 @@
456457
(spit "tmp/all-char-props.clj"
457458
(comprehensive-clojure-character-property-regexps))
458459

460+
(require 'vim-clojure-static.test)
461+
459462
;; Performance test: `syntax keyword` vs `syntax match`
460463
(vim-clojure-static.test/benchmark
461464
1000 "tmp/bench.clj" (str keyword-groups)

Diff for: clj/src/vim_clojure_static/test.clj

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
(defmacro with-tempfile
1313
{:requires [File]}
14-
[tmp-sym & body]
14+
[[tmp-sym] & body]
1515
`(let [~tmp-sym (File/createTempFile "vim-clojure-static" ".tmp")]
1616
(try
1717
~@body
@@ -23,7 +23,7 @@
2323
value of vim-expr is evaluated as EDN and returned."
2424
[file buf vim-expr & opts]
2525
(let [{:keys [pre]} (apply hash-map opts)]
26-
(with-tempfile tmp
26+
(with-tempfile [tmp]
2727
(io/make-parents file)
2828
(spit file buf)
2929
(spit tmp (str "let @x = " vim-expr))
@@ -121,9 +121,9 @@
121121
122122
`in` and `out` are urls that will be passed to clojure.java.io/resource."
123123
{:requires [#'test/testing #'with-tempfile]}
124-
[string {:keys [in out]} [tmp-sym] & body]
124+
[string {:keys [in out]} [tmp-sym :as tmp-binding] & body]
125125
`(test/testing ~string
126-
(with-tempfile ~tmp-sym
126+
(with-tempfile ~tmp-binding
127127
(try
128128
(spit ~tmp-sym (slurp (~io/resource ~in)))
129129
~@body

Diff for: clj/test/vim_clojure_static/syntax_test.clj

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
(ns vim-clojure-static.syntax-test
55
(:require [vim-clojure-static.test :refer [defpredicates defsyntaxtest]]))
66

7+
;; defpredicates also register not-equal vars, this is just for clj-kondo
8+
(declare !number !regexp-escape !regexp-posix-char-class !regexp-quantifier)
9+
710
(defpredicates number :clojureNumber)
811
(defpredicates kw :clojureKeyword)
912
(defpredicates regexp :clojureRegexp)

0 commit comments

Comments
 (0)