|
3 | 3 | ; file, You can obtain one at https://mozilla.org/MPL/2.0/. |
4 | 4 |
|
5 | 5 | (ns noahtheduke.splint.integrations.clj-kondo-test |
| 6 | + {:integration true} |
6 | 7 | (:require |
7 | 8 | [clojure.tools.gitlibs :as gl] |
8 | 9 | [lazytest.core :refer [defdescribe expect it]] |
9 | 10 | [lazytest.extensions.matcher-combinators :refer [match?]] |
10 | | - [noahtheduke.splint.clojure-ext.core :refer [update-vals*]] |
11 | 11 | [matcher-combinators.matchers :as m] |
12 | | - [noahtheduke.splint.config :refer [default-config]] |
| 12 | + [noahtheduke.splint.clojure-ext.core :refer [update-vals*]] |
| 13 | + [noahtheduke.splint.integrations.helpers :refer [usefully-enabled-config]] |
13 | 14 | [noahtheduke.splint.runner :refer [run-impl]])) |
14 | 15 |
|
15 | 16 | (set! *warn-on-reflection* true) |
16 | 17 |
|
17 | | -(def all-enabled-config |
18 | | - (-> @default-config |
19 | | - (update-vals* #(assoc % :enabled true)) |
20 | | - (assoc-in ['style/set-literal-as-fn :enabled] false))) |
21 | | - |
22 | 18 | (def clj-kondo-diagnostics |
23 | 19 | '{lint/assoc-fn 1 |
24 | | - lint/body-unquote-splicing 2 |
25 | | - lint/catch-throwable 4 |
26 | | - lint/defmethod-names 63 |
| 20 | + lint/catch-throwable 6 |
| 21 | + lint/defmethod-names 6 |
27 | 22 | lint/dot-class-method 2 |
28 | | - lint/dot-obj-method 1 |
29 | 23 | lint/fn-wrapper 1 |
30 | | - lint/identical-branches 9 |
31 | | - lint/if-else-nil 42 |
32 | | - lint/if-let-else-nil 2 |
33 | | - lint/if-nil-else 2 |
34 | | - lint/if-not-both 3 |
35 | | - lint/let-if 8 |
36 | | - lint/let-when 2 |
37 | | - lint/misplaced-type-hint 10 |
38 | | - lint/missing-body-in-when 2 |
| 24 | + lint/identical-branches 2 |
| 25 | + lint/if-else-nil 1 |
| 26 | + lint/if-nil-else 1 |
| 27 | + lint/if-not-both 2 |
| 28 | + lint/let-if 3 |
| 29 | + lint/let-when 1 |
| 30 | + lint/missing-body-in-when 1 |
39 | 31 | lint/no-catch 1 |
40 | | - lint/no-op-assignment 2 |
41 | | - lint/prefer-require-over-use 4 |
42 | | - lint/redundant-str-call 18 |
43 | | - lint/thread-macro-one-arg 85 |
44 | | - lint/try-splicing 2 |
45 | | - lint/underscore-in-namespace 1 |
46 | | - lint/warn-on-reflection 229 |
47 | | - metrics/fn-length 314 |
48 | | - metrics/parameter-count 48 |
49 | | - naming/conventional-aliases 14 |
50 | | - naming/conversion-functions 2 |
51 | | - naming/lisp-case 3 |
52 | | - naming/predicate 2 |
| 32 | + lint/no-op-assignment 3 |
| 33 | + lint/redundant-str-call 1 |
| 34 | + lint/thread-macro-one-arg 70 |
| 35 | + lint/try-splicing 3 |
| 36 | + lint/warn-on-reflection 112 |
| 37 | + metrics/fn-length 227 |
| 38 | + metrics/parameter-count 32 |
| 39 | + naming/conventional-aliases 5 |
53 | 40 | naming/record-name 1 |
54 | | - naming/single-segment-namespace 80 |
55 | | - performance/assoc-many 80 |
56 | | - performance/avoid-satisfies 2 |
57 | | - performance/dot-equals 123 |
58 | | - performance/get-keyword 14 |
59 | | - performance/single-literal-merge 9 |
60 | | - splint/parsing-error 4 |
61 | | - style/apply-str 14 |
62 | | - style/apply-str-interpose 3 |
63 | | - style/cond-else 5 |
64 | | - style/def-fn 3 |
65 | | - style/eq-false 2 |
66 | | - style/eq-true 5 |
67 | | - style/eq-zero 2 |
68 | | - style/is-eq-order 27 |
| 41 | + performance/assoc-many 91 |
| 42 | + performance/dot-equals 83 |
| 43 | + performance/get-keyword 12 |
| 44 | + performance/single-literal-merge 2 |
| 45 | + style/apply-str 1 |
| 46 | + style/apply-str-interpose 1 |
| 47 | + style/eq-true 3 |
69 | 48 | style/multiple-arity-order 1 |
70 | | - style/neg-checks 7 |
71 | | - style/new-object 5 |
| 49 | + style/neg-checks 1 |
| 50 | + style/new-object 4 |
72 | 51 | style/not-eq 3 |
73 | | - style/not-nil? 12 |
74 | 52 | style/not-some-pred 2 |
75 | | - style/plus-one 4 |
76 | 53 | style/pos-checks 1 |
77 | | - style/prefer-clj-string 18 |
78 | | - style/prefer-condp 3 |
79 | | - style/prefer-vary-meta 6 |
80 | | - style/prefixed-libspecs 9 |
81 | | - style/redundant-let 6 |
82 | | - style/redundant-nested-call 6 |
83 | | - style/single-key-in 2 |
84 | | - style/tostring 4 |
85 | | - style/useless-do 6 |
86 | | - style/when-do 1 |
87 | | - style/when-not-call 15 |
88 | | - style/when-not-do 1}) |
| 54 | + style/prefer-clj-string 5 |
| 55 | + style/prefer-condp 2 |
| 56 | + style/prefer-vary-meta 2 |
| 57 | + style/single-key-in 1 |
| 58 | + style/tostring 2 |
| 59 | + style/useless-do 2 |
| 60 | + style/when-not-call 12}) |
89 | 61 |
|
90 | | -(defdescribe ^:integration clj-kondo-test |
91 | | - (let [clj-kondo (delay (gl/procure "https://github.com/clj-kondo/clj-kondo.git" 'clj-kondo/clj-kondo "v2023.05.26")) |
| 62 | +(defdescribe clj-kondo-test |
| 63 | + (let [clj-kondo (delay (gl/procure "https://github.com/clj-kondo/clj-kondo.git" |
| 64 | + 'clj-kondo/clj-kondo "v2025.06.05")) |
92 | 65 | results (delay |
93 | | - (run-impl [{:path @clj-kondo}] |
| 66 | + (run-impl [{:path (str @clj-kondo "/src")} |
| 67 | + {:path (str @clj-kondo "/test")}] |
94 | 68 | {:config-override |
95 | | - (-> all-enabled-config |
| 69 | + (-> (usefully-enabled-config) |
96 | 70 | (assoc :silent true) |
97 | 71 | (assoc :parallel false) |
98 | 72 | #_(assoc :autocorrect true) |
99 | 73 | (assoc :clojure-version {:major 1 :minor 11}))})) |
100 | 74 | diagnostics (delay (->> @results |
101 | 75 | :diagnostics |
102 | 76 | (group-by :rule-name)))] |
103 | | - ; (user/pprint (get @diagnostics 'lint/no-op-assignment)) |
| 77 | + ; (user/pprint (into (sorted-map) (dissoc @diagnostics 'lint/warn-on-reflection 'lint/defmethod-names))) |
| 78 | + ; (user/pprint (into (sorted-map) (update-vals* @diagnostics count))) |
104 | 79 | (it "has the right diagnostics" |
105 | 80 | (expect |
106 | 81 | (match? |
107 | 82 | (m/equals clj-kondo-diagnostics) |
108 | 83 | (update-vals* @diagnostics count)))) |
109 | 84 | (it "sums correctly" |
110 | | - (expect (= 1365 (count (:diagnostics @results))))))) |
| 85 | + (expect (= 713 (count (:diagnostics @results))))) |
| 86 | + (it "raises no errors" |
| 87 | + (expect (nil? (get diagnostics 'splint/error)))) |
| 88 | + (it "raises no unknown errors" |
| 89 | + (expect (nil? (get diagnostics 'splint/unknown-error)))))) |
0 commit comments