Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

[kondo] Clean up some avoidable ignores (#84125)

Oleksandr Yakushev2837a5fab3d9
diff --git a/.clj-kondo/src/hooks/common.clj b/.clj-kondo/src/hooks/common.clj
index 2b36c72e4ec..aab2b59b9b6 100644
--- a/.clj-kondo/src/hooks/common.clj
+++ b/.clj-kondo/src/hooks/common.clj
@@ -526,12 +526,3 @@
;; should be 1
(format-string-specifier-count "%-02d"))
-
-(defn add-lsp-ignore-unused-public-var-metadata
- "Add
-
- ^{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
-
- metadata to a node to suppress LSP warnings."
- [node]
- (update-ignored-linters node conj :clojure-lsp/unused-public-var))
diff --git a/.clj-kondo/src/hooks/metabase/models/interface.clj b/.clj-kondo/src/hooks/metabase/models/interface.clj
index 48e7c09c344..fc7a019d8e5 100644
--- a/.clj-kondo/src/hooks/metabase/models/interface.clj
+++ b/.clj-kondo/src/hooks/metabase/models/interface.clj
@@ -16,6 +16,5 @@
(hooks/token-node 'defn)
fn-name
fn-tail))))
- (with-meta (meta node))
- hooks.common/add-lsp-ignore-unused-public-var-metadata)]
+ (with-meta (meta node)))]
{:node node}))
diff --git a/.clj-kondo/src/hooks/metabase/premium_features/defenterprise.clj b/.clj-kondo/src/hooks/metabase/premium_features/defenterprise.clj
index bf7ab08fdb4..99b2bd487ae 100644
--- a/.clj-kondo/src/hooks/metabase/premium_features/defenterprise.clj
+++ b/.clj-kondo/src/hooks/metabase/premium_features/defenterprise.clj
@@ -27,8 +27,7 @@
fn-name
docstring))
fn-tail))
- (with-meta (meta node))
- hooks.common/add-lsp-ignore-unused-public-var-metadata)))}))
+ (with-meta (meta node)))))}))
(comment
(defn- defenterprise* [form]
diff --git a/.clj-kondo/src/hooks/metabase/settings/models/setting.clj b/.clj-kondo/src/hooks/metabase/settings/models/setting.clj
index cf4f90b3414..25eb54d0fdd 100644
--- a/.clj-kondo/src/hooks/metabase/settings/models/setting.clj
+++ b/.clj-kondo/src/hooks/metabase/settings/models/setting.clj
@@ -204,8 +204,7 @@
(hooks/string-node "Docstring.")
(hooks/vector-node [(hooks/token-node '_value-or-nil)]))
hooks/list-node
- (with-meta (meta node))
- common/add-lsp-ignore-unused-public-var-metadata)]
+ (with-meta (meta node)))]
(-> (hooks/list-node
(list
(hooks/token-node 'let)
diff --git a/dev/src/dev/private_things_test.clj b/dev/src/dev/private_things_test.clj
index f4521a0e350..c796ce436fb 100644
--- a/dev/src/dev/private_things_test.clj
+++ b/dev/src/dev/private_things_test.clj
@@ -71,21 +71,19 @@
(def symb+analysis (first (things-that-should-be-private)))
- (privatize-symbol! symb+analysis))
+ (privatize-symbol! symb+analysis)
-;; standalone dev utility for ad hoc privacy audits, with no in-tree caller
-#_{:clj-kondo/ignore [:unused-private-var]}
-(defn- privacy-report
- "Write the privacy report to a file for ad hoc inspection."
- [& _args]
- (when-let [ttsbp (things-that-should-be-private)]
- (spit "privacy_report.txt"
- (str (->> ttsbp
- (take 10)
- (map (fn [ns-name] (str "- `" ns-name "`")))
- (into ["# πŸš«πŸ”’ Top 10 things to make private:"])
- (str/join "\n"))
- "\n"))))
+ (defn- privacy-report
+ "Write the privacy report to a file for ad hoc inspection."
+ [& _args]
+ (when-let [ttsbp (things-that-should-be-private)]
+ (spit "privacy_report.txt"
+ (str (->> ttsbp
+ (take 10)
+ (map (fn [ns-name] (str "- `" ns-name "`")))
+ (into ["# πŸš«πŸ”’ Top 10 things to make private:"])
+ (str/join "\n"))
+ "\n")))))
(deftest ^:parallel things-not-used-elsewhere-should-be-private-test
(testing (str/join \newline ["This var is only used in the namespace it is declared in. Make it private, so"
diff --git a/enterprise/backend/src/metabase_enterprise/action_v2/models/undo.clj b/enterprise/backend/src/metabase_enterprise/action_v2/models/undo.clj
index e165cfb7798..eb706a475d0 100644
--- a/enterprise/backend/src/metabase_enterprise/action_v2/models/undo.clj
+++ b/enterprise/backend/src/metabase_enterprise/action_v2/models/undo.clj
@@ -103,12 +103,11 @@
(prune-batches! retention-batches-per-user :user-id user-id)))
;; This will be used to fix conflict false positives
-#_{:clj-kondo/ignore [:unused-private-var]}
-(defn- diff-keys
- "Give the sorted list of keys on which m1 and m2 differ."
- [m1 m2]
- (->> (into (apply sorted-set (keys m1)) (keys m2))
- (filter #(not= (get m1 %) (get m2 %)))))
+#_(defn- diff-keys
+ "Give the sorted list of keys on which m1 and m2 differ."
+ [m1 m2]
+ (->> (into (apply sorted-set (keys m1)) (keys m2))
+ (filter #(not= (get m1 %) (get m2 %)))))
(defn- conflict?
"Has another change superseded this batch, making it non-undoable? Typically, will mean someone else has edited it."
diff --git a/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj b/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj
index 236adec9163..d6358d0355f 100644
--- a/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/action_v2/models/undo_test.clj
@@ -10,17 +10,18 @@
(use-fixtures :once (fixtures/initialize :test-users-personal-collections))
-(deftest ^:parallel diff-keys-test
- (testing "Detect which keys have changes"
- (is (= [:a :b :c] (#'undo/diff-keys
- nil
- (zipmap [:a :b :c] (range)))))
- (is (= [:a :b :c] (#'undo/diff-keys
- (zipmap [:a :b :c] (range))
- nil)))
- (is (= [:b :c :d] (#'undo/diff-keys
- (zipmap [:a :b :c] (range))
- (zipmap [:a :c :d] (range)))))))
+;; TODO: uncomment when diff-keys is used
+#_(deftest ^:parallel diff-keys-test
+ (testing "Detect which keys have changes"
+ (is (= [:a :b :c] (#'undo/diff-keys
+ nil
+ (zipmap [:a :b :c] (range)))))
+ (is (= [:a :b :c] (#'undo/diff-keys
+ (zipmap [:a :b :c] (range))
+ nil)))
+ (is (= [:b :c :d] (#'undo/diff-keys
+ (zipmap [:a :b :c] (range))
+ (zipmap [:a :c :d] (range)))))))
(defn- table-rows [table-id]
(mt/rows
diff --git a/src/metabase/api_routes/cmd.clj b/src/metabase/api_routes/cmd.clj
index d32eb1ac45d..64e2002bd06 100644
--- a/src/metabase/api_routes/cmd.clj
+++ b/src/metabase/api_routes/cmd.clj
@@ -4,7 +4,6 @@
[metabase.api.docs :as api.docs]))
;; used for `bun run generate-openapi` command
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn generate-openapi-spec!
"Command to generate openapi spec for api routes."
[]
diff --git a/src/metabase/indexed_entities/task/index_values.clj b/src/metabase/indexed_entities/task/index_values.clj
index 9e103b13020..142f70931fc 100644
--- a/src/metabase/indexed_entities/task/index_values.clj
+++ b/src/metabase/indexed_entities/task/index_values.clj
@@ -17,12 +17,8 @@
(set! *warn-on-reflection* true)
-;; reference list of possible model-index :state values; not consulted by code
-#_{:clj-kondo/ignore [:unused-private-var]}
-;; Possible values for the :state field on model index records.
-;; Unused, but kept here for reference.
-(def ^:private model-index-states
- #{"indexed" "initial" "error" "overflow"})
+;; Possible values for the :state field on model index records:
+#_#{"indexed" "initial" "error" "overflow"}
(defn- should-deindex?
"Whether to unindex the the model indexing job.
diff --git a/src/metabase/slackbot/config.clj b/src/metabase/slackbot/config.clj
index 2c4f638c2b1..e1360f1887d 100644
--- a/src/metabase/slackbot/config.clj
+++ b/src/metabase/slackbot/config.clj
@@ -3,7 +3,6 @@
(:require
[metabase.channel.settings :as channel.settings]
[metabase.metabot.settings :as metabot.settings]
- [metabase.slackbot.client :as slackbot.client]
[metabase.slackbot.settings :as slackbot.settings]
[metabase.sso.settings :as sso-settings]
[metabase.system.core :as system]
@@ -68,14 +67,3 @@
(slackbot.settings/metabot-slack-signing-secret)
(channel.settings/unobfuscated-slack-app-token)
(encryption/default-encryption-enabled?))))
-
-;; referenced from with-slackbot-setup's syntax-quoted with-redefs, which clojure-lsp cannot see
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
-(defn validate-bot-token!
- "Validate a Slack bot token using the auth.test endpoint.
- Throws an exception with appropriate status code if validation fails:
- - 400 for invalid/revoked tokens
- - 502 for Slack API errors (e.g., Slack is down)
- Returns the response map on success."
- [token]
- (slackbot.client/auth-test {:token token}))
diff --git a/src/metabase/util.cljc b/src/metabase/util.cljc
index 88e1f01680f..da0dbf05b86 100644
--- a/src/metabase/util.cljc
+++ b/src/metabase/util.cljc
@@ -810,8 +810,6 @@
`profile` form or 1 for a form inside that."
0)
-;; only called from `profile` macroexpansions, so clojure-lsp sees no usage
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn -profile-print-time
"Impl for [[profile]] macro -- don't use this directly. Prints the `___ took ___` message at the conclusion of a
[[profile]]d form."
diff --git a/src/metabase/util/log.clj b/src/metabase/util/log.clj
index 8a346ecb844..6c4aaa5974e 100644
--- a/src/metabase/util/log.clj
+++ b/src/metabase/util/log.clj
@@ -283,8 +283,6 @@
[& args]
`(logf :error ~@args))
-;; part of the public log API; its callers live in test and EE code outside this lint's view
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defmacro fatal
"Log one or more args at the `:fatal` level."
{:arglists '([& args] [e & args])}
@@ -316,7 +314,6 @@
:clj `(clojure.tools.logging/spy ~level ~expr))))
;; legacy REPL/debug API with no in-tree callers; retained pending a compatibility/removal audit
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defmacro spyf
"Evaluates an expression, and may write both the form and its formatted result to the log.
Defaults to the `:debug` level."
diff --git a/src/metabase/util/log.cljs b/src/metabase/util/log.cljs
index 8484e32b4f9..d2e78f4bffe 100644
--- a/src/metabase/util/log.cljs
+++ b/src/metabase/util/log.cljs
@@ -16,15 +16,11 @@
(glogi-console/install!)
(log/set-levels {:glogi/root :info})
-;; called only from glogi macroexpansions (logp/logf/spy), which clojure-lsp can't see
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn is-loggable?
"Part of the internals of [[glogi-logp]] etc."
[logger-name level]
(glog/isLoggable (log/logger logger-name) (log/level level)))
-;; called only from logf macroexpansions, which clojure-lsp can't see
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn format-msg
"Part of the internals of [[logf]]."
[fmt & args]
diff --git a/test/metabase/api/macros_test.clj b/test/metabase/api/macros_test.clj
index 165ec5afdbc..e391173af1d 100644
--- a/test/metabase/api/macros_test.clj
+++ b/test/metabase/api/macros_test.clj
@@ -68,9 +68,7 @@
(mr/def ::id pos-int?)
-;; referenced only inside quoted defendpoint args that parse-args resolves at runtime
-#_{:clj-kondo/ignore [:unused-private-var]}
-(def ^:private RouteParams
+(def RouteParams
[:map
[:id [:string {:api/regex #"[abc]{4}"}]]])
diff --git a/test/metabase/query_processor/perf_test.clj b/test/metabase/query_processor/perf_test.clj
index dffc4202a75..b059a4d5d4b 100644
--- a/test/metabase/query_processor/perf_test.clj
+++ b/test/metabase/query_processor/perf_test.clj
@@ -174,17 +174,16 @@
(qp.compile/compile (query-fn (mp-fn))))
{})))
-;; kept for REPL perf work: single-run timing alternative to the criterium helper above
-#_{:clj-kondo/ignore [:unused-private-var]}
-(defn- compile-time1
- "Times a single run rather than [[crit/quick-benchmark]]."
- [mp-fn query-fn _mem-fn]
- ;; REPL-only single-run timing helper; time's console report is the output
- #_{:clj-kondo/ignore [:discouraged-var]}
- (time (mu/disable-enforcement
- (qp.compile/compile (query-fn (mp-fn))))))
-
(comment
+ ;; Single-run timing alternative to the criterium helper above
+ (defn- compile-time1
+ "Times a single run rather than [[crit/quick-benchmark]]."
+ [mp-fn query-fn _mem-fn]
+ ;; REPL-only single-run timing helper; time's console report is the output
+ #_{:clj-kondo/ignore [:discouraged-var]}
+ (time (mu/disable-enforcement
+ (qp.compile/compile (query-fn (mp-fn))))))
+
;; Preprocesses and compiles a query, with the `lib.computed` cache set throughout.
;; Useful for testing performance impact from the REPL for the large queries above.
;; Returns [nanoseconds result].
diff --git a/test/metabase/slackbot/test_util.clj b/test/metabase/slackbot/test_util.clj
index 3d62a047b30..3af1c54f851 100644
--- a/test/metabase/slackbot/test_util.clj
+++ b/test/metabase/slackbot/test_util.clj
@@ -10,7 +10,6 @@
[metabase.slackbot.api :as slackbot]
[metabase.slackbot.channel :as slackbot.channel]
[metabase.slackbot.client :as slackbot.client]
- [metabase.slackbot.config :as slackbot.config]
[metabase.slackbot.query :as slackbot.query]
[metabase.test :as mt]
[metabase.util.encryption :as encryption]
@@ -116,8 +115,7 @@
Uses `with-temporary-raw-setting-values` to avoid settings with masking getters
saving/restoring the obfuscated value instead of the original."
[& body]
- `(with-redefs [slackbot.config/validate-bot-token! (constantly {:ok true})
- slackbot.client/get-bot-user-id (constantly "UBOT123")]
+ `(with-redefs [slackbot.client/get-bot-user-id (constantly "UBOT123")]
(with-ensure-encryption
(mt/with-temporary-raw-setting-values [site-url "https://localhost:3000"
slack-connect-client-id "test-client-id"
diff --git a/test/metabase/util_test.cljc b/test/metabase/util_test.cljc
index e79eb3b8a77..c5476d6032a 100644
--- a/test/metabase/util_test.cljc
+++ b/test/metabase/util_test.cljc
@@ -379,8 +379,6 @@
false "[email protected]" "metabase.com"
true "[email protected]" "metabase.com"))
-;; defspec-generated test var; the runner finds it via metadata, clojure-lsp sees no reference
-#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defspec pick-first-test 100
(prop/for-all [coll (gen/list gen/small-integer)]
(let [result (u/pick-first pos? coll)]