Skip to content

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

Burn down redundant kondo ignores and stamp the false positives (#77787)

Chris Truter5672dd99c64b
diff --git a/.clj-kondo/ratchets.edn b/.clj-kondo/ratchets.edn
index 3041a95d2c0..8555c69f1ea 100644
--- a/.clj-kondo/ratchets.edn
+++ b/.clj-kondo/ratchets.edn
@@ -5,47 +5,43 @@
;; to defend in your PR.
;; :all is the vector-less ignore form, which suppresses every linter on the next form.
{:ignore-counts {:aliased-namespace-symbol 3
- :all 61
+ :all 50
:case-symbol-test 2
:clojure-lsp/unused-public-var 9
- :consistent-alias 1
:def-fn 1
:deprecated-namespace 97
- :deprecated-var 91
- :discouraged-java-method 4
+ :deprecated-var 81
+ :discouraged-java-method 3
:discouraged-namespace 81
- :discouraged-var 144
- :equals-true 28
- :invalid-arity 1
+ :discouraged-var 108
+ :equals-true 1
:main-without-gen-class 1
:metabase/defsetting-namespace 7
:metabase/disallow-hardcoded-driver-names-in-tests 34
:metabase/discourage-millis-duration 1
- :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests 19
- :metabase/modules 12
+ :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests 14
+ :metabase/modules 8
:metabase/namespace-name 4
- :metabase/prefer-with-dynamic-fn-redefs 35
- :metabase/test-helpers-use-non-thread-safe-functions 40
- :metabase/validate-defendpoint-has-response-schema 462
+ :metabase/prefer-with-dynamic-fn-redefs 25
+ :metabase/test-helpers-use-non-thread-safe-functions 17
+ :metabase/validate-defendpoint-has-response-schema 444
:metabase/validate-defendpoint-query-params-use-kebab-case 40
:metabase/validate-defendpoint-route-uses-kebab-case 44
- :metabase/validate-deftest 19
+ :metabase/validate-deftest 10
:missing-docstring 10
- :missing-protocol-method 4
+ :missing-protocol-method 3
:non-arg-vec-return-type-hint 1
:reduce-without-init 3
:redundant-fn-wrapper 1
- :redundant-nested-call 1
:syntax 2
:unquote-not-syntax-quoted 1
- :unresolved-namespace 5
+ :unresolved-namespace 3
:unresolved-require 1
:unresolved-symbol 4
- :unresolved-var 1
:unsorted-required-namespaces 1
:unused-alias 1
:unused-binding 9
:unused-excluded-var 2
:unused-namespace 1
- :unused-private-var 9
+ :unused-private-var 8
:unused-value 1}}
diff --git a/CLAUDE.md b/CLAUDE.md
index 1e1fd8fd7c1..f9d4c1956b8 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -98,7 +98,14 @@ PR.
Introducing a new linter: `./bin/mage kondo-insert-ignores :the-linter` inserts an ignore at every site it
flags, then `./bin/mage fix-kondo-ratchets --seed :the-linter` records the budget — no big-bang cleanup.
To burn debt down, `./bin/mage kondo-redundant-ignores` lists ignores that are no longer needed (slow:
-full kondo run).
+full kondo run). Kondo's redundancy report can't see hook-linter warnings, so `--fix` re-lints after
+removing, puts any still-working ignore back exactly as it was, and stamps it with a `[kondo-keep]`
+comment; marked sites are skipped on later runs. That verification needs a clean starting point, so
+files with pre-existing lint findings are excluded from the sweep and reported. `--fix --audit` rechecks the
+marked sites too, removing any that have become truly redundant along with their stamped marker
+comments (a marker trailing on a code line is left for a hand fix). `[kondo-keep]` can also be added
+by hand to protect an ignore whose exact form matters — it only counts on the line directly above the
+ignore, or trailing on the ignore's own line.
## Tool Preferences
diff --git a/bb.edn b/bb.edn
index 8b7845fb816..6d622d9e3a6 100644
--- a/bb.edn
+++ b/bb.edn
@@ -286,8 +286,10 @@
kondo-redundant-ignores
{:doc "Report inline kondo ignores that are no longer necessary (slow: full kondo run)."
:examples [["./bin/mage kondo-redundant-ignores" "Scan the backend tree for removable ignores"]
- ["./bin/mage kondo-redundant-ignores --fix" "Also remove them from source"]]
- :options [["-f" "--fix" "Remove the candidate ignores from source"]]
+ ["./bin/mage kondo-redundant-ignores --fix" "Also remove them from source (restores + marks [kondo-keep] any that re-trigger)"]
+ ["./bin/mage kondo-redundant-ignores --fix --audit" "Recheck [kondo-keep] sites too, unmarking any now truly redundant"]]
+ :options [["-f" "--fix" "Remove the candidate ignores from source"]
+ ["-a" "--audit" "Include sites marked [kondo-keep] instead of skipping them"]]
:requires [[mage.kondo-ratchet]]
:task (task! (mage.kondo-ratchet/redundant-ignores parsed))}
diff --git a/bin/build/src/metabuild_common/files.clj b/bin/build/src/metabuild_common/files.clj
index 4614202b0c3..3cd7ebecbf0 100644
--- a/bin/build/src/metabuild_common/files.clj
+++ b/bin/build/src/metabuild_common/files.clj
@@ -169,7 +169,6 @@
(doseq [^File file (file-seq source-path)
:when (not (directory? file))
:when
- #_{:clj-kondo/ignore [:discouraged-var]}
(or (str/ends-with? (str/lower-case file) "yaml")
(str/ends-with? (str/lower-case file) "yml"))]
(when verbose (out/safe-println "Zipping file:" file))
diff --git a/bin/build/test/i18n/create_artifacts/backend_test.clj b/bin/build/test/i18n/create_artifacts/backend_test.clj
index f9fdb698473..0383c3fabad 100644
--- a/bin/build/test/i18n/create_artifacts/backend_test.clj
+++ b/bin/build/test/i18n/create_artifacts/backend_test.clj
@@ -27,7 +27,6 @@
(deftest ^:parallel backend-message?
(testing "messages present in any .clj and .cljc files are detected as backend messages"
- #_{:clj-kondo/ignore [:equals-true]}
(are [source-references expected] (= expected
(i18n/backend-message? {:source-references source-references}))
;; Simple .clj and .cljc files with and without line numbers
diff --git a/bin/lint-migrations-file/src/lint_migrations_file.cljc b/bin/lint-migrations-file/src/lint_migrations_file.cljc
index 5fc3a41c663..5b011c42ffc 100644
--- a/bin/lint-migrations-file/src/lint_migrations_file.cljc
+++ b/bin/lint-migrations-file/src/lint_migrations_file.cljc
@@ -368,17 +368,14 @@
(println)
#_:clj-kondo/ignore
(printf "Error in %s:\t%s\n" (:file (ex-data e)) (.getMessage e))
- #_:clj-kondo/ignore
(printf "Details:\n\n %s" (with-out-str (pprint/pprint (dissoc (ex-data e) ::validation-error))))
(println))
(do
(pprint/pprint (Throwable->map e))
(println (.getMessage e))))
- #_:clj-kondo/ignore
(System/exit 1))
(catch #_:clj-kondo/ignore
Throwable e
(pprint/pprint (Throwable->map e))
(println (.getMessage e))
- #_:clj-kondo/ignore
(System/exit 1))))
diff --git a/dev/src/dev.clj b/dev/src/dev.clj
index 7820b03ec19..f51eda9c042 100644
--- a/dev/src/dev.clj
+++ b/dev/src/dev.clj
@@ -158,7 +158,6 @@
(let [h2-dbs (t2/select :model/Database :engine :h2)
in-memory? (fn [db] (some-> db :details :db (str/starts-with? "mem:")))
can-connect? (fn [db]
- #_:clj-kondo/ignore
(binding [driver.settings/*allow-testing-h2-connections* true]
(try
(driver/can-connect? :h2 (:details db))
diff --git a/enterprise/backend/src/metabase_enterprise/library/api.clj b/enterprise/backend/src/metabase_enterprise/library/api.clj
index 6a99374f611..a33fea17595 100644
--- a/enterprise/backend/src/metabase_enterprise/library/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/library/api.clj
@@ -39,10 +39,6 @@
true sort
true ((partial map name))))))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/" :- [:or ::collections.schema/CollectionItem [:map [:data nil?]]]
"Get the Library. If no library exists, it doesn't fail but returns an empty response"
[_route
diff --git a/enterprise/backend/src/metabase_enterprise/semantic_search/pgvector_api.clj b/enterprise/backend/src/metabase_enterprise/semantic_search/pgvector_api.clj
index 7282469e950..5939f5d55ca 100644
--- a/enterprise/backend/src/metabase_enterprise/semantic_search/pgvector_api.clj
+++ b/enterprise/backend/src/metabase_enterprise/semantic_search/pgvector_api.clj
@@ -22,7 +22,6 @@
(set! *warn-on-reflection* true)
-#_{:clj-kondo/ignore [unresolved-require]}
(comment
(require '[metabase-enterprise.semantic-search.db.datasource :as semantic.db])
(def pgvector (or @semantic.db/data-source (semantic.db/init-db!)))
diff --git a/enterprise/backend/src/metabase_enterprise/support_access_grants/api.clj b/enterprise/backend/src/metabase_enterprise/support_access_grants/api.clj
index b86fd7ec78e..37d3688dad8 100644
--- a/enterprise/backend/src/metabase_enterprise/support_access_grants/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/support_access_grants/api.clj
@@ -9,10 +9,6 @@
[metabase.request.core :as request]
[metabase.util.malli.schema :as ms]))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/"
:- ::grants.schema/grant-response
"Create a new support access grant.
@@ -28,10 +24,6 @@
(:ticket_number body)
(:notes body)))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :put "/:id/revoke"
:- ::grants.schema/grant-response
"Revoke an existing support access grant.
@@ -42,10 +34,6 @@
(api/write-check :model/SupportAccessGrantLog id)
(grants/revoke-grant! api/*current-user-id* id))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/"
:- ::grants.schema/list-grants-response
"List support access grants with optional filtering and pagination.
@@ -70,10 +58,6 @@
:user-id user-id
:include-revoked include-revoked}))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/current"
:- ::grants.schema/current-grant-response
"Get the currently active support access grant, if one exists.
diff --git a/enterprise/backend/src/metabase_enterprise/transforms_python/impl.clj b/enterprise/backend/src/metabase_enterprise/transforms_python/impl.clj
index bb23a6940ab..b7289c7b1d8 100644
--- a/enterprise/backend/src/metabase_enterprise/transforms_python/impl.clj
+++ b/enterprise/backend/src/metabase_enterprise/transforms_python/impl.clj
@@ -3,7 +3,6 @@
[metabase-enterprise.transforms-python.execute :as transforms-python.execute]
[metabase.transforms.interface :as transforms.i]))
-#_{:clj-kondo/ignore [:discouraged-var]}
(defmethod transforms.i/execute! :python
[transform options]
(transforms-python.execute/execute-python-transform! transform options))
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 b282d4abce2..236adec9163 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
@@ -61,7 +61,6 @@
;; I'm OK reducing this scenario's scope once we have e2e tests.
;; Until then, I think this is ideal.
-#_{:clj-kondo/ignore [:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]}
(deftest undo-redo-single-user-single-table-single-record-integration-test
(mt/with-empty-h2-app-db!
(mt/with-premium-features #{:table-data-editing}
@@ -121,7 +120,6 @@
;; I'm OK reducing this scenario's scope once we have e2e tests.
;; Until then, I think this is ideal.
-#_{:clj-kondo/ignore [:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]}
(deftest undo-redo-multi-user-single-table-single-record-integration-test
(mt/with-empty-h2-app-db!
(mt/with-premium-features #{:table-data-editing}
diff --git a/enterprise/backend/test/metabase_enterprise/remote_sync/impl_test.clj b/enterprise/backend/test/metabase_enterprise/remote_sync/impl_test.clj
index 7806b031cd9..3a7e735f884 100644
--- a/enterprise/backend/test/metabase_enterprise/remote_sync/impl_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/remote_sync/impl_test.clj
@@ -23,7 +23,6 @@
(use-fixtures :once (fixtures/initialize :db))
;; `reindex!` below is ok in a parallel test since it's not actually executing anything
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [f]
(mt/with-dynamic-fn-redefs [search/reindex! (constantly nil)]
(test-helpers/clean-remote-sync-state f))))
diff --git a/enterprise/backend/test/metabase_enterprise/remote_sync/snippets_test.clj b/enterprise/backend/test/metabase_enterprise/remote_sync/snippets_test.clj
index 0917881b345..b6ddf32ca84 100644
--- a/enterprise/backend/test/metabase_enterprise/remote_sync/snippets_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/remote_sync/snippets_test.clj
@@ -39,7 +39,6 @@
(finally
(t2/delete! :model/RemoteSyncObject))))
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [f]
(mt/with-dynamic-fn-redefs [search/reindex! (constantly nil)]
(clean-remote-sync-state f))))
diff --git a/enterprise/backend/test/metabase_enterprise/remote_sync/transforms_test.clj b/enterprise/backend/test/metabase_enterprise/remote_sync/transforms_test.clj
index 422c3393696..aba12f0ec1e 100644
--- a/enterprise/backend/test/metabase_enterprise/remote_sync/transforms_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/remote_sync/transforms_test.clj
@@ -21,7 +21,6 @@
(use-fixtures :once (fixtures/initialize :db))
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each test-helpers/commit-with-temp
(fn [f]
(mt/with-dynamic-fn-redefs [search/reindex! (constantly nil)]
diff --git a/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj b/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj
index 8a290ad316a..72cc9edf982 100644
--- a/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/replacement/runner_test.clj
@@ -205,7 +205,6 @@
(start-run! [_])
(succeed-run! [_])
(fail-run! [_ _]))]
- #_{:clj-kondo/ignore [:unresolved-var]}
(replacement.runner/run-swap-source! [:card old-id] [:card new-id] progress)
(testing "child card's source-card is updated to new model"
(is (= new-id (get-in (t2/select-one-fn :dataset_query :model/Card :id child-id)
diff --git a/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj b/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj
index a73f93a378e..7cecdeb569e 100644
--- a/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/sandbox/query_processor/middleware/sandboxing_test.clj
@@ -1032,7 +1032,6 @@
(get-in (-> drill-thru-query
qp.preprocess/preprocess
;; legacy usage -- don't do things like this going forward
- #_{:clj-kondo/ignore [:discouraged-var]}
lib/->legacy-MBQL)
[:query :filter])))))]
(testing "As an admin"
diff --git a/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj b/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj
index 9bcf798372f..819fd769978 100644
--- a/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/security_center/matching_test.clj
@@ -31,7 +31,6 @@
nil
"")))
-#_:clj-kondo/ignore
(deftest ^:parallel affected-by-version?-test
(let [v matching/parse-version
in-range? @#'matching/affected-by-version?
diff --git a/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj b/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj
index 4616911649a..72ca9a3f6be 100644
--- a/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/semantic_search/repair_test.clj
@@ -96,7 +96,6 @@
(semantic.tu/with-test-db! {:mode :blank}
;; with-redefs mirrors the :mock-initialized bindings, which include non-fn values that
;; with-dynamic-fn-redefs cannot proxy.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [semantic.embedding/get-configured-model (fn [] semantic.tu/mock-embedding-model)
semantic.index-metadata/default-index-metadata semantic.tu/mock-index-metadata
semantic.index/model-table-suffix semantic.tu/mock-table-suffix]
diff --git a/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj b/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj
index c9ee7c9f8b7..9e385de3ea0 100644
--- a/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj
+++ b/enterprise/backend/test/metabase_enterprise/serialization/test_util.clj
@@ -49,7 +49,6 @@
"Wraps with-temp*, but binding `*allow-deleting-personal-collections*` to true so that temporary personal collections
can still be deleted."
[model-bindings & body]
- #_{:clj-kondo/ignore [:discouraged-var]}
`(binding [collection/*allow-deleting-personal-collections* true]
(mt/with-temp ~model-bindings ~@body)))
diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj
index 7099fcbda06..7a13b03f3a3 100644
--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/e2e_test.clj
@@ -35,7 +35,6 @@
;; `reindex!` below is ok in a parallel test since it's not actually executing anything.
;; Many tests here rely on the H2 test-data database via Card defaults, so we keep the H2 guard
;; off and re-enable the H2 path in the extract (production keeps it filtered).
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [thunk]
(mt/with-dynamic-fn-redefs [search/reindex! (constantly nil)
models.database/assert-not-h2! (constantly nil)]
diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj
index 2c5db7237fb..ca489d8b5e9 100644
--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/load_test.clj
@@ -25,7 +25,6 @@
;; `reindex!` below is ok in a parallel test since it's not actually executing anything.
;; Many tests here use the H2 test-data database (Card defaults), so we keep the H2 guard off
;; and re-enable H2 in the extract (production keeps it filtered).
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [thunk]
(mt/with-dynamic-fn-redefs [search/reindex! (constantly nil)
models.database/assert-not-h2! (constantly nil)]
diff --git a/enterprise/backend/test/metabase_enterprise/serialization/v2/osi_ai_context_test.clj b/enterprise/backend/test/metabase_enterprise/serialization/v2/osi_ai_context_test.clj
index c5a49ce43b0..803c0babbb3 100644
--- a/enterprise/backend/test/metabase_enterprise/serialization/v2/osi_ai_context_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/serialization/v2/osi_ai_context_test.clj
@@ -20,7 +20,6 @@
(set! *warn-on-reflection* true)
;; The references point at the H2 test-data Table, so keep the H2 guard off and re-enable H2 in extract.
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [thunk]
(mt/with-dynamic-fn-redefs [search/reindex! (constantly nil)
models.database/assert-not-h2! (constantly nil)]
diff --git a/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj b/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj
index 8d93418e940..300d26cb9f8 100644
--- a/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/sso/integrations/jwt_test.clj
@@ -630,6 +630,7 @@
(t2/update! :model/User :email "[email protected]" {:is_active false})
(is (not (t2/select-one-fn :is_active :model/User :email "[email protected]")))
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/jwt-user-provisioning-enabled? (constantly false)
appearance.settings/site-name (constantly "test")]
@@ -822,6 +823,7 @@
:is_active false}
:model/User {existing-email :email} {:tenant_id tenant-id}]
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/jwt-user-provisioning-enabled? (constantly false)]
(testing "with user provisioning turned off"
@@ -969,6 +971,7 @@
(testing "When user provisioning is disabled, throw an error if we attempt to create a new user."
(with-jwt-default-setup!
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/jwt-user-provisioning-enabled? (constantly false)
appearance.settings/site-name (constantly "test")]
diff --git a/enterprise/backend/test/metabase_enterprise/sso/integrations/ldap_test.clj b/enterprise/backend/test/metabase_enterprise/sso/integrations/ldap_test.clj
index df6f5d9b186..864e5fa76dd 100644
--- a/enterprise/backend/test/metabase_enterprise/sso/integrations/ldap_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/sso/integrations/ldap_test.clj
@@ -288,6 +288,7 @@
(ldap.test/with-ldap-server!
(testing "an error is thrown when a new user attempts to login via provider/login! and user provisioning is not enabled"
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/ldap-user-provisioning-enabled? (constantly false)
appearance.settings/site-name (constantly "test")]
diff --git a/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj b/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj
index ad4f6ce1fe6..d621933f388 100644
--- a/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/sso/integrations/oidc_test.clj
@@ -238,6 +238,7 @@
*group-sync-email* email]
(with-group-sync-oidc!
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [oidc.state/validate-oidc-callback
(fn [_request _state _provider & _opts]
diff --git a/enterprise/backend/test/metabase_enterprise/sso/integrations/saml_test.clj b/enterprise/backend/test/metabase_enterprise/sso/integrations/saml_test.clj
index 79d9be0d636..aea87ae47e4 100644
--- a/enterprise/backend/test/metabase_enterprise/sso/integrations/saml_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/sso/integrations/saml_test.clj
@@ -615,6 +615,7 @@
(t2/update! :model/User :%lower.email "[email protected]" {:is_active false})
(testing "We can't reactivate the user if user provisioning is disabled."
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/saml-user-provisioning-enabled? (constantly false)
appearance.settings/site-name (constantly "test")]
@@ -766,6 +767,7 @@
(with-other-sso-types-disabled!
(with-saml-default-setup!
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/saml-user-provisioning-enabled? (constantly false)
appearance.settings/site-name (constantly "test")]
@@ -973,6 +975,7 @@
(fn []
;; Mock the saml-response->attributes function to return mixed attribute types.
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [saml.p/saml-response->attributes
(fn [_]
@@ -1094,6 +1097,7 @@
(is (successful-login? response)))))
(testing "an existing user also fails to log in"
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [saml.p/saml-response->attributes
(fn [_]
@@ -1115,6 +1119,7 @@
:is_active false}
:model/User {existing-email :email} {:tenant_id tenant-id}]
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [sso-settings/saml-user-provisioning-enabled? (constantly false)]
(do-with-some-validators-disabled!
@@ -1127,7 +1132,6 @@
(is (not (successful-login? response))))))
(testing "an existing user also fails to log in"
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [saml.p/saml-response->attributes
(fn [_]
{"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" existing-email
@@ -1152,6 +1156,7 @@
(fn []
(testing "tenant -> other tenant fails with correct error message"
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [saml.p/saml-response->attributes
(fn [_]
@@ -1176,6 +1181,7 @@
(fn []
;; Use the regular new-user response which doesn't have tenant attribute.
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [saml.p/saml-response->attributes
(fn [_]
@@ -1198,6 +1204,7 @@
(do-with-some-validators-disabled!
(fn []
;; with-redefs (cross-thread): /auth/sso runs on Jetty workers that don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [saml.p/saml-response->attributes
(fn [_]
diff --git a/enterprise/backend/test/metabase_enterprise/transforms_python/drivers_test.clj b/enterprise/backend/test/metabase_enterprise/transforms_python/drivers_test.clj
index 1e785d8d305..2505c19560e 100644
--- a/enterprise/backend/test/metabase_enterprise/transforms_python/drivers_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/transforms_python/drivers_test.clj
@@ -191,7 +191,6 @@
:rows rows
:metadata metadata})))
-#_:clj-kondo/ignore
(defmacro with-test-table
[[table-id table-name] [schema data] & body]
`(let [table-name# (if (= :redshift driver/*driver*)
diff --git a/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj b/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj
index 608c9ffbc62..0028881e46f 100644
--- a/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/workspaces/e2e_test.clj
@@ -277,7 +277,6 @@
;; `^:synchronized` because the `instance-workspace` setting is process-wide state
;; backed by the shared test app DB; running concurrently with other workspace-mode
;; tests would cross-pollute.
-#_{:clj-kondo/ignore [:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]}
(defn- with-redshift-describe-filter-disabled
"Redshift test infra normally filters describe-database to only return tables
prefixed by dataset name (`<dataset>_<name>`). Workspace e2e creates tables
diff --git a/enterprise/backend/test/metabase_enterprise/workspaces/transform_hooks_test.clj b/enterprise/backend/test/metabase_enterprise/workspaces/transform_hooks_test.clj
index 21c418d203b..0a4fbe06fc1 100644
--- a/enterprise/backend/test/metabase_enterprise/workspaces/transform_hooks_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/workspaces/transform_hooks_test.clj
@@ -93,7 +93,6 @@
(wired in `transforms.execute/execute!`), so the captured target reflects the post-rewrite
state — the question this helper answers is 'what does the per-type method actually see?'."
[captured-atom body-fn]
- #_{:clj-kondo/ignore [:discouraged-var]}
(with-redefs [transforms.i/execute! (fn [transform _opts]
(reset! captured-atom transform)
{:status :succeeded})]
diff --git a/mage/src/mage/cli.clj b/mage/src/mage/cli.clj
index a4b1e5e3708..b2572019536 100644
--- a/mage/src/mage/cli.clj
+++ b/mage/src/mage/cli.clj
@@ -86,14 +86,12 @@
(if (mc/validate arg-schema decoded-args)
decoded-args
(do (doseq [{:keys [path schema value]} (:errors
- #_:clj-kondo/ignore
(mc/explain arg-schema decoded-args))]
(println (c/red "Invalid Argument at " path
". It should match: " (mc/form schema)
" got: " (pr-str value))))
(binding [*command-line-args* ["-h"]]
(check-print-help current-task))
- #_{:clj-kondo/ignore [:discouraged-java-method]}
(System/exit 0))))))
(defn- check-option-errors [option-errors *error-hit? summary]
diff --git a/mage/src/mage/kondo_ratchet.clj b/mage/src/mage/kondo_ratchet.clj
index 71ae9323d21..0db2c6b4308 100644
--- a/mage/src/mage/kondo_ratchet.clj
+++ b/mage/src/mage/kondo_ratchet.clj
@@ -24,6 +24,42 @@
(cond->> findings
linter (filter #(= (:type %) linter)))))
+(def keep-marker
+ "Comment token marking an ignore as a verified `:redundant-ignore` false positive.
+ Sites carrying it are skipped by [[redundant-ignores]] unless `--audit` rechecks them."
+ "[kondo-keep]")
+
+(def ^:private keep-comment
+ (str ";; " keep-marker " suppresses a warning :redundant-ignore can't see; --audit rechecks"))
+
+(defn- comment-start
+ "Index of the `;` starting `line`'s comment, skipping semicolons inside string literals and after a
+ backslash (char literals, string escapes). Line-local: a string opened on an earlier line isn't
+ visible, which is fine for locating marker comments. Nil when the line has no comment."
+ [line]
+ (let [line (str line)
+ n (count line)]
+ (loop [i 0, in-string? false]
+ (when (< i n)
+ (let [c (.charAt ^String line i)]
+ (cond
+ (= c \\) (recur (+ i 2) in-string?)
+ (= c \") (recur (inc i) (not in-string?))
+ (and (= c \;) (not in-string?)) i
+ :else (recur (inc i) in-string?)))))))
+
+(defn- marker-on-line?
+ "Is [[keep-marker]] in `line`'s comment? The marker inside a string literal doesn't count."
+ [line]
+ (boolean (when-let [i (comment-start line)]
+ (str/includes? (subs (str line) i) keep-marker))))
+
+(defn- marked-row?
+ "Does the ignore starting on 1-based `row` of `lines` carry [[keep-marker]] -- on the line directly
+ above, or trailing on the ignore's own line?"
+ [lines row]
+ (boolean (some marker-on-line? [(get lines (- row 2)) (get lines (dec row))])))
+
(defn- insert-ignore-lines
"`text` with an ignore inserted above each 1-based row of `row->linters`, at matching indentation."
[text row->linters]
@@ -40,17 +76,159 @@
(sort-by key > row->linters)))
ending)))
+(defn- reinsert-ignores
+ "`text` with removed ignore forms put back exactly as they were: each site is a
+ [[remove-ignores-at]] `:sites` entry (`:row` in current coordinates) plus optional `:comment` to
+ stamp above it. A whole-line original returns as its original line(s); an inline original is
+ spliced back at its original column. Returns `{:text _, :inserted-rows [...]}` with one entry per
+ physical line added, for shifting other row bookkeeping past the inserts."
+ [text sites]
+ (let [ending (if (str/ends-with? text "\n") "\n" "")
+ ;; phase 1: all inline splices, right-to-left within a row so earlier columns stay valid;
+ ;; nothing is added or removed as a line, so every :row still indexes the original vector
+ spliced (reduce (fn [lines {:keys [row original]}]
+ (if (:whole-line? original)
+ lines
+ (update lines (dec row)
+ (fn [line]
+ (let [rest-of-line (subs line (dec (:col original)))]
+ (str (subs line 0 (dec (:col original)))
+ (:text original)
+ (:separator original)
+ rest-of-line))))))
+ (vec (str/split-lines text))
+ (sort-by (fn [{:keys [row original]}] [row (:col original -1)])
+ #(compare %2 %1)
+ sites))
+ ;; phase 2: line insertions (comments, whole-line originals), bottom-up; splicing first means
+ ;; a comment inserted above a row can no longer displace a same-row splice target. Within a
+ ;; row, inline comments insert first so they end up directly above the code line, below any
+ ;; whole-line block that lands on the same row -- each ignore keeps its own marker adjacent.
+ result (reduce
+ (fn [{:keys [lines] :as acc} {:keys [row original comment]}]
+ (let [original-lines (str/split-lines (:text original))
+ whole-line? (:whole-line? original)
+ indent (if whole-line?
+ (re-find #"^\s*" (or (first original-lines) ""))
+ (re-find #"^\s*" (get lines (dec row) "")))
+ added (concat (when comment [(str indent comment)])
+ (when whole-line? original-lines))
+ ;; an inline splice added its span-internal newlines in phase 1
+ n-added (+ (count added)
+ (if whole-line? 0 (dec (count original-lines))))]
+ {:lines (into (into (subvec lines 0 (dec row)) added)
+ (subvec lines (dec row)))
+ :inserted (into (:inserted acc) (repeat n-added row))}))
+ {:lines spliced, :inserted []}
+ (sort-by (fn [{:keys [row original]}]
+ [row (if (:whole-line? original) 0 1)])
+ #(compare %2 %1)
+ sites))]
+ {:text (str (str/join "\n" (:lines result)) ending)
+ :inserted-rows (:inserted result)}))
+
+(defn- shift-past-inserts
+ "`row` moved down one for each line inserted at or above it, `inserted-rows` being in the same
+ pre-insertion coordinates as `row`."
+ [row inserted-rows]
+ (+ row (count (filter #(<= % row) inserted-rows))))
+
+(defn- shift-site-past-inserts
+ "Move a pending site's restore anchor past inserted lines. A marked whole-line site's anchor stays
+ immediately below its reserved marker when another restore inserts at that same anchor; inserts
+ strictly above it still move the marker and anchor together."
+ [site inserted-rows]
+ (if (and (:was-marked? site) (get-in site [:original :whole-line?]))
+ (update site :row (fn [row] (+ row (count (filter #(< % row) inserted-rows)))))
+ (update site :row shift-past-inserts inserted-rows)))
+
+(defn- site-restore-plan
+ "Restore sites annotated with `:comment` (and sometimes an adjusted `:row`), so every restored
+ ignore ends up with its own marker adjacent and no insert splits an existing marker from the line
+ it marks. A whole-line site that was itself marked before removal (`:was-marked?`, an --audit
+ re-restore) returns beneath its still-present marker, unstamped; any other marker above the row
+ marks that row's own ignore, so an unmarked whole-line site moves above it with its own stamp.
+ A row's inline restores share one marker, directly above the code line, unless the row already
+ carries one, including a trailing marker on the row itself. `pending-sites` preserves ownership
+ of markers belonging to marked whole-line sites that may restore in a later round; an inline
+ restore at such a row gets a separate marker only when it does not retain its own trailing marker."
+ ([lines sites]
+ (site-restore-plan lines sites sites))
+ ([lines sites pending-sites]
+ (let [reserved-rows (into #{}
+ (comp (filter :was-marked?)
+ (filter #(get-in % [:original :whole-line?]))
+ (map :row))
+ pending-sites)]
+ (mapcat (fn [[row row-sites]]
+ (let [{wl true, inl false} (group-by (comp boolean :whole-line? :original) row-sites)
+ above-marker? (marker-on-line? (get lines (- row 2)))
+ on-row-marker? (marker-on-line? (get lines (dec row)))
+ reserved? (and above-marker? (contains? reserved-rows row))]
+ (concat (for [s wl]
+ (cond
+ (and above-marker? (:was-marked? s)) (assoc s :comment nil)
+ above-marker? (assoc s :row (dec row), :comment keep-comment)
+ :else (assoc s :comment keep-comment)))
+ (when (seq inl)
+ (if (or on-row-marker?
+ (and above-marker? (not reserved?)))
+ (map #(assoc % :comment nil) inl)
+ (cons (assoc (first inl) :comment keep-comment)
+ (map #(assoc % :comment nil) (rest inl))))))))
+ (group-by :row sites)))))
+
+(defn- strip-orphan-keep-comments
+ "`text` minus [[keep-marker]] markers no longer attached to an ignore form -- what an `--audit`
+ removal that stuck leaves behind. A stamped whole-line marker comment is deleted; a hand-written
+ comment that merely carries the token keeps its prose and loses only the token. Attachment looks
+ past further comment lines, and only needs the ignore's first line (the linter vector may wrap).
+ Trailing markers on code lines are left alone. `pending-sites` identifies markers reserved for
+ marked whole-line sites that never restored; those are removed by ownership rather than adjacency,
+ since another restored ignore may now sit below them."
+ ([text]
+ (strip-orphan-keep-comments text nil))
+ ([text pending-sites]
+ (let [lines (vec (str/split-lines text))
+ ending (if (str/ends-with? text "\n") "\n" "")
+ ignored? (fn [line] (str/includes? (str line) ":clj-kondo/ignore"))
+ stamped? #{keep-comment}
+ owned-rows (into #{}
+ (comp (filter :was-marked?)
+ (filter #(get-in % [:original :whole-line?]))
+ (map (comp dec :row)))
+ pending-sites)
+ orphan? (fn [i line]
+ (and (marker-on-line? line)
+ (re-matches #"\s*;.*" line)
+ (let [below (drop-while #(re-matches #"\s*;.*" %) (subvec lines (inc i)))]
+ (not (ignored? (first below))))))
+ strip? (fn [i line]
+ (and (marker-on-line? line)
+ (re-matches #"\s*;.*" line)
+ (or (contains? owned-rows (inc i))
+ (orphan? i line))))]
+ (str (str/join "\n"
+ (keep-indexed (fn [i line]
+ (cond
+ (not (strip? i line)) line
+ (stamped? (str/trim line)) nil
+ :else (-> line
+ (str/replace (str " " keep-marker) "")
+ (str/replace keep-marker ""))))
+ lines))
+ ending))))
+
;;;; ---------------------------------------------------------------------------
;;;; kondo-redundant-ignores
;;;; ---------------------------------------------------------------------------
(defn- ignored-linters-at
- "Linter keywords named by the ignore form at `row` of `file`; reads a couple of extra lines since the
- vector may wrap."
- [file row]
- (let [lines (vec (str/split-lines (slurp file)))]
- (kondo-ratchet/line-linters
- (str/join "\n" (subvec lines (dec row) (min (count lines) (+ row 2)))))))
+ "Linter keywords named by the ignore form at `row` of `lines`; reads a couple of extra lines since
+ the vector may wrap."
+ [lines row]
+ (kondo-ratchet/line-linters
+ (str/join "\n" (subvec lines (dec row) (min (count lines) (+ row 2))))))
(defn- lsp-only?
"Does the ignore form suppress only linters kondo doesn't run, so a re-lint could never restore it?"
@@ -68,10 +246,11 @@
Forms that name any clojure-lsp/* linter survive ([[names-lsp?]]): the verify pass could never restore
that half of the suppression. Forms whose matched span has unbalanced braces (nested maps the regex
can't span) are skipped and reported under `:skipped` rather than corrupted.
- A line left whitespace-only by a removal is deleted; an inline removal also swallows one space.
- Returns `{:text _, :sites [{:row _, :linters _} ...], :skipped [rows...]}` — `:sites` carries the
- post-removal row of the form each ignore covered and the linters it named, so a verifying re-lint can
- tell exposed findings apart from unrelated pre-existing ones."
+ A line left whitespace-only by a removal is deleted; an inline removal also swallows the spaces
+ separating it from the following form when the preceding text already ends in a space.
+ Returns `{:text _, :sites [{:row _, :linters _, :original _} ...], :skipped [rows...]}`.
+ `:sites` carries the post-removal row of the form each ignore covered, the linters it named, and
+ `:original` -- the removed form's exact text and placement, so a restore can put it back verbatim."
[text rows]
(let [rowset (set rows)
masked (kondo-ratchet/mask-strings-and-comments text)
@@ -87,9 +266,10 @@
result (reduce (fn [{:keys [text] :as acc} {:keys [start end line linters]}]
(let [before (subs text 0 start)
after (subs text end)
- after (if (and (str/ends-with? before " ") (str/starts-with? after " "))
- (str/replace-first after #" +" "")
- after)
+ separator (if (str/ends-with? before " ")
+ (or (re-find #"^ +" after) "")
+ "")
+ after (subs after (count separator))
line-start (inc (or (str/last-index-of before "\n") -1))
line-end (or (str/index-of after "\n") (count after))
remnant (str (subs before line-start) (subs after 0 line-end))
@@ -99,77 +279,175 @@
(str (subs before 0 line-start)
(subs after (min (count after) (inc line-end))))
(str before after)))
- (update :deletions conj [line
- (if blank?
- (inc (count (filter #(= % \newline) (subs text start end))))
- 0)
- linters]))))
+ ;; an inline removal still deletes the newlines inside a wrapped span;
+ ;; a blank-line removal deletes the remaining physical line on top
+ (update :deletions conj
+ {:line line
+ :rows-deleted (cond-> (count (filter #(= % \newline) (subs text start end)))
+ blank? inc)
+ :linters linters
+ ;; enough to put the removal back exactly as it was
+ :original (if blank?
+ {:whole-line? true
+ :text (subs text line-start (+ end line-end))}
+ {:whole-line? false
+ :col (inc (- start line-start))
+ :text (subs text start end)
+ :separator separator})}))))
{:text text, :deletions []}
;; bottom-up so earlier offsets stay valid
(sort-by :start > removable))
+ deletions (:deletions result)
post-removal-row (fn [line]
- (- line (transduce (keep (fn [[l k]] (when (< l line) k))) + (:deletions result))))]
+ (- line (transduce (keep (fn [{l :line, k :rows-deleted}] (when (< l line) k)))
+ + deletions)))]
{:text (:text result)
- :sites (for [[line _ linters] (:deletions result)]
- {:row (post-removal-row line)
- :linters linters})
+ :sites (for [{:keys [line linters original]} deletions]
+ {:row (post-removal-row line)
+ :removed-line line
+ :linters linters
+ :original original})
;; adjusted like :sites, so warnings point at the rewritten file
:skipped (map (comp post-removal-row :line) unbalanced)}))
(defn redundant-ignores
"Report inline ignores kondo flags as redundant, dropping its two known false-positive classes:
findings with no location, and ignores that only name linters kondo doesn't run (clojure-lsp/*).
- With `--fix`, remove the candidates from source."
+ Sites whose comment (directly above, or trailing on the ignore's line) carries [[keep-marker]] are
+ proven false positives and are skipped too, unless `--audit` rechecks them.
+ With `--fix`, remove the candidates and re-lint the touched files: every finding was exposed by a
+ removal, whose ignore is put back exactly as it was -- a coarse form-level ignore returns as the
+ same single form-level ignore -- with the marker stamped above it. That inference requires a clean
+ pre-removal baseline, so files with pre-existing findings are excluded from the sweep and reported.
+ An `--audit` removal that sticks takes its stale marker comment with it."
[parsed]
(println "Running kondo with :redundant-ignore enabled (full lint, takes a minute or two)...")
- (let [findings (kondo-findings! :redundant-ignore lint-roots)
+ (let [audit? (get-in parsed [:options :audit])
+ findings (kondo-findings! :redundant-ignore lint-roots)
{located true, homeless false} (group-by #(some? (:row %)) findings)
- {lsp-only true, candidates false}
+ file-lines (memoize (fn [file] (vec (str/split-lines (slurp file)))))
+ {lsp-only true, verifiable false}
+ (group-by (fn [{:keys [filename row]}]
+ (lsp-only? (ignored-linters-at (file-lines filename) row)))
+ located)
+ {marked true, candidates false}
(group-by (fn [{:keys [filename row]}]
- (lsp-only? (ignored-linters-at filename row)))
- located)]
+ (marked-row? (file-lines filename) row))
+ verifiable)
+ candidates (if audit? (concat candidates marked) candidates)]
(doseq [{:keys [filename row]} (sort-by (juxt :filename :row) candidates)]
- (println (format "%s:%d %s" filename row (str/join " " (ignored-linters-at filename row)))))
+ (println (format "%s:%d %s" filename row (str/join " " (ignored-linters-at (file-lines filename) row)))))
(println)
(println (format "%d candidate redundant ignores (dropped as false positives: %d location-less, %d lsp-only)"
(count candidates) (count homeless) (count lsp-only)))
+ (when (seq marked)
+ (println (if audit?
+ (format "Including %d %s sites in the audit." (count marked) keep-marker)
+ (format "Skipped %d sites marked %s; recheck them with --audit." (count marked) keep-marker))))
(when (and (get-in parsed [:options :fix]) (seq candidates))
- (let [files (vec (sort (distinct (map :filename candidates))))
- sites (into {}
- (for [[file file-candidates] (group-by :filename candidates)]
- (let [{:keys [text sites skipped]} (remove-ignores-at (slurp file)
- (map :row file-candidates))]
- (spit file text)
- (doseq [row skipped]
- (println (format "WARNING: %s:%d skipped -- the ignore form's braces don't balance within the match; remove it by hand"
- file row)))
- [file sites])))
- near-sites (fn [{:keys [filename row]}]
- (filter #(<= (abs (- row (:row %))) 5) (sites filename)))
- ;; a finding near a removed site, of a type the removed ignore named, was exposed by the
- ;; removal; anything further away is a pre-existing finding in a file the usual
- ;; `mage kondo` roots don't cover
- exposed? (fn [{:keys [type] :as finding}]
- (boolean (some #(some #{:all type} (:linters %)) (near-sites finding))))]
- (println (format "Removed them across %d files; re-linting those files to verify..." (count files)))
- ;; redundant-ignore can't see findings from hook-based linters, so some ignores it called
- ;; redundant were still doing work; restore those.
- (let [{regressions true, others false} (group-by exposed? (filter :row (kondo-findings! nil files)))
- mismatched (filter (comp seq near-sites) others)]
- (doseq [[file file-regressions] (sort-by key (group-by :filename regressions))]
- (spit file (insert-ignore-lines (slurp file)
- (-> (group-by :row file-regressions)
- (update-vals #(map :type %))))))
- (doseq [{:keys [filename row type]} (sort-by (juxt :filename :row) mismatched)]
- (println (format "WARNING: %s:%d has a new %s finding near a removed ignore that named other linters -- fix or re-ignore by hand"
- filename row type)))
- (if (empty? regressions)
- (println "Verified: the removals exposed no findings.")
- (println (format "Restored ignores at %d sites where a finding reappeared (%s)."
- (count (distinct (map (juxt :filename :row) regressions)))
- (str/join ", " (sort (distinct (map :type regressions))))))))
- (println "Now run `./bin/mage fix-kondo-ratchets` to update the budgets, and `./bin/mage kondo`
-for the final word (a finding deep inside a large ignored form can escape the nearby-site check).")))))
+ ;; Precondition: swept files must baseline-lint clean, so that afterwards EVERY finding the
+ ;; verify lint reports was exposed by our removal. Files with pre-existing findings are excluded
+ ;; -- there is no way to tell their old warnings from newly exposed ones.
+ (let [all-files (vec (sort (distinct (map :filename candidates))))
+ _ (println (format "Baseline-linting %d files before removal..." (count all-files)))
+ dirty (into #{} (map :filename) (filter :row (kondo-findings! nil all-files)))
+ candidates (remove (comp dirty :filename) candidates)
+ files (vec (sort (distinct (map :filename candidates))))]
+ (doseq [file (sort dirty)]
+ (println (format "WARNING: %s has pre-existing findings; its candidates are excluded this run -- clean it up or mark them by hand"
+ file)))
+ (when (seq candidates)
+ (let [marked-rows (into {}
+ (map (fn [[file ms]] [file (into #{} (map :row) ms)]))
+ (group-by :filename marked))
+ removals (into {}
+ (for [[file file-candidates] (group-by :filename candidates)]
+ (let [{:keys [text sites skipped]}
+ (remove-ignores-at (slurp file) (map :row file-candidates))]
+ (spit file text)
+ (doseq [row skipped]
+ (println (format "WARNING: %s:%d skipped -- the ignore form's braces don't balance within the match; remove it by hand"
+ file row)))
+ ;; whether the removed site carried a marker decides where its marker
+ ;; goes on restore ([[site-restore-plan]]) -- record it, don't infer it
+ [file (mapv #(assoc % :was-marked?
+ (contains? (get marked-rows file #{}) (:removed-line %)))
+ sites)])))
+ named (fn [file] (into #{} (mapcat :linters) (removals file)))
+ restore-sites! (fn [file->sites pending]
+ ;; puts each removed ignore back exactly as it was; returns
+ ;; {file [inserted-anchor-rows...]} for shifting row bookkeeping
+ (into {}
+ (for [[file sites] (sort-by key file->sites)]
+ (let [text (slurp file)
+ lines (vec (str/split-lines text))
+ {:keys [text inserted-rows]}
+ (reinsert-ignores text (site-restore-plan lines sites (get pending file)))]
+ (spit file text)
+ [file inserted-rows]))))
+ finish! (fn [exposed mismatched restored covered rounds-run pending]
+ (doseq [{:keys [filename row type]} (sort-by (juxt :filename :row) exposed)]
+ (println (format "WARNING: %s:%d still exposes %s after %d restore rounds -- re-ignore by hand"
+ filename row type rounds-run)))
+ (doseq [{:keys [filename row type]} (sort-by (juxt :filename :row) mismatched)]
+ (println (format "WARNING: %s:%d has a new %s finding no removed ignore in the file named -- fix or re-ignore by hand"
+ filename row type)))
+ (when audit?
+ (doseq [file files]
+ (spit file (strip-orphan-keep-comments (slurp file) (get pending file)))))
+ (if (empty? restored)
+ (println "Verified: the removals exposed no findings.")
+ (println (format "Restored %d removed ignores covering %d findings (%s), stamped %s."
+ (count restored)
+ (count covered)
+ (str/join ", " (sort (distinct (map :type covered))))
+ keep-marker)))
+ (println "Now run `./bin/mage fix-kondo-ratchets` to update the budgets, and `./bin/mage kondo` for the final word.")
+ (when (or (seq exposed) (seq mismatched))
+ (throw (ex-info "the removals left warnings in the tree; fix or re-ignore them by hand and re-run"
+ {:exit-code 1}))))
+ _ (println (format "Removed them across %d files; re-linting to verify..." (count files)))]
+ ;; The baseline was clean, so every finding here was exposed by a removal. Attribute it to
+ ;; the nearest preceding removed site naming its type and put that ignore back verbatim --
+ ;; a coarse ignore returns as the same coarse ignore, never as several narrow ones. Hook
+ ;; linters can report only the first occurrence per form, so a round may surface findings
+ ;; a restored form already covers; iterate until the lint comes back clean.
+ (loop [round 1
+ pending removals
+ restored []
+ covered []]
+ (let [{exposed true, mismatched false}
+ (group-by (fn [{:keys [filename type]}]
+ (boolean (some #{:all type} (named filename))))
+ (filter :row (kondo-findings! nil files)))
+ ;; nearest preceding pending site naming the finding's type; else nearest overall
+ pick (fn [{:keys [filename row type]}]
+ (let [match? (fn [s] (boolean (some #{:all type} (:linters s))))
+ sites (filter match? (get pending filename))]
+ (or (last (sort-by :row (filter #(<= (:row %) row) sites)))
+ (first (sort-by #(abs (- (:row %) row)) sites)))))
+ picks (map (juxt identity pick) exposed)
+ attributable (filter second picks)]
+ (if (and (seq attributable) (< round 6))
+ (let [file->sites (into {}
+ (for [[file fps] (group-by (comp :filename first) attributable)]
+ [file (vec (distinct (map second fps)))]))
+ inserted (restore-sites! file->sites pending)
+ shift-site (fn [file s] (shift-site-past-inserts s (get inserted file [])))]
+ (println (format "Round %d: put back %d removed ignores covering %d findings; re-linting..."
+ round
+ (reduce + (map count (vals file->sites)))
+ (count attributable)))
+ (recur (inc round)
+ (into {}
+ (for [[file sites] pending
+ :let [gone (set (get file->sites file))]]
+ [file (vec (for [s sites :when (not (gone s))]
+ (shift-site file s)))]))
+ (into restored (for [[file sites] file->sites, s sites]
+ {:file file, :row (:row s)}))
+ (into covered (map first attributable))))
+ (finish! exposed mismatched restored covered (dec round) pending))))))))))
;;;; ---------------------------------------------------------------------------
;;;; kondo-insert-ignores
diff --git a/mage/src/mage/readability_check.clj b/mage/src/mage/readability_check.clj
index 69248e85a0f..4fc844b3279 100644
--- a/mage/src/mage/readability_check.clj
+++ b/mage/src/mage/readability_check.clj
@@ -70,10 +70,10 @@
])
%))
[1 3 4 5])
-;; => [[1 {:start 1, :end 2}]
-;; [3 {:start 2, :end 4}]
-;; [4 {:start 4, :end 7}]
-;; [5 {:start 4, :end 7}]]
+ ;; => [[1 {:start 1, :end 2}]
+ ;; [3 {:start 2, :end 4}]
+ ;; [4 {:start 4, :end 7}]
+ ;; [5 {:start 4, :end 7}]]
)
(defn- read-check-problem [reason]
@@ -124,7 +124,6 @@
corpus)))
:starting-at (nth lines (dec start))
:ending-at (nth lines (dec (dec end))))]
- #_:clj-kondo/ignore
(pprint/pprint result)
result))
(catch Exception e
diff --git a/mage/test/mage/kondo_ratchet_test.clj b/mage/test/mage/kondo_ratchet_test.clj
index f3a563d0897..4fe291dfa9d 100644
--- a/mage/test/mage/kondo_ratchet_test.clj
+++ b/mage/test/mage/kondo_ratchet_test.clj
@@ -1,5 +1,6 @@
(ns mage.kondo-ratchet-test
(:require
+ [clojure.string :as str]
[clojure.test :refer [deftest is testing]]
[mage.kondo-ratchet :as kondo-ratchet]))
@@ -20,46 +21,335 @@
(is (= "#_{:clj-kondo/ignore [:x]}\n(a)"
(#'kondo-ratchet/insert-ignore-lines "(a)" {1 [:x]})))))
+(deftest reinsert-ignores-test
+ (testing "a whole-line removal returns as its original line(s), comment above at its indentation"
+ (is (= {:text "(defn f [x]\n ;; why\n #_{:clj-kondo/ignore [:equals-true]}\n (= true x))\n"
+ :inserted-rows [2 2]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(defn f [x]\n (= true x))\n"
+ [{:row 2, :comment ";; why"
+ :original {:whole-line? true, :text " #_{:clj-kondo/ignore [:equals-true]}"}}]))))
+ (testing "a multi-line whole-line removal returns verbatim, one coarse form -- never several narrow ones"
+ (is (= {:text ";; why\n#_{:clj-kondo/ignore [:x\n :y]}\n(a)\n"
+ :inserted-rows [1 1 1]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(a)\n"
+ [{:row 1, :comment ";; why"
+ :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x\n :y]}"}}]))))
+ (testing "an inline removal splices back at its original column"
+ (is (= {:text "(do #_{:clj-kondo/ignore [:x]} (foo))\n"
+ :inserted-rows []}
+ (#'kondo-ratchet/reinsert-ignores
+ "(do (foo))\n"
+ [{:row 1, :comment nil
+ :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:x]}", :separator " "}}]))))
+ (testing "an inline restore's comment sits above at the target line's indentation"
+ (is (= {:text "(f\n ;; why\n #_{:clj-kondo/ignore [:x]} :mysql)\n"
+ :inserted-rows [2]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(f\n :mysql)\n"
+ [{:row 2, :comment ";; why"
+ :original {:whole-line? false, :col 3, :text "#_{:clj-kondo/ignore [:x]}", :separator " "}}]))))
+ (testing "two inline removals on one row restore right-to-left, so the left splice can't shift the right column"
+ (is (= {:text "(do #_{:clj-kondo/ignore [:x]} (f) #_{:clj-kondo/ignore [:y]} (g))\n"
+ :inserted-rows []}
+ (#'kondo-ratchet/reinsert-ignores
+ "(do (f) (g))\n"
+ [{:row 1, :comment nil, :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:x]}", :separator " "}}
+ {:row 1, :comment nil, :original {:whole-line? false, :col 9, :text "#_{:clj-kondo/ignore [:y]}", :separator " "}}]))))
+ (testing "a same-row restore with a comment splices first, so the comment can't displace the splice target"
+ (is (= {:text ";; why\n(do #_{:clj-kondo/ignore [:x]} (f) #_{:clj-kondo/ignore [:y]} (g))\n"
+ :inserted-rows [1]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(do (f) (g))\n"
+ [{:row 1, :comment ";; why", :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:x]}", :separator " "}}
+ {:row 1, :comment nil, :original {:whole-line? false, :col 9, :text "#_{:clj-kondo/ignore [:y]}", :separator " "}}]))))
+ (testing "a whole-line and an inline restore sharing a row each keep their marker adjacent"
+ (is (= {:text (str ";; kept A\n"
+ "#_{:clj-kondo/ignore [:x]}\n"
+ ";; kept B\n"
+ "(do #_{:clj-kondo/ignore [:y]} (f))\n")
+ :inserted-rows [1 1 1]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(do (f))\n"
+ [{:row 1, :comment ";; kept A"
+ :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}}
+ {:row 1, :comment ";; kept B"
+ :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:y]}", :separator " "}}]))))
+ (testing "consecutive whole-line restores on one row each keep their own marker adjacent"
+ (is (= {:text (str ";; kept B\n"
+ "#_{:clj-kondo/ignore [:y]}\n"
+ ";; kept A\n"
+ "#_{:clj-kondo/ignore [:x]}\n"
+ "(f)\n")
+ :inserted-rows [1 1 1 1]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(f)\n"
+ [{:row 1, :comment ";; kept A"
+ :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}}
+ {:row 1, :comment ";; kept B"
+ :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:y]}"}}]))))
+ (testing "multiple sites in one file restore bottom-up"
+ (is (= {:text "#_{:clj-kondo/ignore [:x]}\n(a)\n#_{:clj-kondo/ignore [:y]}\n(b)\n"
+ :inserted-rows [2 1]}
+ (#'kondo-ratchet/reinsert-ignores
+ "(a)\n(b)\n"
+ [{:row 1, :comment nil, :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}}
+ {:row 2, :comment nil, :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:y]}"}}])))))
+
+(deftest site-restore-plan-test
+ (let [stamp @#'kondo-ratchet/keep-comment
+ wl (fn [row] {:row row, :linters [:x], :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}})
+ inl (fn [row] {:row row, :linters [:y], :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:y]}", :separator " "}})
+ plan (fn [text sites] (#'kondo-ratchet/site-restore-plan (vec (str/split-lines text)) sites))]
+ (testing "a whole-line restore onto an unmarked row gets its own marker"
+ (is (= [[1 stamp]]
+ (map (juxt :row :comment) (plan "(f)\n" [(wl 1)])))))
+ (testing "a marker above a still-ignored code line belongs to that line; the block moves above it"
+ (is (= [[1 stamp]]
+ (map (juxt :row :comment)
+ (plan (str stamp "\n(do #_{:clj-kondo/ignore [:y]} (f))\n") [(wl 2)])))))
+ (testing "a site that was itself marked before removal re-restores under its marker, no new marker"
+ (is (= [[2 nil]]
+ (map (juxt :row :comment)
+ (plan (str stamp "\n(f)\n") [(assoc (wl 2) :was-marked? true)])))))
+ (testing "a marked whole-line site over an unrelated inline ignore doesn't donate its marker to it"
+ (is (= [[2 nil]]
+ (map (juxt :row :comment)
+ (plan (str stamp "\n(do #_{:clj-kondo/ignore [:y]} (f))\n")
+ [(assoc (wl 2) :was-marked? true)])))))
+ (testing "same-round marked whole-line and inline restores each get their own marker"
+ (let [sites [(assoc (wl 2) :was-marked? true) (inl 2)]
+ text (str stamp "\n(do (f))\n")]
+ (is (= {:text (str stamp "\n"
+ "#_{:clj-kondo/ignore [:x]}\n"
+ stamp "\n"
+ "(do #_{:clj-kondo/ignore [:y]} (f))\n")
+ :inserted-rows [2 2]}
+ (#'kondo-ratchet/reinsert-ignores text (plan text sites))))))
+ (testing "an inline restore preserves a pending whole-line site's marker for the next round"
+ (let [owner (assoc (wl 2) :was-marked? true)
+ inline (inl 2)
+ pending [owner inline]
+ text (str stamp "\n(do (f))\n")
+ round1 (#'kondo-ratchet/reinsert-ignores
+ text
+ (#'kondo-ratchet/site-restore-plan
+ (vec (str/split-lines text)) [inline] pending))
+ owner' (#'kondo-ratchet/shift-site-past-inserts owner (:inserted-rows round1))
+ round2 (#'kondo-ratchet/reinsert-ignores
+ (:text round1)
+ (#'kondo-ratchet/site-restore-plan
+ (vec (str/split-lines (:text round1))) [owner'] [owner']))]
+ (is (= 2 (:row owner')))
+ (is (= (str stamp "\n"
+ "#_{:clj-kondo/ignore [:x]}\n"
+ stamp "\n"
+ "(do #_{:clj-kondo/ignore [:y]} (f))\n")
+ (:text round2)))))
+ (testing "cross-round end to end: the round-two whole-line block lands above the round-one marker"
+ (let [round1 (str stamp "\n(do #_{:clj-kondo/ignore [:y]} (f))\n")]
+ (is (= {:text (str stamp "\n#_{:clj-kondo/ignore [:x]}\n" round1)
+ :inserted-rows [1 1]}
+ (#'kondo-ratchet/reinsert-ignores round1 (plan round1 [(wl 2)]))))))))
+
+(deftest marker-lifecycle-edge-test
+ (let [stamp @#'kondo-ratchet/keep-comment
+ plan (fn [text sites] (#'kondo-ratchet/site-restore-plan (vec (str/split-lines text)) sites))]
+ (testing "a reserved marker is removed when only the inline site restores"
+ (let [inl {:row 2, :linters [:y], :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:y]}", :separator " "}}
+ wl {:row 2, :was-marked? true, :linters [:x], :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}}
+ text (str stamp "\n(do (f))\n")
+ {restored :text, inserted :inserted-rows}
+ (#'kondo-ratchet/reinsert-ignores
+ text
+ (#'kondo-ratchet/site-restore-plan
+ (vec (str/split-lines text)) [inl] [wl inl]))
+ pending [(#'kondo-ratchet/shift-site-past-inserts wl inserted)]]
+ (is (= (str stamp "\n" stamp "\n(do #_{:clj-kondo/ignore [:y]} (f))\n") restored))
+ (is (= (str stamp "\n(do #_{:clj-kondo/ignore [:y]} (f))\n")
+ (#'kondo-ratchet/strip-orphan-keep-comments restored pending)))))
+ (testing "a restored inline site's trailing marker is not duplicated beside a pending reserved marker"
+ (let [inl {:row 2, :was-marked? true, :linters [:y],
+ :original {:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:y]}", :separator " "}}
+ wl {:row 2, :was-marked? true, :linters [:x],
+ :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}}
+ text (str stamp "\n(do (f)) ;; " kondo-ratchet/keep-marker " inline\n")
+ result (#'kondo-ratchet/reinsert-ignores
+ text
+ (#'kondo-ratchet/site-restore-plan
+ (vec (str/split-lines text)) [inl] [wl inl]))
+ pending [(#'kondo-ratchet/shift-site-past-inserts wl (:inserted-rows result))]]
+ (is (= (str stamp "\n(do #_{:clj-kondo/ignore [:y]} (f)) ;; "
+ kondo-ratchet/keep-marker " inline\n")
+ (:text result)))
+ (is (= (str "(do #_{:clj-kondo/ignore [:y]} (f)) ;; "
+ kondo-ratchet/keep-marker " inline\n")
+ (#'kondo-ratchet/strip-orphan-keep-comments (:text result) pending)))))
+ (testing "a whole-line ignore with a trailing marker removes and restores through the inline path, marker never leaving"
+ (let [text (str "#_{:clj-kondo/ignore [:x]} ;; " kondo-ratchet/keep-marker " why\n(f)\n")
+ {:keys [text sites]} (#'kondo-ratchet/remove-ignores-at text [1])]
+ (is (= (str " ;; " kondo-ratchet/keep-marker " why\n(f)\n") text))
+ (is (= [{:whole-line? false, :col 1, :text "#_{:clj-kondo/ignore [:x]}", :separator ""}]
+ (map :original sites)))
+ (let [planned (plan text (map #(assoc % :was-marked? true) sites))]
+ (is (= [nil] (map :comment planned)))
+ (is (= (str "#_{:clj-kondo/ignore [:x]} ;; " kondo-ratchet/keep-marker " why\n(f)\n")
+ (:text (#'kondo-ratchet/reinsert-ignores text planned)))))))
+ (testing "an unmarked whole-line block climbs above a marker owned by the row's inline ignore"
+ (let [text (str stamp "\n(do #_{:clj-kondo/ignore [:y]} (f))\n")
+ wl {:row 2, :linters [:x], :original {:whole-line? true, :text "#_{:clj-kondo/ignore [:x]}"}}]
+ (is (= (str stamp "\n#_{:clj-kondo/ignore [:x]}\n" text)
+ (:text (#'kondo-ratchet/reinsert-ignores text (plan text [wl])))))))))
+
+(deftest strip-orphan-keep-comments-test
+ (let [stamp-line @#'kondo-ratchet/keep-comment
+ hand-line (str ";; real explanation. " kondo-ratchet/keep-marker)]
+ (testing "a stamped whole-line marker comment with no ignore below it is dropped"
+ (is (= "(a)\n(b)\n"
+ (#'kondo-ratchet/strip-orphan-keep-comments (str "(a)\n" stamp-line "\n(b)\n")))))
+ (testing "an orphaned hand-written comment keeps its prose and loses only the token"
+ (is (= "(a)\n;; real explanation.\n(b)\n"
+ (#'kondo-ratchet/strip-orphan-keep-comments (str "(a)\n" hand-line "\n(b)\n")))))
+ (testing "a marker comment still above an ignore survives"
+ (let [text (str stamp-line "\n#_{:clj-kondo/ignore [:x]}\n(a)\n")]
+ (is (= text (#'kondo-ratchet/strip-orphan-keep-comments text)))))
+ (testing "comments without the marker survive, orphaned or not"
+ (let [text ";; plain comment\n(a)\n"]
+ (is (= text (#'kondo-ratchet/strip-orphan-keep-comments text)))))
+ (testing "a trailing marker on a code line is left for a hand fix"
+ (let [text (str "(foo) " stamp-line "\n")]
+ (is (= text (#'kondo-ratchet/strip-orphan-keep-comments text)))))
+ (testing "a stamped marker orphaned at the last line of the file is dropped"
+ (is (= "(a)\n"
+ (#'kondo-ratchet/strip-orphan-keep-comments (str "(a)\n" stamp-line "\n")))))
+ (testing "a marker above an ignore whose linter vector wraps to the next line survives"
+ (let [text (str stamp-line "\n#_{:clj-kondo/ignore [:x\n :y]}\n(a)\n")]
+ (is (= text (#'kondo-ratchet/strip-orphan-keep-comments text)))))
+ (testing "a marker separated from its ignore by another comment line survives"
+ (let [text (str stamp-line "\n;; more context\n#_{:clj-kondo/ignore [:x]}\n(a)\n")]
+ (is (= text (#'kondo-ratchet/strip-orphan-keep-comments text)))))))
+
+(deftest shift-past-inserts-test
+ (testing "each insertion at or above the row pushes it down one, measured against the original row"
+ (is (= 5 (#'kondo-ratchet/shift-past-inserts 5 [])))
+ (is (= 6 (#'kondo-ratchet/shift-past-inserts 5 [5 6])))
+ (is (= 9 (#'kondo-ratchet/shift-past-inserts 7 [5 6])))
+ (is (= 5 (#'kondo-ratchet/shift-past-inserts 5 [6 7])))))
+
+(deftest shift-site-past-inserts-test
+ (testing "a marked whole-line owner stays beneath its marker when a same-row stamp is inserted"
+ (let [site {:row 5, :was-marked? true, :original {:whole-line? true}}]
+ (is (= 6 (:row (#'kondo-ratchet/shift-site-past-inserts site [4 5]))))))
+ (testing "ordinary pending sites shift past same-row inserts"
+ (let [site {:row 5, :original {:whole-line? false}}]
+ (is (= 7 (:row (#'kondo-ratchet/shift-site-past-inserts site [4 5])))))))
+
+(deftest marker-on-line-test
+ (testing "the marker counts only inside the line's comment, not in string literals"
+ (is (true? (#'kondo-ratchet/marker-on-line? (str ";; " kondo-ratchet/keep-marker " because"))))
+ (is (true? (#'kondo-ratchet/marker-on-line? (str "(foo) ;; " kondo-ratchet/keep-marker))))
+ (is (false? (#'kondo-ratchet/marker-on-line? (str "(def marker \"" kondo-ratchet/keep-marker "\")"))))
+ (is (false? (#'kondo-ratchet/marker-on-line? nil))))
+ (testing "a semicolon inside a string doesn't open a comment"
+ (is (false? (#'kondo-ratchet/marker-on-line? (str "(def s \"a;b " kondo-ratchet/keep-marker "\")"))))
+ (is (true? (#'kondo-ratchet/marker-on-line? (str "(def s \"a;b\") ;; " kondo-ratchet/keep-marker)))))
+ (testing "char-literal semicolons and string escapes don't open or close early"
+ (is (false? (#'kondo-ratchet/marker-on-line? (str "(= c \\;) (def s \"" kondo-ratchet/keep-marker "\")"))))
+ (is (false? (#'kondo-ratchet/marker-on-line? (str "(def s \"a\\\";b " kondo-ratchet/keep-marker "\")"))))))
+
+(defn- remove-ignores-at'
+ "[[remove-ignores-at]] with `:original` stripped from `:sites`; [[remove-ignores-at-originals-test]]
+ covers the originals."
+ [text rows]
+ (update (#'kondo-ratchet/remove-ignores-at text rows)
+ :sites (partial mapv #(dissoc % :original :removed-line))))
+
+(deftest remove-ignores-at-originals-test
+ (testing "each site captures its removed form verbatim, so a restore puts back exactly what was cut"
+ (is (= [{:whole-line? true, :text " #_{:clj-kondo/ignore [:equals-true]}"}]
+ (map :original
+ (:sites (#'kondo-ratchet/remove-ignores-at
+ "(defn f [x]\n #_{:clj-kondo/ignore [:equals-true]}\n (= true x))\n"
+ [2])))))
+ (is (= [{:whole-line? false, :col 5, :text "#_{:clj-kondo/ignore [:x]}", :separator " "}]
+ (map :original
+ (:sites (#'kondo-ratchet/remove-ignores-at "(do #_{:clj-kondo/ignore [:x]} (foo))\n" [1])))))
+ (is (= [{:whole-line? true, :text "#_{:clj-kondo/ignore [:x\n :y]}"}]
+ (map :original
+ (:sites (#'kondo-ratchet/remove-ignores-at
+ "(a)\n#_{:clj-kondo/ignore [:x\n :y]}\n(b)\n"
+ [2])))))))
+
+(deftest inline-ignore-separator-round-trip-test
+ (doseq [[description separator text]
+ [["no space after the ignore" ""
+ "(do #_{:clj-kondo/ignore [:x]}(foo))\n"]
+ ["multiple spaces after the ignore" " "
+ "(do #_{:clj-kondo/ignore [:x]} (foo))\n"]
+ ["an ignore ending a line" ""
+ "(do (foo) #_{:clj-kondo/ignore [:x]}\n(bar))\n"]]]
+ (testing description
+ (let [{removed :text, :keys [sites]} (#'kondo-ratchet/remove-ignores-at text [1])]
+ (is (= [separator] (map (comp :separator :original) sites)))
+ (is (= text
+ (:text (#'kondo-ratchet/reinsert-ignores
+ removed
+ (map #(assoc % :comment nil) sites)))))))))
+
(deftest remove-ignores-at-test
(testing "a standalone ignore line disappears entirely; :sites points at the uncovered form"
- (is (= {:text "(defn f [x]\n (= true x))\n", :sites [{:row 2, :linters [:equals-true]}], :skipped []}
- (#'kondo-ratchet/remove-ignores-at
+ (is (= {:text "(defn f [x]\n (= true x))\n"
+ :sites [{:row 2, :linters [:equals-true]}]
+ :skipped []}
+ (remove-ignores-at'
"(defn f [x]\n #_{:clj-kondo/ignore [:equals-true]}\n (= true x))\n"
[2]))))
(testing "an inline ignore is cut out of its line, swallowing a doubled space"
(is (= {:text "(do (foo))\n", :sites [{:row 1, :linters [:x]}], :skipped []}
- (#'kondo-ratchet/remove-ignores-at "(do #_{:clj-kondo/ignore [:x]} (foo))\n" [1]))))
+ (remove-ignores-at' "(do #_{:clj-kondo/ignore [:x]} (foo))\n" [1]))))
(testing "a multi-line ignore vector goes too"
(is (= {:text "(a)\n(b)\n", :sites [{:row 2, :linters [:x :y]}], :skipped []}
- (#'kondo-ratchet/remove-ignores-at "(a)\n#_{:clj-kondo/ignore [:x\n :y]}\n(b)\n" [2]))))
+ (remove-ignores-at' "(a)\n#_{:clj-kondo/ignore [:x\n :y]}\n(b)\n" [2]))))
(testing "an ignore map with extra keys is removed whole, not truncated at the vector"
(is (= {:text "(a)\n", :sites [{:row 1, :linters [:x]}], :skipped []}
- (#'kondo-ratchet/remove-ignores-at "#_{:clj-kondo/ignore [:x] :reason \"legacy\"}\n(a)\n" [1]))))
+ (remove-ignores-at' "#_{:clj-kondo/ignore [:x] :reason \"legacy\"}\n(a)\n" [1]))))
(testing "an extra-key map with NESTED braces would be truncated by the regex, so it is skipped whole"
- (is (= {:text "#_{:clj-kondo/ignore [:x] :reason {:ticket \"ABC-1\"}}\n(a)\n", :sites [], :skipped [1]}
- (#'kondo-ratchet/remove-ignores-at
+ (is (= {:text "#_{:clj-kondo/ignore [:x] :reason {:ticket \"ABC-1\"}}\n(a)\n"
+ :sites []
+ :skipped [1]}
+ (remove-ignores-at'
"#_{:clj-kondo/ignore [:x] :reason {:ticket \"ABC-1\"}}\n(a)\n"
[1]))))
(testing "a skipped row is reported in post-removal coordinates when removals above it delete lines"
- (is (= {:text "(a)\n#_{:clj-kondo/ignore [:y] :reason {:nested 1}}\n(b)\n"
- :sites [{:row 1, :linters [:x]}]
- :skipped [2]}
- (#'kondo-ratchet/remove-ignores-at
+ (is (= {:text "(a)\n#_{:clj-kondo/ignore [:y] :reason {:nested 1}}\n(b)\n"
+ :sites [{:row 1, :linters [:x]}]
+ :skipped [2]}
+ (remove-ignores-at'
"#_{:clj-kondo/ignore [:x]}\n(a)\n#_{:clj-kondo/ignore [:y] :reason {:nested 1}}\n(b)\n"
[1 3]))))
(testing "any form naming a clojure-lsp/* linter survives — a re-lint could never restore that half"
- (is (= {:text (str "(do #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (foo))\n"
- "#_{:clj-kondo/ignore [:x :clojure-lsp/unused-public-var]}\n"
- "(bar)\n")
- :sites [{:row 1, :linters [:x]}]
- :skipped []}
- (#'kondo-ratchet/remove-ignores-at
+ (is (= {:text (str "(do #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (foo))\n"
+ "#_{:clj-kondo/ignore [:x :clojure-lsp/unused-public-var]}\n"
+ "(bar)\n")
+ :sites [{:row 1, :linters [:x]}]
+ :skipped []}
+ (remove-ignores-at'
(str "(do #_{:clj-kondo/ignore [:x]} #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (foo))\n"
"#_{:clj-kondo/ignore [:x :clojure-lsp/unused-public-var]}\n"
"(bar)\n")
[1 2]))))
+ (testing "an inline removal of a wrapped ignore still counts its deleted newlines, shifting later rows"
+ (is (= {:text "(do (foo))\n(a)\n(b)\n"
+ :sites [{:row 3, :linters [:z]} {:row 1, :linters [:x :y]}]
+ :skipped []}
+ (remove-ignores-at'
+ "(do #_{:clj-kondo/ignore [:x\n :y]} (foo))\n(a)\n#_{:clj-kondo/ignore [:z]}\n(b)\n"
+ [1 4]))))
(testing "rows without an ignore are left alone; multiple removals shift later :sites rows up"
- (is (= {:text "(a)\n(b)\n", :sites [{:row 2, :linters [:y]} {:row 1, :linters [:x]}], :skipped []}
- (#'kondo-ratchet/remove-ignores-at
+ (is (= {:text "(a)\n(b)\n"
+ :sites [{:row 2, :linters [:y]} {:row 1, :linters [:x]}]
+ :skipped []}
+ (remove-ignores-at'
"#_{:clj-kondo/ignore [:x]}\n(a)\n#_{:clj-kondo/ignore [:y]}\n(b)\n"
[1 2 3])))))
diff --git a/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj b/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj
index d38a29c0c7a..650377d2d3f 100644
--- a/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj
+++ b/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj
@@ -227,7 +227,6 @@
"raw values being used to calculate the formulas below, so we can tell at a glance if they're right "
"without referring to the EDN def)")
(is (= [[nil] [0.0] [0.0] [10.0] [8.0] [5.0] [5.0] [nil] [0.0] [0.0]]
- #_:clj-kondo/ignore
(calculate-bird-scarcity $count))))))
(deftest ^:parallel nulls-and-zeroes-test-2
diff --git a/modules/drivers/starburst/src/metabase/driver/starburst.clj b/modules/drivers/starburst/src/metabase/driver/starburst.clj
index 2b4a31f1bbb..f3635dff98c 100644
--- a/modules/drivers/starburst/src/metabase/driver/starburst.clj
+++ b/modules/drivers/starburst/src/metabase/driver/starburst.clj
@@ -109,7 +109,6 @@
;;; The Starburst JDBC driver DOES NOT support the `.getImportedKeys` method so just return `nil` here so the
;;; implementation doesn't try to use it.
-#_{:clj-kondo/ignore [:deprecated-var]}
(defmethod driver/describe-fks :starburst
[_driver _database & {:as _options}]
;; starburst does not support finding foreign key metadata tables, but some connectors support foreign keys.
diff --git a/src/metabase/analytics/stats.clj b/src/metabase/analytics/stats.clj
index 10267adf6aa..c5b0d64ae30 100644
--- a/src/metabase/analytics/stats.clj
+++ b/src/metabase/analytics/stats.clj
@@ -133,13 +133,12 @@
:sso_configured (setting/get :google-auth-enabled)
:instance_started (analytics.settings/instance-creation)
:has_sample_data (t2/exists? :model/Database, :is_sample true)
- :enable_embedding #_{:clj-kondo/ignore [:deprecated-var]} (setting/get :enable-embedding)
+ :enable_embedding (setting/get :enable-embedding)
:enable_embedding_sdk (setting/get :enable-embedding-sdk)
:enable_embedding_simple (setting/get :enable-embedding-simple)
:enable_embedding_interactive (setting/get :enable-embedding-interactive)
:enable_embedding_static (setting/get :enable-embedding-static)
:embedding_app_origin_set (boolean
- #_{:clj-kondo/ignore [:deprecated-var]}
(setting/get :embedding-app-origin))
;; We no longer add "localhost:*" as a default origin as of Metabase 56, as it is always allowed,
;; but we still filter it out in stats for compatibility with migrated instances.
diff --git a/src/metabase/api/common/internal.clj b/src/metabase/api/common/internal.clj
index a86606ca545..057468d0bad 100644
--- a/src/metabase/api/common/internal.clj
+++ b/src/metabase/api/common/internal.clj
@@ -36,8 +36,8 @@
[schema]
(let [schema (try #_:clj-kondo/ignore
(eval schema)
- (catch Exception _ #_:clj-kondo/ignore
- (requiring-resolve-form schema)))
+ (catch Exception _
+ (requiring-resolve-form schema)))
schema-type (mc/type schema)
{regex :api/regex} (mc/properties schema)]
[schema-type
diff --git a/src/metabase/cmd/copy.clj b/src/metabase/cmd/copy.clj
index f2aeb780e76..a09eaadf5c5 100644
--- a/src/metabase/cmd/copy.clj
+++ b/src/metabase/cmd/copy.clj
@@ -411,7 +411,6 @@
;; Update the sequence nextvals.
(defmethod update-sequence-values! :postgres
[_db-type data-source]
- #_{:clj-kondo/ignore [:discouraged-var]}
(jdbc/with-db-transaction [target-db-conn {:datasource data-source}]
(step (trs "Setting Postgres sequence ids to proper values...")
(doseq [model entities
@@ -429,7 +428,6 @@
(defmethod update-sequence-values! :h2
[_db-type data-source]
- #_{:clj-kondo/ignore [:discouraged-var]}
(jdbc/with-db-transaction [target-db-conn {:datasource data-source}]
(step (trs "Setting H2 sequence ids to proper values...")
(doseq [e entities
@@ -465,7 +463,6 @@
(step (trs "Clearing default entries created by Liquibase migrations...")
(clear-existing-rows! target-db-type target-data-source))
;; create a transaction and load the data.
- #_{:clj-kondo/ignore [:discouraged-var]}
(jdbc/with-db-transaction [target-conn-spec {:datasource target-data-source}]
;; transaction should be set as rollback-only until it completes. Only then should we disable rollback-only so the
;; transaction will commit (i.e., only commit if the whole thing succeeds)
diff --git a/src/metabase/config/core.clj b/src/metabase/config/core.clj
index e77f11a331f..606f9b375ce 100644
--- a/src/metabase/config/core.clj
+++ b/src/metabase/config/core.clj
@@ -21,7 +21,6 @@
(def ^{:doc "Indicates whether Dev extensions are available" :added "0.56.0"} dev-available?
(try
- #_{:clj-kondo/ignore [:metabase/modules]}
(require 'dev.dummy-namespace)
true
(catch Throwable _
diff --git a/src/metabase/core/init.clj b/src/metabase/core/init.clj
index 92504518c8e..70c85f88d79 100644
--- a/src/metabase/core/init.clj
+++ b/src/metabase/core/init.clj
@@ -90,5 +90,4 @@
;; load EE init code on system launch if it exists.
(when (and (not *compile-files*)
config/ee-available?)
- #_{:clj-kondo/ignore [:discouraged-var]}
(require 'metabase-enterprise.core.init))
diff --git a/src/metabase/dashboards_rest/api.clj b/src/metabase/dashboards_rest/api.clj
index 74fdd1f3e2a..a928bbac260 100644
--- a/src/metabase/dashboards_rest/api.clj
+++ b/src/metabase/dashboards_rest/api.clj
@@ -645,7 +645,6 @@
(u/prog1 (first (revisions/with-last-edit-info [dashboard] :dashboard))
(events/publish-event! :event/dashboard-read {:object-id (:id dashboard) :user-id api/*current-user-id*})))))
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/:id/pdf" :- :any
"Render Dashboard with ID to a PDF (server-side, the same way dashboard subscriptions render charts) and stream it
back as a file download.
diff --git a/src/metabase/driver/common.clj b/src/metabase/driver/common.clj
index 0c7263f497c..78c227d5766 100644
--- a/src/metabase/driver/common.clj
+++ b/src/metabase/driver/common.clj
@@ -1,6 +1,5 @@
(ns metabase.driver.common
"Shared definitions and helper functions for use across different drivers."
- #_{:clj-kondo/ignore [:metabase/modules]}
(:require
[clojure.string :as str]
[metabase.driver :as driver]
diff --git a/src/metabase/driver/ddl/interface.clj b/src/metabase/driver/ddl/interface.clj
index 788b54bc145..db5aec3f305 100644
--- a/src/metabase/driver/ddl/interface.clj
+++ b/src/metabase/driver/ddl/interface.clj
@@ -1,5 +1,4 @@
(ns metabase.driver.ddl.interface
- #_{:clj-kondo/ignore [:metabase/modules]}
(:require
[clojure.string :as str]
[metabase.appearance.core :as appearance]
diff --git a/src/metabase/driver/postgres/ddl.clj b/src/metabase/driver/postgres/ddl.clj
index 0e973ba5366..f9b21ad15cc 100644
--- a/src/metabase/driver/postgres/ddl.clj
+++ b/src/metabase/driver/postgres/ddl.clj
@@ -19,11 +19,10 @@
This helps to address unexpectedly large/long running queries."
[tx]
- (let [existing-timeout (->> #_{:clj-kondo/ignore [:discouraged-var]}
- (sql/format {:select [:setting]
- :from [:pg_settings]
- :where [:= :name "statement_timeout"]}
- {:quoted false})
+ (let [existing-timeout (->> (sql/format {:select [:setting]
+ :from [:pg_settings]
+ :where [:= :name "statement_timeout"]}
+ {:quoted false})
(sql.ddl/jdbc-query tx)
first
:setting
diff --git a/src/metabase/driver/settings.clj b/src/metabase/driver/settings.clj
index b27bfddcc38..1981eae9619 100644
--- a/src/metabase/driver/settings.clj
+++ b/src/metabase/driver/settings.clj
@@ -1,5 +1,4 @@
(ns metabase.driver.settings
- #_{:clj-kondo/ignore [:metabase/modules]}
(:require
[java-time.api :as t]
[metabase.config.core :as config]
diff --git a/src/metabase/driver/sql/parameters/substitution.clj b/src/metabase/driver/sql/parameters/substitution.clj
index b658730573e..f684f1f5854 100644
--- a/src/metabase/driver/sql/parameters/substitution.clj
+++ b/src/metabase/driver/sql/parameters/substitution.clj
@@ -310,7 +310,6 @@
(->honeysql driver form))]
(cond
(params.ops/operator? param-type)
- #_{:clj-kondo/ignore [:deprecated-var]}
(->> (assoc params :target [:dimension (field->field-ref driver field param-type value)])
params.ops/to-clause
lib/desugar-filter-clause
@@ -320,7 +319,6 @@
(params.dates/exclusion-date-type param-type value)
(let [field-ref (field->field-ref driver field param-type value)]
- #_{:clj-kondo/ignore [:deprecated-var]}
(->> (params.dates/date-string->filter value field-ref)
lib/desugar-filter-clause
driver-api/wrap-value-literals-in-mbql5
diff --git a/src/metabase/driver/sql/query_processor.clj b/src/metabase/driver/sql/query_processor.clj
index 7e61f40736c..8811e73c281 100644
--- a/src/metabase/driver/sql/query_processor.clj
+++ b/src/metabase/driver/sql/query_processor.clj
@@ -2043,7 +2043,6 @@
(defmethod apply-top-level-clause [:sql :joins]
[driver _ honeysql-form {:keys [joins]}]
- #_{:clj-kondo/ignore [:deprecated-var]}
(let [f apply-joins-honey-sql-2]
(f driver honeysql-form joins)))
diff --git a/src/metabase/driver/sql_jdbc/execute.clj b/src/metabase/driver/sql_jdbc/execute.clj
index 5837915d16e..2b1df9e7af9 100644
--- a/src/metabase/driver/sql_jdbc/execute.clj
+++ b/src/metabase/driver/sql_jdbc/execute.clj
@@ -290,7 +290,6 @@
;; use the deprecated impl for `connection-with-timezone` if one exists.
(do
(log/warnf "%s is deprecated in Metabase 0.47.0. Implement %s instead."
- #_{:clj-kondo/ignore [:deprecated-var]}
'connection-with-timezone
'do-with-connection-with-options)
;; for compatibility, make sure we pass it an actual Database instance.
diff --git a/src/metabase/events/schema.clj b/src/metabase/events/schema.clj
index b7c3f65210b..7d61a920ca3 100644
--- a/src/metabase/events/schema.clj
+++ b/src/metabase/events/schema.clj
@@ -15,7 +15,6 @@
(or (mr/registered-schema topic)
:map))
-#_{:clj-kondo/ignore [:unused-private-var]}
(defn- with-hydrate
"Given a malli entry schema of a map, return a new entry schema with an additional option
to hydrate information when sending system event notifications.
diff --git a/src/metabase/search/appdb/index.clj b/src/metabase/search/appdb/index.clj
index 7bca2ae7499..53287f3ab37 100644
--- a/src/metabase/search/appdb/index.clj
+++ b/src/metabase/search/appdb/index.clj
@@ -475,7 +475,6 @@
(when (or force-reset? (not (exists? (active-table))))
(reset-index!))))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-temp-index-table
"Create a temporary index table for the duration of the body. Uses the existing index if we're already mocking."
[& body]
diff --git a/src/metabase/testing_api/api.clj b/src/metabase/testing_api/api.clj
index 96fc4c76183..dbcc3bbbbaa 100644
--- a/src/metabase/testing_api/api.clj
+++ b/src/metabase/testing_api/api.clj
@@ -59,7 +59,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/snapshot/:name"
"Snapshot the database for testing purposes."
[{snapshot-name :name} :- [:map
@@ -135,7 +134,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/restore/:name"
"Restore a database snapshot for testing purposes."
[{snapshot-name :name} :- [:map
@@ -150,7 +148,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/echo"
"Simple echo handler. Fails when you POST with `?fail=true`."
[_route-params
@@ -166,7 +163,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/set-time"
"Make java-time see world at exact time."
[_route-params
@@ -187,7 +183,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/echo"
"Simple echo handler. Fails when you GET with `?fail=true`."
[_route-params
@@ -203,7 +198,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/mark-stale"
"Mark the card or dashboard as stale"
[_route-params
@@ -227,7 +221,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/stats"
"Triggers a send of instance usage stats"
[]
@@ -264,7 +257,6 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/refresh-caches"
"Manually triggers the cache refresh task, if Enterprise code is available."
[]
@@ -297,7 +289,6 @@
[:published_at :any]
[:updated_at :any]])
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/security-advisories"
"Nuke all existing security advisories and insert the provided ones."
[_route-params
diff --git a/src/metabase/timeline/api/timeline.clj b/src/metabase/timeline/api/timeline.clj
index efd25f3170e..ec5bce845ef 100644
--- a/src/metabase/timeline/api/timeline.clj
+++ b/src/metabase/timeline/api/timeline.clj
@@ -23,10 +23,6 @@
[:map
[:id pos-int?]])
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :post "/" :- ::Timeline
"Create a new [[Timeline]]."
[_route-params
@@ -47,10 +43,6 @@
(u/prog1 (first (t2/insert-returning-instances! :model/Timeline tl))
(events/publish-event! :event/timeline-create {:object <> :user-id api/*current-user-id*}))))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/" :- [:sequential ::Timeline]
"Fetch a list of `Timeline`s. Can include `archived=true` to return archived timelines."
[_route-params
@@ -67,10 +59,6 @@
(= include :events)
(map #(timeline-event/include-events-singular % {:events/all? archived?})))))
-;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
-;; use our API + we will need it when we make auto-TypeScript-signature generation happen
-;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/:id" :- ::Timeline
"Fetch the `Timeline` with `id`. Include `include=events` to unarchived events included on the timeline. Add
`archived=true` to return all events on the timeline, both archived and unarchived."
diff --git a/src/metabase/transforms/execute.clj b/src/metabase/transforms/execute.clj
index 6cb54633d6e..6830d6cc8a6 100644
--- a/src/metabase/transforms/execute.clj
+++ b/src/metabase/transforms/execute.clj
@@ -53,7 +53,6 @@
(when on-start
(on-start run-id)))})]
(try
- #_{:clj-kondo/ignore [:discouraged-var]}
(transforms.i/execute! (resolve-target transform) opts)
(catch Throwable t
;; so a caller awaiting the start isn't left hanging on a pre-start failure;
diff --git a/src/metabase/transforms/query_impl.clj b/src/metabase/transforms/query_impl.clj
index 69749c90078..65fde1978a7 100644
--- a/src/metabase/transforms/query_impl.clj
+++ b/src/metabase/transforms/query_impl.clj
@@ -82,6 +82,5 @@
(log/error t "Error executing transform"))
(throw t)))))
-#_{:clj-kondo/ignore [:discouraged-var]}
(defmethod transforms.i/execute! :query [transform opts]
(run-mbql-transform! transform opts))
diff --git a/src/metabase/util/log/capture.cljc b/src/metabase/util/log/capture.cljc
index fa48a5c3147..982a7306a5a 100644
--- a/src/metabase/util/log/capture.cljc
+++ b/src/metabase/util/log/capture.cljc
@@ -187,7 +187,6 @@
"Impl for log message capturing for [[metabase.util.log/logf]]."
[f & args]
(let [{e :e, [format-string & args] :args} (parse-args args)]
- #_{:clj-kondo/ignore [:unresolved-namespace]}
(f e (apply #?(:clj format
:cljs gstring/format)
format-string args))))
diff --git a/src/metabase/util/performance.cljc b/src/metabase/util/performance.cljc
index b67bf5d06f1..87378c45746 100644
--- a/src/metabase/util/performance.cljc
+++ b/src/metabase/util/performance.cljc
@@ -367,7 +367,6 @@
(cond (nil? m) {}
;; Fallback for non-editable collections where transients aren't supported.
(not (editable? m))
- #_{:clj-kondo/ignore [:discouraged-var]}
(clojure.core/update-keys m f)
:else (-> (reduce-kv (fn [acc k v]
(let [k' (f k)]
@@ -388,7 +387,6 @@
(cond (nil? coll) {}
;; Fallback for non-editable collections where transients aren't supported.
(not (editable? coll))
- #_{:clj-kondo/ignore [:discouraged-var]}
(clojure.core/update-vals coll f)
:else (-> (reduce-kv (fn [acc k v]
(let [v' (f v)]
diff --git a/test/metabase/actions/test_util.clj b/test/metabase/actions/test_util.clj
index 5ca7c7bc6b1..e62cc0e4403 100644
--- a/test/metabase/actions/test_util.clj
+++ b/test/metabase/actions/test_util.clj
@@ -264,8 +264,7 @@
(tu/with-model-cleanup [:model/Action]
(f model))))
-;;; TODO FIXME -- rename this to [[with-actions!]] and then remove the Kondo ignore comment below
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
+;;; TODO FIXME -- rename this to [[with-actions!]]
(defmacro with-actions
"Execute `body` with newly created Actions.
`binding-forms-and-options-maps` is a vector of even number of elements, binding and options-map,
@@ -326,24 +325,21 @@
(tu/with-temp-vals-in-db :model/Database db-id {:settings {:database-enable-actions enable?}}
(thunk)))
-;;; TODO -- FIXME, rename this to `with-actions-enabled!` and remove the `:clj-kondo/ignore`
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
+;;; TODO -- FIXME, rename this to `with-actions-enabled!`
(defmacro with-actions-enabled
"Execute `body` with Actions enabled for the current test Database."
{:style/indent 0}
[& body]
`(do-with-actions-set! (data/id) true (fn [] ~@body)))
-;;; TODO -- FIXME, rename this to `with-actions-disabled!` and remove the `:clj-kondo/ignore`
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
+;;; TODO -- FIXME, rename this to `with-actions-disabled!`
(defmacro with-actions-disabled
"Execute `body` with Actions disabled for the current test Database."
{:style/indent 0}
[& body]
`(do-with-actions-set! (data/id) false (fn [] ~@body)))
-;;; TODO FIXME -- rename this to [[with-actions!]] and then remove the Kondo ignore comment below
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
+;;; TODO FIXME -- rename this to [[with-actions-test-data-and-actions-enabled!]]
(defmacro with-actions-test-data-and-actions-enabled
"Combines [[with-actions-test-data]] and [[with-actions-enabled]]."
{:style/indent 0}
diff --git a/test/metabase/ai_tracing/log_test.clj b/test/metabase/ai_tracing/log_test.clj
index 1dc25c4a96b..7cb63e7bed8 100644
--- a/test/metabase/ai_tracing/log_test.clj
+++ b/test/metabase/ai_tracing/log_test.clj
@@ -133,7 +133,6 @@
(is (= :ok (ait/with-eval-session nil (ait/with-llm-call {} :ok))))
(is (= [] (entries messages)))))))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defn- recording-logger-factory
"A tools.logging factory that records the Log4j2 ThreadContext present at each write."
[sink]
diff --git a/test/metabase/analytics/snowplow_test.clj b/test/metabase/analytics/snowplow_test.clj
index e6ea47cdb36..4737576c362 100644
--- a/test/metabase/analytics/snowplow_test.clj
+++ b/test/metabase/analytics/snowplow_test.clj
@@ -56,8 +56,7 @@
(mt/with-dynamic-fn-redefs [snowplow/track-event-impl! (partial fake-track-event-impl! collector)]
(f))))))
-;;; TODO -- rename to `with-fake-snowplow-collector!` because this is not thread-safe and remove the Kondo ignore rule below
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
+;;; TODO -- rename to `with-fake-snowplow-collector!` because this is not thread-safe
(defmacro with-fake-snowplow-collector
"Creates a new fake snowplow collector in a dynamic scope, and redefines the track-event! function so that analytics
events are parsed and added to the fake collector.
diff --git a/test/metabase/app_db/schema_migrations_test.clj b/test/metabase/app_db/schema_migrations_test.clj
index 1dae814dd77..55db856ad20 100644
--- a/test/metabase/app_db/schema_migrations_test.clj
+++ b/test/metabase/app_db/schema_migrations_test.clj
@@ -1631,7 +1631,6 @@
(migrate!)
(is (= users-before (get-users)))))))
-#_{:clj-kondo/ignore [:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]}
(deftest ^:mb/old-migrations-test data-permissions-migration-rollback-test
(testing "Data permissions are correctly rolled back from `data_permissions` to `permissions`"
(impl/test-migrations ["v50.2024-01-04T13:52:51" "v50.2024-02-19T21:32:04"] [migrate!]
diff --git a/test/metabase/app_db/schema_migrations_test/impl.clj b/test/metabase/app_db/schema_migrations_test/impl.clj
index 72156c2afda..7eea04abd15 100644
--- a/test/metabase/app_db/schema_migrations_test/impl.clj
+++ b/test/metabase/app_db/schema_migrations_test/impl.clj
@@ -198,7 +198,6 @@
(datasets/test-drivers #{:h2 :mysql :postgres}
(test-migrations-for-driver! driver/*driver* [start-id end-id] f)))))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro test-migrations
"Util macro for running tests for a set of Liquibase schema migration(s).
diff --git a/test/metabase/app_db/setup_test.clj b/test/metabase/app_db/setup_test.clj
index 45f98335817..ef6a748f8b3 100644
--- a/test/metabase/app_db/setup_test.clj
+++ b/test/metabase/app_db/setup_test.clj
@@ -199,7 +199,6 @@
:where [:= :table.db_id [:inline 0]]}))))))
;; `delete!` below is ok in a parallel test since it's not actually executing anything
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(deftest ^:parallel build-before-delete-query-test
(testing "before-delete's select query should remove `:delete`/`:delete-from` (workaround for https://github.com/camsaul/toucan2/issues/203)"
(is (= {:select [:*], :from [[:metabase_field :field]], :where [:= :field.id 0]}
diff --git a/test/metabase/channel/email_test.clj b/test/metabase/channel/email_test.clj
index f6241435204..e84a3bf3c69 100644
--- a/test/metabase/channel/email_test.clj
+++ b/test/metabase/channel/email_test.clj
@@ -80,8 +80,7 @@
:notification/sync? true)]
(f)))))
-;;; TODO -- rename to `with-fake-inbox!` since it's not thread-safe and remove the Kondo ignore below.
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
+;;; TODO -- rename to `with-fake-inbox!` since it's not thread-safe.
(defmacro with-fake-inbox
"Clear `inbox`, bind `send-email!` to `fake-inbox-email-fn`, set temporary settings for `email-smtp-username` and
`email-smtp-password` (which will cause [[metabase.channel.settings/email-configured?]] to return `true`, and execute
@@ -96,7 +95,6 @@
{:style/indent 0}
`(do-with-fake-inbox! (fn [] ~@body)))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-expected-messages
"Invokes `body`, waiting until `n` messages are found in the inbox before returning. This is useful if the code you
are testing sends emails via a future or background thread. Using this will block the test, waiting for the messages
diff --git a/test/metabase/channel/slack_test.clj b/test/metabase/channel/slack_test.clj
index 968af62f29e..16306335706 100644
--- a/test/metabase/channel/slack_test.clj
+++ b/test/metabase/channel/slack_test.clj
@@ -322,8 +322,8 @@
(deftest slack-token-error-test
(notification.tu/with-send-notification-sync
(mt/with-temporary-setting-values [slack-app-token "test-token"
- admin-email nil
- #_:clj-kondo/ignore slack-token-valid? true]
+ admin-email nil
+ slack-token-valid? true]
(mt/with-fake-inbox
(http-fake/with-fake-routes {#"^https://slack.com/api/chat\.postMessage.*"
(fn [_] (mock-200-response {:ok false, :error "account_inactive"}))}
diff --git a/test/metabase/collections/models/collection_test.clj b/test/metabase/collections/models/collection_test.clj
index 3a2cafdd1c9..2cc05e4ccb5 100644
--- a/test/metabase/collections/models/collection_test.clj
+++ b/test/metabase/collections/models/collection_test.clj
@@ -1441,7 +1441,6 @@
(group->perms [a b c] group))))))
(deftest ^:parallel valid-location-path?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [path expected] (= expected
(#'collection/valid-location-path? path))
nil false
diff --git a/test/metabase/driver/common_test.clj b/test/metabase/driver/common_test.clj
index 276011eb5a6..ec2726c3738 100644
--- a/test/metabase/driver/common_test.clj
+++ b/test/metabase/driver/common_test.clj
@@ -73,7 +73,6 @@
(deftest ^:parallel json-unfolding-default-test
(testing "JSON Unfolding database support details behave as they're supposed to"
- #_{:clj-kondo/ignore [:equals-true]}
(are [details expected] (= expected
(driver.common/json-unfolding-default
{:lib/type :metadata/database
diff --git a/test/metabase/driver/h2_test.clj b/test/metabase/driver/h2_test.clj
index 58ce1146d42..542591003fb 100644
--- a/test/metabase/driver/h2_test.clj
+++ b/test/metabase/driver/h2_test.clj
@@ -229,7 +229,6 @@
(deftest ^:parallel check-action-commands-test
(mt/test-driver :h2
- #_{:clj-kondo/ignore [:equals-true]}
(are [query] (= true (#'h2/every-command-allowed-for-actions? (#'h2/classify-query (mt/id) query)))
"select 1"
"update venues set name = 'bill'"
diff --git a/test/metabase/driver/sql/query_processor_test.clj b/test/metabase/driver/sql/query_processor_test.clj
index c4b8fbf38db..212b3b7ded5 100644
--- a/test/metabase/driver/sql/query_processor_test.clj
+++ b/test/metabase/driver/sql/query_processor_test.clj
@@ -275,7 +275,7 @@
(sql.qp/format-honeysql driver {:join join})))))
;;; Ok to hardcode driver names here because it's for general HoneySQL compilation behavior and not something that needs
-;;; to be run against all supported drivers
+;;; to be run against all supported drivers [kondo-keep]
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel compile-honeysql-test
(testing "make sure the generated HoneySQL will compile to the correct SQL"
diff --git a/test/metabase/driver/sql/transforms_test.clj b/test/metabase/driver/sql/transforms_test.clj
index da7c6107072..c91cf4e9f7d 100644
--- a/test/metabase/driver/sql/transforms_test.clj
+++ b/test/metabase/driver/sql/transforms_test.clj
@@ -228,7 +228,7 @@
;; Characterizes the CTAS row count per driver. BigQuery, Snowflake, and Redshift are excluded; they
;; declare `:transforms/accurate-rows-affected false`, so the transforms layer skips emitting
;; efficiency metrics for their full-rebuild runs rather than trust the bogus count. New failing
- ;; driver → add the feature override + add it to this exclusion.
+ ;; driver → add the feature override + add it to this exclusion. [kondo-keep]
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-drivers (disj (mt/normal-drivers-with-feature :transforms/table)
:bigquery-cloud-sdk :redshift :snowflake)
diff --git a/test/metabase/driver/sql/util_test.clj b/test/metabase/driver/sql/util_test.clj
index 273d77f8f34..fe3c66c734f 100644
--- a/test/metabase/driver/sql/util_test.clj
+++ b/test/metabase/driver/sql/util_test.clj
@@ -7,7 +7,7 @@
[metabase.util.honey-sql-2 :as h2x]))
;;; Ok to hardcode driver names here because it's for a general util function and not something that needs to be run
-;;; against all supported drivers
+;;; against all supported drivers [kondo-keep]
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel quote-name-test
(are [driver expected] (= expected
@@ -91,6 +91,7 @@
;;; Ok to hardcode driver names in the tests below because they're for general util functions and not something that
;;; needs to be run against all supported drivers
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel format-sql-with-params-test
(testing "Baseline: format-sql expands metabase params, which is not desired."
@@ -99,6 +100,7 @@
(is (= "SELECT\n *\nFROM\n { { #1234}}"
(sql.u/format-sql :mysql "SELECT * FROM {{#1234}}")))))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel format-sql-with-params-test-2
(testing "A compact representation should remain compact (and inner spaces removed, if any)."
@@ -107,6 +109,7 @@
(is (= "SELECT\n *\nFROM\n {{#1234}}"
(sql.u/format-sql-and-fix-params :postgres "SELECT * FROM {{#1234}}")))))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel format-sql-with-params-test-3
(testing "Symbolic params should also have spaces removed."
@@ -115,6 +118,7 @@
(is (= "SELECT\n *\nFROM\n {{FOO_BAR}}"
(sql.u/format-sql-and-fix-params :postgres "SELECT * FROM {{ FOO_BAR }}")))))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel format-sql-with-params-test-4
(testing "Dialect-specific versions should work"
diff --git a/test/metabase/driver/sql_jdbc/actions_test.clj b/test/metabase/driver/sql_jdbc/actions_test.clj
index 3422ac58ef6..ed4e3399cb3 100644
--- a/test/metabase/driver/sql_jdbc/actions_test.clj
+++ b/test/metabase/driver/sql_jdbc/actions_test.clj
@@ -378,7 +378,7 @@
(deftest create-all-nil-test
(testing "table.row/create with no optional fields provided"
;; This has been broken since Basic Actions were first built.
- ;; It was recently fixed for postgres, but we still need to fix the other drivers.
+ ;; It was recently fixed for postgres, but we still need to fix the other drivers. [kondo-keep]
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-drivers #{:postgres} #_(mt/normal-drivers-with-feature :actions)
(actions.tu/with-actions-temp-db action-nullable
diff --git a/test/metabase/driver/sql_jdbc/connection_test.clj b/test/metabase/driver/sql_jdbc/connection_test.clj
index e5710b4ec3f..68a8a6af665 100644
--- a/test/metabase/driver/sql_jdbc/connection_test.clj
+++ b/test/metabase/driver/sql_jdbc/connection_test.clj
@@ -46,7 +46,7 @@
(use-fixtures :once (fixtures/initialize :db))
(use-fixtures :once ssh-test/do-with-mock-servers)
-;;; this is mostly testing [[h2/*allow-testing-h2-connections*]] so it's ok to hardcode driver names below.
+;;; this is mostly testing [[h2/*allow-testing-h2-connections*]] so it's ok to hardcode driver names below. [kondo-keep]
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel can-connect-with-details?-test
(testing "Should not be able to connect without setting h2/*allow-testing-h2-connections*"
@@ -291,6 +291,7 @@
;; to [[driver.u/supports?]].
original-supports? driver.u/supports?
supports?-fn (fn [driver feature database]
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
(if (and #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(= driver :clickhouse)
(= feature :connection-impersonation))
@@ -339,6 +340,7 @@
(t2/update! :model/Database (mt/id) {:details (:details db)})))))))
;;; Postgres-specific, so ok to hardcode driver names below.
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest connection-pool-invalidated-on-details-change-postgres-secrets-are-stable-test
(testing "postgres secrets are stable (#23034)"
@@ -485,6 +487,7 @@
;;; TODO Not clear why we're only testing Postgres here, do we support Azure Managed Identity for any other app DB type?
;;; Needs a comment please.
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest test-auth-provider-connection
(mt/with-premium-features #{:database-auth-providers}
@@ -520,6 +523,7 @@
;; we must have created more than one connection
(is (> @connection-creations 1))))))))))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest test-aws-iam-auth-provider-connection
(mt/with-premium-features #{:database-auth-providers}
@@ -551,6 +555,7 @@
(is (= "iam" (:wrapperPlugins spec)))
(is (= "VERIFY_CA" (:sslMode spec))))))))))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel test-aws-iam-requires-ssl
(testing "AWS IAM authentication requires SSL to be enabled"
@@ -739,6 +744,7 @@
(check-data))))
(finally (.stop ^Server server))))))))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest postgres-aws-iam-can-connect
(if (config/config-bool :mb-postgres-aws-iam-test)
@@ -763,6 +769,7 @@
:ssl true})))))
(log/info "Skipping test: MB_POSTGRES_AWS_IAM_TEST not set")))
+;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest mysql-aws-iam-can-connect
(if (config/config-bool :mb-mysql-aws-iam-test)
diff --git a/test/metabase/driver/sql_jdbc/execute_test.clj b/test/metabase/driver/sql_jdbc/execute_test.clj
index b010a4b5810..21c452d84de 100644
--- a/test/metabase/driver/sql_jdbc/execute_test.clj
+++ b/test/metabase/driver/sql_jdbc/execute_test.clj
@@ -85,6 +85,7 @@
(deftest try-ensure-open-conn-sets-non-recursive-options-test
(testing "try-ensure-open-conn! sets connection options as non-recursive"
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-drivers (disj (descendants driver/hierarchy :sql-jdbc)
;; too tricky to stub the connection
diff --git a/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj b/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj
index 878b7d4f49f..d3a62cf9e2a 100644
--- a/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj
+++ b/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj
@@ -36,11 +36,12 @@
(deftest ^:parallel simple-select-probe-query-test-2
;; this is mostly a sanity check against some of our known drivers so ok to hardcode driver names.
- #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(testing "real drivers produce correct query"
(are [driver] (= ["SELECT TRUE AS \"_\" FROM \"schema\".\"wow\" WHERE 1 <> 1 LIMIT 0"]
(sql-jdbc.describe-database/simple-select-probe-query driver "schema" "wow"))
:h2
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
:postgres)))
(deftest ^:parallel simple-select-probe-query-test-3
@@ -262,8 +263,9 @@
driver/*driver* conn schema table-name))))))))))))))
;;; TODO: fix and change this to test on (mt/sql-jdbc-drivers)
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest sync-table-with-backslash-test
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-drivers #{:postgres}
(testing "table with backslash in name, PKs, FKS are correctly synced"
(mt/with-temp-test-data [["human\\race"
diff --git a/test/metabase/driver/sql_jdbc_test.clj b/test/metabase/driver/sql_jdbc_test.clj
index 908a716a537..705713f80d9 100644
--- a/test/metabase/driver/sql_jdbc_test.clj
+++ b/test/metabase/driver/sql_jdbc_test.clj
@@ -74,8 +74,9 @@
(update :category_id int)
(update :id int)))))))
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel invalid-ssh-credentials-test
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :postgres
(testing "Make sure invalid ssh credentials are detected if a direct connection is possible"
(is (thrown?
diff --git a/test/metabase/legacy_mbql/util_test.cljc b/test/metabase/legacy_mbql/util_test.cljc
index 869937c24aa..fbf109ee700 100644
--- a/test/metabase/legacy_mbql/util_test.cljc
+++ b/test/metabase/legacy_mbql/util_test.cljc
@@ -33,7 +33,6 @@
;;; --------------------------------------------- query->max-rows-limit ----------------------------------------------
-#_{:clj-kondo/ignore [:deprecated-var]}
(t/deftest ^:parallel query->max-rows-limit-test
(doseq [[group query->expected]
{"should return `:limit` if set"
diff --git a/test/metabase/lib/js_test.cljs b/test/metabase/lib/js_test.cljs
index 70e7d20141e..ac97cfd859e 100644
--- a/test/metabase/lib/js_test.cljs
+++ b/test/metabase/lib/js_test.cljs
@@ -415,7 +415,6 @@
(deftest ^:parallel js=-metatest
(testing "check js= works correctly (who tests the tests?)"
(testing "should be true"
- #_{:clj-kondo/ignore [:equals-true]}
(are [a b] (= true (js= a b))
7 7
0 0
diff --git a/test/metabase/lib/query/test_spec_test.cljc b/test/metabase/lib/query/test_spec_test.cljc
index a5efe2da68b..5086107865c 100644
--- a/test/metabase/lib/query/test_spec_test.cljc
+++ b/test/metabase/lib/query/test_spec_test.cljc
@@ -848,7 +848,6 @@
(is (empty? (lib/fields query 2)))
(is (= 25 (lib/current-limit query 2))))))
-#_{:clj-kondo/ignore [:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]}
(deftest ^:parallel test-query-comprehensive-all-features-test-with-fields
(testing "test-query exercises all functionality in a comprehensive multi-stage query, with fields clause"
(let [query (lib.query.test-spec/test-query
diff --git a/test/metabase/lib/query_test.cljc b/test/metabase/lib/query_test.cljc
index a5d519f0de5..59a9438e914 100644
--- a/test/metabase/lib/query_test.cljc
+++ b/test/metabase/lib/query_test.cljc
@@ -27,10 +27,7 @@
(deftest ^:parallel describe-query-test
(let [query (-> (lib.tu/venues-query)
(lib/aggregate (lib/sum (meta/field-metadata :venues :price))))
- ;; wrong arity: there's a bug in our Kondo config, see
- ;; https://metaboat.slack.com/archives/C04DN5VRQM6/p1679022185079739?thread_ts=1679022025.317059&cid=C04DN5VRQM6
- query (-> #_{:clj-kondo/ignore [:invalid-arity]}
- (lib/filter query (lib/= (meta/field-metadata :venues :name) "Toucannery"))
+ query (-> (lib/filter query (lib/= (meta/field-metadata :venues :name) "Toucannery"))
(lib/breakout (meta/field-metadata :venues :category-id))
(lib/order-by (meta/field-metadata :venues :id))
(lib/limit 100))]
@@ -195,7 +192,6 @@
(deftest ^:parallel can-run-test
(mu/disable-enforcement
- #_{:clj-kondo/ignore [:equals-true]}
(are [can-run? card-type query]
(if (= card-type :question)
(= can-run? (lib.query/can-run query card-type) (lib.query/can-preview query))
@@ -236,7 +232,6 @@
(deftest ^:parallel can-save?-test
(mu/disable-enforcement
- #_{:clj-kondo/ignore [:equals-true]}
(are [can-save? card-type query]
(= can-save? (lib.query/can-save? query card-type))
true :question (lib.tu/venues-query)
diff --git a/test/metabase/lib/table_test.cljc b/test/metabase/lib/table_test.cljc
index 058be9f2133..baafd1f7ecd 100644
--- a/test/metabase/lib/table_test.cljc
+++ b/test/metabase/lib/table_test.cljc
@@ -33,7 +33,6 @@
(deftest ^:parallel nil-column-test
(testing "Fields with missing names shouldn't blow up visible-columns"
(let [metadata-provider
- #_{:clj-kondo/ignore [:missing-protocol-method]}
(reify
metadata.protocols/MetadataProvider
(database [_this]
diff --git a/test/metabase/lib/types/isa_test.cljc b/test/metabase/lib/types/isa_test.cljc
index dcaa2c44c04..d658465ee63 100644
--- a/test/metabase/lib/types/isa_test.cljc
+++ b/test/metabase/lib/types/isa_test.cljc
@@ -147,7 +147,6 @@
(is (false? (lib.types.isa/numeric? {:effective-type :type/Text :semantic-type :type/Price}))))
(deftest ^:parallel compatible-type?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [exp base-lhs eff-lhs base-rhs eff-rhs] (= exp (lib.types.isa/compatible-type?
{:base-type base-lhs
:effective-type eff-lhs}
diff --git a/test/metabase/lib_be/metadata/jvm_test.clj b/test/metabase/lib_be/metadata/jvm_test.clj
index fc6b42deb4d..2d43c26311e 100644
--- a/test/metabase/lib_be/metadata/jvm_test.clj
+++ b/test/metabase/lib_be/metadata/jvm_test.clj
@@ -93,7 +93,6 @@
(lib.metadata.calculation/returned-columns mbql5-query))))))
(deftest ^:synchronized with-temp-source-question-metadata-test
- #_{:clj-kondo/ignore [:discouraged-var]}
(mt/with-temp [:model/Card card {:dataset_query
(mt/mbql-query venues
{:joins
@@ -184,7 +183,6 @@
(mt/id :venues :id))))))
(deftest ^:synchronized persisted-info-metadata-test
- #_{:clj-kondo/ignore [:discouraged-var]}
(mt/with-temp [:model/Card {card-id :id} {:dataset_query {:database (mt/id)
:type :query
:query {:source-table (mt/id :venues)}}}
diff --git a/test/metabase/lib_metric/metadata/jvm_test.clj b/test/metabase/lib_metric/metadata/jvm_test.clj
index e59ba10468a..604c09cf521 100644
--- a/test/metabase/lib_metric/metadata/jvm_test.clj
+++ b/test/metabase/lib_metric/metadata/jvm_test.clj
@@ -13,7 +13,6 @@
(deftest ^:synchronized metadatas-fetches-metrics-test
(testing "metadatas should fetch metrics from the database"
- #_{:clj-kondo/ignore [:discouraged-var]}
(mt/with-temp [:model/Card metric {:type :metric
:name "Test Metric"
:database_id (mt/id)
@@ -30,7 +29,6 @@
(deftest ^:synchronized metadatas-fetches-metrics-by-table-id-test
(testing "metadatas should fetch metrics by table-id"
- #_{:clj-kondo/ignore [:discouraged-var]}
(mt/with-temp [:model/Card metric {:type :metric
:name "Table Metric"
:database_id (mt/id)
@@ -46,7 +44,6 @@
(deftest ^:synchronized metadatas-excludes-archived-metrics-test
(testing "metadatas should exclude archived metrics when not filtering by ID"
- #_{:clj-kondo/ignore [:discouraged-var]}
(mt/with-temp [:model/Card active-metric {:type :metric
:name "Active Metric"
:archived false
@@ -72,7 +69,6 @@
(deftest ^:synchronized metadatas-includes-archived-when-filtering-by-id-test
(testing "metadatas should include archived metrics when filtering by ID"
- #_{:clj-kondo/ignore [:discouraged-var]}
(mt/with-temp [:model/Card archived-metric {:type :metric
:name "Archived Metric"
:archived true
diff --git a/test/metabase/logger/core_test.clj b/test/metabase/logger/core_test.clj
index 08b5243a087..8c0be8697d2 100644
--- a/test/metabase/logger/core_test.clj
+++ b/test/metabase/logger/core_test.clj
@@ -92,7 +92,6 @@
(line-seq (io/reader f))))))))
(deftest level-enabled?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [set-level check-level expected-value] (= expected-value
(mt/with-log-level [metabase.logger.core-test set-level]
(logger/level-enabled? 'metabase.logger.core-test check-level)))
diff --git a/test/metabase/metabot/tools/construct_representations_test.clj b/test/metabase/metabot/tools/construct_representations_test.clj
index 9c1f0c55a40..6a0e4cd6177 100644
--- a/test/metabase/metabot/tools/construct_representations_test.clj
+++ b/test/metabase/metabot/tools/construct_representations_test.clj
@@ -287,8 +287,7 @@
(when-not (instance? clojure.lang.ExceptionInfo result)
(let [q (get-in result [:structured-output :query])
;; Round-trip through legacy is the gate the production failure hit.
- legacy #_{:clj-kondo/ignore [:discouraged-var]}
- (lib/->legacy-MBQL q)
+ legacy (lib/->legacy-MBQL q)
rebuilt (try (lib/query mp legacy)
(catch clojure.lang.ExceptionInfo e e))]
(testing "order-by uses an aggregation reference, not an inline aggregation"
diff --git a/test/metabase/model_persistence/api_test.clj b/test/metabase/model_persistence/api_test.clj
index f571c9d0488..6fd44c122b4 100644
--- a/test/metabase/model_persistence/api_test.clj
+++ b/test/metabase/model_persistence/api_test.clj
@@ -103,6 +103,7 @@
(.setProperty "org.quartz.threadPool.threadCount" "6")
(.setProperty "org.quartz.threadPool.class" "org.quartz.simpl.SimpleThreadPool"))))]
;; a binding won't work since we need to cross thread boundaries
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [task/scheduler (constantly sched)]
(try
diff --git a/test/metabase/notification/condition_test.clj b/test/metabase/notification/condition_test.clj
index fe5067458cf..f5e5b284fee 100644
--- a/test/metabase/notification/condition_test.clj
+++ b/test/metabase/notification/condition_test.clj
@@ -8,7 +8,6 @@
[metabase.query-processor.test :as qp]
[metabase.test :as mt]))
-#_{:clj-kondo/ignore [:equals-true]}
(deftest evaluate-literal-values-test
(testing "literal values"
(are [expected expression context] (= expected (evaluate-expression expression context))
@@ -17,7 +16,6 @@
true true {}
false false {})))
-#_{:clj-kondo/ignore [:equals-true]}
(deftest evaluate-logical-operators-test
(testing "logical operators"
(are [expected expression context] (= expected (evaluate-expression expression context))
@@ -39,7 +37,6 @@
true ["not" false] {}
false ["not" ["not" false]] {})))
-#_{:clj-kondo/ignore [:equals-true]}
(deftest evaluate-comparison-operators-test
(testing "comparison operators"
(are [expected expression context] (= expected (evaluate-expression expression context))
@@ -87,7 +84,6 @@
true ["<=" 1 2 2] {}
false ["<=" 2 1 1] {})))
-#_{:clj-kondo/ignore [:equals-true]}
(deftest evaluate-context-access-test
(testing "context access"
(are [expected expression context] (= expected (evaluate-expression expression context))
@@ -116,7 +112,6 @@
3 ["max" 3 2 1] {}
6 ["max" ["context" "a"] ["context" "b"]] {:a 4, :b 6})))
-#_{:clj-kondo/ignore [:equals-true]}
(deftest evaluate-nested-expressions-test
(testing "nested expressions"
(are [expected expression context] (= expected (evaluate-expression expression context))
diff --git a/test/metabase/notification/send_test.clj b/test/metabase/notification/send_test.clj
index b75ecdbcfb2..e1c7e46cecc 100644
--- a/test/metabase/notification/send_test.clj
+++ b/test/metabase/notification/send_test.clj
@@ -492,6 +492,7 @@
:timeout-ms 1000})]
;; dispatcher spawns its own worker threads that don't inherit *local-redefs* —
;; use with-redefs to swap the root so worker threads see the replacement.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [notification.send/send-notification-sync! (fn [notification]
;; fake latency
@@ -529,7 +530,6 @@
(reset! sent-notifications [])
(let [error-thrown (atom false)]
;; dispatcher worker thread — see note above
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [notification.send/send-notification-sync!
(fn [notification]
(if (= "F" (:test-value notification))
@@ -683,6 +683,7 @@
queue-size (notification.settings/notification-thread-pool-size)]
;; notification thread pool workers don't inherit *local-redefs* — the root swap from
;; with-redefs is required so the patched fns are visible to the worker threads.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [notification.payload/notification-payload (fn [& _]
(assert false))
@@ -739,6 +740,7 @@
dispatch-fn (:dispatch-fn dispatcher)
shutdown-fn (:shutdown-fn dispatcher)]
;; dispatcher spawns worker threads without our dynamic binding
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [notification.send/send-notification-sync!
(fn [notification]
diff --git a/test/metabase/notification/test_util.clj b/test/metabase/notification/test_util.clj
index b83784119a2..36db095f245 100644
--- a/test/metabase/notification/test_util.clj
+++ b/test/metabase/notification/test_util.clj
@@ -62,7 +62,6 @@
:content "<svg width=\"300\" height=\"130\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"100\" x=\"10\" y=\"10\" rx=\"20\" ry=\"20\" fill=\"blue\" />\n</svg>"})]
~@body))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defn do-with-captured-channel-send!
[thunk]
(with-javascript-visualization-stub
diff --git a/test/metabase/oauth_server/api_test.clj b/test/metabase/oauth_server/api_test.clj
index f9ff7ba4111..2efef55f795 100644
--- a/test/metabase/oauth_server/api_test.clj
+++ b/test/metabase/oauth_server/api_test.clj
@@ -14,8 +14,6 @@
(java.util Base64)))
;; reset-provider! is safe here — it resets a local atom, no global side effects.
-;; kondo flags it because of the `!` suffix in a fixture.
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [thunk]
(oauth-server/reset-provider!)
(binding [client/*url-prefix* ""]
diff --git a/test/metabase/oauth_server/core_test.clj b/test/metabase/oauth_server/core_test.clj
index 0125d7a03c4..6262d5bf129 100644
--- a/test/metabase/oauth_server/core_test.clj
+++ b/test/metabase/oauth_server/core_test.clj
@@ -4,8 +4,6 @@
[metabase.oauth-server.core :as oauth-server]
[metabase.test :as mt]))
-;; TODO (Chris 2026-03-24) — remove kondo ignore once linter respects the thread-safe list in use-fixtures
-#_{:clj-kondo/ignore [:metabase/validate-deftest]}
(use-fixtures :each (fn [thunk]
(oauth-server/reset-provider!)
(thunk)
diff --git a/test/metabase/premium_features/api_test.clj b/test/metabase/premium_features/api_test.clj
index d09767de6ce..a00bb4699ab 100644
--- a/test/metabase/premium_features/api_test.clj
+++ b/test/metabase/premium_features/api_test.clj
@@ -76,7 +76,6 @@
(deftest token-refresh-sets-premium-features-cookie-test
(testing "POST /api/premium-features/token/refresh sets the premium-features-last-updated cookie"
;; user-real-request hits a real Jetty server; handler thread doesn't inherit *local-redefs*.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [premium-features/token-status (constantly fake-token-status)
premium-features/premium-embedding-token (constantly nil)]
(let [cs (cookies/cookie-store)]
diff --git a/test/metabase/premium_features/test_util.clj b/test/metabase/premium_features/test_util.clj
index fcd01c4b164..b997ca94c94 100644
--- a/test/metabase/premium_features/test_util.clj
+++ b/test/metabase/premium_features/test_util.clj
@@ -23,6 +23,7 @@
(thunk)
;; global mode — must use with-redefs so Jetty handler threads (which don't inherit *local-redefs*)
;; see the updated premium features.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [token-check/*token-features* (constantly features)]
(thunk)))))))
diff --git a/test/metabase/pulse/task/send_pulses_test.clj b/test/metabase/pulse/task/send_pulses_test.clj
index 2cf44663516..4b7c3abbca6 100644
--- a/test/metabase/pulse/task/send_pulses_test.clj
+++ b/test/metabase/pulse/task/send_pulses_test.clj
@@ -205,6 +205,7 @@
(mt/with-model-cleanup [:model/Pulse]
(let [sent-channel-ids (atom #{})]
;; with-redefs (cross-thread): quartz scheduler threads don't inherit *local-redefs*
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [;; run the job every second
u.cron/schedule-map->cron-string (constantly "* * * 1/1 * ? *")
@@ -241,6 +242,7 @@
original-send-pulse!* (mt/original-fn #'task.send-pulses/send-pulse!*)]
;; quartz scheduler threads don't inherit *local-redefs*, so we have to swap the
;; root — see dynamic-redefs.clj docstring
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [;; run the job every second - must be before creating PulseChannel
u.cron/schedule-map->cron-string (constantly "* * * 1/1 * ? *")
diff --git a/test/metabase/query_processor/api_test.clj b/test/metabase/query_processor/api_test.clj
index d9cefb7a97b..106d1fe94da 100644
--- a/test/metabase/query_processor/api_test.clj
+++ b/test/metabase/query_processor/api_test.clj
@@ -671,11 +671,12 @@
(mt/mbql-query venues {:fields [$id $name]}))))))))
;; historical test: don't do this going forward
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel compile-test-6
(testing "POST /api/dataset/native"
(testing "\nCan we fetch a native version of an MBQL query?"
(testing "`:now` is usable inside `:case` with mongo (#32216)"
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :mongo
(is (= {"$switch"
{"branches"
@@ -692,8 +693,9 @@
:query json/decode first (get-in ["$project" "E"])))))))))
;; historical test: don't do this going forward
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest report-timezone-test
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :postgres
(testing "expected (desired) and actual timezone should be returned as part of query results"
(mt/with-temporary-setting-values [report-timezone "US/Pacific"]
@@ -706,9 +708,10 @@
(select-keys [:requested_timezone :results_timezone])))))))))
;; historical test: don't do this going forward
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest databricks-stack-trace-test
(testing "exceptions with stacktraces should have the stacktrace removed"
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :databricks
(let [res (mt/user-http-request :rasta :post 400 "dataset"
(lib/native-query (mt/metadata-provider)
diff --git a/test/metabase/query_processor/explicit_joins_test.clj b/test/metabase/query_processor/explicit_joins_test.clj
index ac2d9e990a9..7163e09da8f 100644
--- a/test/metabase/query_processor/explicit_joins_test.clj
+++ b/test/metabase/query_processor/explicit_joins_test.clj
@@ -878,6 +878,7 @@
;; the display names can differ a little between drivers, we don't actually care about any
;; differences, this is just a sanity check for a few known drivers. So it's okay to hardcode driver
;; names here.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(when (#{:postgres :h2} driver/*driver*)
(is (= ["Category" "Count" "Q2 → Category" "Q2 → Sum of Price" "Q3 → Category" "Q3 → Average of Rating"]
@@ -911,6 +912,7 @@
;; the display names can differ a little between drivers, we don't actually care about
;; any differences, this is just a sanity check for a few known drivers. So it's okay to hardcode
;; driver names here.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(when (#{:h2 :postgres} driver/*driver*)
(is (= ["ID"
diff --git a/test/metabase/query_processor/filter_test.clj b/test/metabase/query_processor/filter_test.clj
index b1573de6fe3..90bae8d0f99 100644
--- a/test/metabase/query_processor/filter_test.clj
+++ b/test/metabase/query_processor/filter_test.clj
@@ -178,6 +178,7 @@
(testing ":between with dates"
;; Prevent an issue with Snowflake were a previous connection's report-timezone setting can affect this
;; test's results
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(when (= driver/*driver* :snowflake)
(driver/notify-database-updated driver/*driver* (mt/id)))
diff --git a/test/metabase/query_processor/middleware/cache_backend/db_test.clj b/test/metabase/query_processor/middleware/cache_backend/db_test.clj
index 9ab64fee65f..48467faebd8 100644
--- a/test/metabase/query_processor/middleware/cache_backend/db_test.clj
+++ b/test/metabase/query_processor/middleware/cache_backend/db_test.clj
@@ -69,7 +69,6 @@
(await-race! (first args))
(apply orig-ins-instances args))
cache-backend (i/cache-backend :db)]
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs-fn {ins-pks-var coordinated-ins-pks
ins-instances-var coordinated-ins-inst}
(fn []
diff --git a/test/metabase/query_processor/middleware/cache_test.clj b/test/metabase/query_processor/middleware/cache_test.clj
index 7dabc40f5c1..4168eec202f 100644
--- a/test/metabase/query_processor/middleware/cache_test.clj
+++ b/test/metabase/query_processor/middleware/cache_test.clj
@@ -443,8 +443,9 @@
result)))))))
(deftest array-query-can-be-cached-test
- #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-drivers (disj (mt/normal-drivers-with-feature :test/arrays)
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
:sqlite) ;; Disabling until issue #57301 is resolved
(with-mock-cache! [save-chan]
(mt/with-temporary-setting-values [enable-query-caching true]
@@ -473,6 +474,7 @@
(dissoc cached-result :cache/details)))))))))
(deftest postgres-domain-can-be-cached-test
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :postgres
(mt/dataset (mt/dataset-definition
@@ -553,6 +555,7 @@
save-query-update-avg-time-original (mt/original-fn #'query/save-queries-and-update-average-execution-times!)]
;; save-execution-metadata!* and save-queries-and-update-average-execution-times! are invoked from
;; the QP pipeline on worker threads that don't inherit *local-redefs* — use with-redefs.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [process-userland-query/save-execution-metadata!* (fn [& args]
(swap! save-execution-metadata-count inc)
diff --git a/test/metabase/query_processor/middleware/fetch_source_query_test.clj b/test/metabase/query_processor/middleware/fetch_source_query_test.clj
index e5e0ebb5531..be64b02caa2 100644
--- a/test/metabase/query_processor/middleware/fetch_source_query_test.clj
+++ b/test/metabase/query_processor/middleware/fetch_source_query_test.clj
@@ -387,7 +387,6 @@
;;; this is a proof-of-concept to make sure this stuff works for non-SQL drivers, that's why we're hardcoding `:mongo`
;;; below.
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel card-id->source-query-and-metadata-test
(testing "card-id->source-query-and-metadata-test should preserve non-SQL native queries"
(let [query {:type :native
@@ -400,6 +399,8 @@
;; this doesn't actually need to load Mongo code, there is special casing for `:mongo`
;; in [[metabase.query-processor.middleware.fetch-source-query/source-query]]
(qp.store/with-metadata-provider (-> meta/metadata-provider
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(lib.tu/merged-mock-metadata-provider {:database {:engine :mongo}})
(lib.tu/metadata-provider-with-cards-for-queries [query]))
(is (=? {:stages [{:lib/type :mbql.stage/native
@@ -416,7 +417,6 @@
;;; this is a proof-of-concept to make sure this stuff works for non-SQL drivers, that's why we're hardcoding `:mongo`
;;; below.
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest ^:parallel card-id->source-query-and-metadata-test-2
(testing "card-id->source-query-and-metadata-test should preserve mongodb native queries in string format (#30112)"
(let [query-str (str "[{\"$project\":\n"
@@ -429,6 +429,8 @@
:collection "checkins"}
:database (meta/id)}]
(qp.store/with-metadata-provider (-> meta/metadata-provider
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(lib.tu/merged-mock-metadata-provider {:database {:engine :mongo}})
(lib.tu/metadata-provider-with-cards-for-queries [query]))
(is (=? {:stages [{:lib/type :mbql.stage/native
diff --git a/test/metabase/query_processor/middleware/parameters/mbql_test.clj b/test/metabase/query_processor/middleware/parameters/mbql_test.clj
index 4bafac61408..78fea95b062 100644
--- a/test/metabase/query_processor/middleware/parameters/mbql_test.clj
+++ b/test/metabase/query_processor/middleware/parameters/mbql_test.clj
@@ -196,6 +196,7 @@
;; Prevent an issue with Snowflake were a previous connection's report-timezone setting can affect this test's
;; results
;; TODO: Verify we still need the following expression in place. PR #36858 may have addressed that.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(when (= :snowflake driver/*driver*)
(driver/notify-database-updated driver/*driver* (mt/id)))
diff --git a/test/metabase/query_processor/middleware/process_userland_query_test.clj b/test/metabase/query_processor/middleware/process_userland_query_test.clj
index 0a1c450be28..648bc88b02e 100644
--- a/test/metabase/query_processor/middleware/process_userland_query_test.clj
+++ b/test/metabase/query_processor/middleware/process_userland_query_test.clj
@@ -29,6 +29,7 @@
(mt/with-temporary-setting-values [synchronous-batch-updates true]
;; save-execution-metadata!* is invoked from the QP pipeline transducer, which runs on a thread
;; that doesn't inherit *local-redefs* — use with-redefs so worker threads see the replacement.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [process-userland-query/save-execution-metadata!*
(fn [query-executions]
diff --git a/test/metabase/query_processor/native_test.clj b/test/metabase/query_processor/native_test.clj
index 11c3dc1cdd7..488a2bb87f6 100644
--- a/test/metabase/query_processor/native_test.clj
+++ b/test/metabase/query_processor/native_test.clj
@@ -49,6 +49,7 @@
;; allow duplicate column names in the `SELECT` list (all of them, I think?). That was the original intention of
;; this test but because of a coding error it only ever ran against H2. I updated it to run against PG as well
;; until we can verify it works on other drivers without issue.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-drivers #{:h2 :postgres}
(let [mp (lib.tu/mock-metadata-provider
diff --git a/test/metabase/query_processor/parameters/values_test.clj b/test/metabase/query_processor/parameters/values_test.clj
index 42f2a835733..9a0a44eeaba 100644
--- a/test/metabase/query_processor/parameters/values_test.clj
+++ b/test/metabase/query_processor/parameters/values_test.clj
@@ -431,6 +431,7 @@
(mt/with-test-user :rasta
(testing "Persisted Models are substituted"
;; legacy test -- don't hardcode driver names in new tests going forward.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :postgres
;; TODO (Cam 7/16/25) -- rework this to use metadata providers -- we support model persisted info directly from
diff --git a/test/metabase/query_processor/streaming_test.clj b/test/metabase/query_processor/streaming_test.clj
index 0c5b1934b20..31593a2f90e 100644
--- a/test/metabase/query_processor/streaming_test.clj
+++ b/test/metabase/query_processor/streaming_test.clj
@@ -219,9 +219,10 @@
;;; EXIST ANYMORE, BUT MAYBE YOU CAN GO LOOKING FOR IT IF YOU NEED TO?)
;;;
;;; This is only running against Postgres since we're just testing general behavior for formatting different types
-#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(deftest report-timezone-test
(testing "Export downloads should format stuff with the report timezone rather than UTC (#13677)"
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
+ #_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(mt/test-driver :postgres
(let [query (mt/dataset attempted-murders
(mt/mbql-query attempts
diff --git a/test/metabase/search/appdb/index_test.clj b/test/metabase/search/appdb/index_test.clj
index 7b1d3bfe16c..b88387f6536 100644
--- a/test/metabase/search/appdb/index_test.clj
+++ b/test/metabase/search/appdb/index_test.clj
@@ -43,7 +43,6 @@
nil))
;; These helpers only mutate the temp local AppDb.
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
;; TODO make this a :once fixture so that we avoid so much setup and tear down
(defmacro with-index
"Ensure a clean, small index."
diff --git a/test/metabase/search/appdb/scoring_test.clj b/test/metabase/search/appdb/scoring_test.clj
index a6b9d1dc911..81045867e9c 100644
--- a/test/metabase/search/appdb/scoring_test.clj
+++ b/test/metabase/search/appdb/scoring_test.clj
@@ -23,7 +23,6 @@
(set! *warn-on-reflection* true)
;; We act on a random localized table, making this thread-safe.
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-index-contents
"Populate the index with the given appdb agnostic entity shapes."
{:style/indent :defn}
diff --git a/test/metabase/search/engine_test.clj b/test/metabase/search/engine_test.clj
index ac60e003016..3e186b5c874 100644
--- a/test/metabase/search/engine_test.clj
+++ b/test/metabase/search/engine_test.clj
@@ -22,7 +22,6 @@
the additional-search-engines setting value."
[{:keys [supported configured additional]} & body]
;; with-redefs is required: supported-engine? is a multimethod, which with-dynamic-fn-redefs cannot proxy.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
`(with-redefs [search.engine/supported-engine? ~supported
search.engine/known-engine? all-engines
search.settings/configured-search-engine (constantly ~configured)
diff --git a/test/metabase/search/in_place/filter_test.clj b/test/metabase/search/in_place/filter_test.clj
index b940dd57e1a..7939d57448f 100644
--- a/test/metabase/search/in_place/filter_test.clj
+++ b/test/metabase/search/in_place/filter_test.clj
@@ -1,7 +1,4 @@
(ns metabase.search.in-place.filter-test
- ;; Left renaming search.filter out of this PR to save a ton of noise.
- ;; This comment is way up here, because cljfmt doesn't like it in the middle of the :require.
- #_{:clj-kondo/ignore [:consistent-alias]}
(:require
[clojure.test :refer :all]
[metabase.audit-app.core :as audit]
@@ -122,7 +119,6 @@
:models #{"dashboard" "card" "transform"}})))))))
(deftest joined-with-table?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [expected args]
(= expected (apply #'search.filter/joined-with-table? args))
diff --git a/test/metabase/search/test_util.clj b/test/metabase/search/test_util.clj
index 7e1d6f69a1b..67898ee42c7 100644
--- a/test/metabase/search/test_util.clj
+++ b/test/metabase/search/test_util.clj
@@ -13,14 +13,12 @@
(def ^:dynamic *user-ctx* nil)
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-sync-search-indexing
"Perform all search indexing synchronously."
[& body]
`(binding [metabase.search.ingestion/*force-sync* true]
~@body))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-temp-index-table
"Create a temporary index table for the duration of the body."
[& body]
@@ -30,7 +28,6 @@
(with-sync-search-indexing
~@body))))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-appdb-search-if-available*
"Create a temporary index table for the duration of the body."
[& body]
@@ -45,7 +42,6 @@
(search/reindex! {:async? false :in-place? true})
~@body)))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-appdb-search-if-available-otherwise-legacy
"Create a temporary index table for the duration of the body."
[& body]
diff --git a/test/metabase/server/middleware/security_test.clj b/test/metabase/server/middleware/security_test.clj
index 2c3ec6f1583..6f979827251 100644
--- a/test/metabase/server/middleware/security_test.clj
+++ b/test/metabase/server/middleware/security_test.clj
@@ -199,7 +199,6 @@
(let [nonceJSON (atom nil)
render-file (mt/original-fn #'stencil/render-file)]
;; http/get hits a real Jetty server; handler thread doesn't inherit *local-redefs*.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [stencil/render-file (fn [path variables]
(reset! nonceJSON (:nonceJSON variables))
;; Use index_template.html instead of index.html so the frontend doesn't
diff --git a/test/metabase/server/middleware/settings_cache_test.clj b/test/metabase/server/middleware/settings_cache_test.clj
index 123b0b8d937..1c8e314e6be 100644
--- a/test/metabase/server/middleware/settings_cache_test.clj
+++ b/test/metabase/server/middleware/settings_cache_test.clj
@@ -48,7 +48,6 @@
;; value in 2042 to simulate client has more recent settings
(update-cookie cs cookie-name "2042-12-02+19%3A57%3A49.775909%2B00")
;; user-real-request hits a real Jetty server; handler thread doesn't inherit *local-redefs*.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [setting/restore-cache! (fn [] (swap! calls inc))]
(mt/user-real-request :crowberto :get 200 "user/current"
{:request-options {:cookie-store cs}})
diff --git a/test/metabase/server/statistics_handler_test.clj b/test/metabase/server/statistics_handler_test.clj
index 6cf42e6aeff..9dbb6f1239a 100644
--- a/test/metabase/server/statistics_handler_test.clj
+++ b/test/metabase/server/statistics_handler_test.clj
@@ -3,7 +3,7 @@
[clj-http.client :as http]
[clojure.core.async :as a]
[clojure.test :refer [deftest is]]
- [compojure.core :as compojure :refer #_{:clj-kondo/ignore [:discouraged-var]} [GET]]
+ [compojure.core :as compojure :refer [GET]]
[compojure.route :as route]
[metabase.analytics.prometheus-test :as prometheus-test]
[metabase.server.instance :as server.instance]
diff --git a/test/metabase/session/api_test.clj b/test/metabase/session/api_test.clj
index 374b4719ee3..960089b4582 100644
--- a/test/metabase/session/api_test.clj
+++ b/test/metabase/session/api_test.clj
@@ -592,7 +592,6 @@
(t2/insert! :model/User (merge (mt/with-temp-defaults :model/User) {:email "[email protected]" :is_active true}))
(testing "Google auth works with remember me and rasta"
;; client-real-response hits a real Jetty server; handler thread doesn't inherit *local-redefs*.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [http/post (constantly
{:status 200
:body (str "{\"aud\":\"pretend-client-id.apps.googleusercontent.com\","
diff --git a/test/metabase/slackbot/uploads_test.clj b/test/metabase/slackbot/uploads_test.clj
index e6b9ca8d8b2..f9fada4a165 100644
--- a/test/metabase/slackbot/uploads_test.clj
+++ b/test/metabase/slackbot/uploads_test.clj
@@ -178,7 +178,6 @@
(testing "no upload was attempted"
(is (= 0 (count @upload-calls))))
(testing "responds directly with skip message"
- #_{:clj-kondo/ignore [:unresolved-namespace]}
(let [message-text (:text (first @post-calls))]
(is (str/includes? message-text "can only process CSV and TSV"))
(is (str/includes? message-text "query_result.xlsx")))))))))))))
diff --git a/test/metabase/sql_tools/macaw/references_test.clj b/test/metabase/sql_tools/macaw/references_test.clj
index 44c382f2110..21b3ebe143c 100644
--- a/test/metabase/sql_tools/macaw/references_test.clj
+++ b/test/metabase/sql_tools/macaw/references_test.clj
@@ -6,7 +6,6 @@
[metabase.sql-tools.macaw.references :as sql-tools.macaw]))
;; TODO (Chris 2026-01-22) -- Refactor to use driver.u/parsed-query instead of macaw/parsed-query
-#_{:clj-kondo/ignore [:discouraged-var]}
(defn- ->references [query]
(->> query macaw/parsed-query macaw/->ast (sql-tools.macaw/field-references :sql)))
diff --git a/test/metabase/sso/google_test.clj b/test/metabase/sso/google_test.clj
index 448a393eb9b..c2dd623c1b9 100644
--- a/test/metabase/sso/google_test.clj
+++ b/test/metabase/sso/google_test.clj
@@ -38,7 +38,6 @@
(deftest allow-autocreation-test
(with-no-sso-google-token!
(mt/with-temporary-setting-values [google-auth-auto-create-accounts-domain "metabase.com"]
- #_{:clj-kondo/ignore [:equals-true]}
(are [allowed? email] (= allowed?
(#'google/autocreate-user-allowed-for-email? email))
diff --git a/test/metabase/sso/integrations/slack_connect_test.clj b/test/metabase/sso/integrations/slack_connect_test.clj
index 328c62825e9..9c1afd044b9 100644
--- a/test/metabase/sso/integrations/slack_connect_test.clj
+++ b/test/metabase/sso/integrations/slack_connect_test.clj
@@ -298,7 +298,6 @@
site-name "test"]
(with-successful-oidc!
;; client-real-response hits a real Jetty server; handler thread doesn't inherit *local-redefs*.
- #_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [auth-identity/login!
(fn [_provider _request]
{:success? false
diff --git a/test/metabase/sync/sync_metadata/fields/common_test.clj b/test/metabase/sync/sync_metadata/fields/common_test.clj
index 9b21f644cd8..9f2e2974545 100644
--- a/test/metabase/sync/sync_metadata/fields/common_test.clj
+++ b/test/metabase/sync/sync_metadata/fields/common_test.clj
@@ -4,7 +4,6 @@
[metabase.sync.sync-metadata.fields.common :as common]))
(deftest canonical-names-equal?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [s1 s2 result] (= result (#'common/canonical-names-equal? {:name s1} {:name s2}))
"id" "ID" true
"Id" "id" true
diff --git a/test/metabase/test/data.clj b/test/metabase/test/data.clj
index 22062e95f28..9a7c7b296b0 100644
--- a/test/metabase/test/data.clj
+++ b/test/metabase/test/data.clj
@@ -190,7 +190,6 @@
Like `mbql-query`, but for native queries."
[inner-native-query :- :map]
{:deprecated "0.61.0"}
- #_{:clj-kondo/ignore [:deprecated-var]}
{:database (id)
:type :native
:native (mbql.normalize/normalize ::mbql.s/TopLevelNativeInnerQuery inner-native-query)})
diff --git a/test/metabase/test/data/users.clj b/test/metabase/test/data/users.clj
index 0499b9cb395..119bee2b8a5 100644
--- a/test/metabase/test/data/users.clj
+++ b/test/metabase/test/data/users.clj
@@ -217,7 +217,6 @@
session-key (session/generate-session-key)]
(when-not (t2/exists? :model/User :id user-id)
(throw (ex-info "User does not exist" {:user user})))
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/Session _ {:id (session/generate-session-id)
:key_hashed (session/hash-session-key session-key)
:user_id user-id}]
@@ -272,7 +271,6 @@
(u/the-id test-user-name-or-user-id)))
(defn do-with-group-for-user [group test-user-name-or-user-id f]
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/PermissionsGroup group group
:model/PermissionsGroupMembership _ {:group_id (u/the-id group)
:user_id (test-user-name-or-user-id->user-id test-user-name-or-user-id)}]
diff --git a/test/metabase/test/generate.clj b/test/metabase/test/generate.clj
index bc88290cbbd..fdab60e1417 100644
--- a/test/metabase/test/generate.clj
+++ b/test/metabase/test/generate.clj
@@ -395,7 +395,6 @@
:insert! (fn [sm-db {:keys [schema-opts attrs] :as visit-opts}]
(try
(first (t2/insert-returning-instances! (:model schema-opts)
- #_{:clj-kondo/ignore [:deprecated-var]}
(rsg/spec-gen-assoc-relations
sm-db
(assoc visit-opts :visit-val (:spec-gen attrs)))))
diff --git a/test/metabase/test/util.clj b/test/metabase/test/util.clj
index 7fdc584c5dd..4d517b55990 100644
--- a/test/metabase/test/util.clj
+++ b/test/metabase/test/util.clj
@@ -590,7 +590,6 @@
e))))))))))
;;; TODO FIXME -- either rename this to `with-temporary-setting-values!` or fix it and make it thread-safe
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-temporary-setting-values
"Temporarily bind the site-wide values of one or more `Settings`, execute body, and re-establish the original values.
This works much the same way as `binding`.
@@ -611,7 +610,6 @@
~@body)))))
;;; TODO FIXME -- either rename this to `with-temporary-raw-setting-values!` or fix it and make it thread-safe
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-temporary-raw-setting-values
"Like [[with-temporary-setting-values]] but works with raw value and it allows settings that are not defined
using [[metabase.settings.models.setting/defsetting]]."
@@ -637,7 +635,6 @@
settings)))
;;; TODO FIXME -- either rename this to `with-discarded-setting-changes!` or fix it and make it thread-safe
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro discard-setting-changes
"Execute `body` in a try-finally block, restoring any changes to listed `settings` to their original values at its
conclusion.
@@ -953,7 +950,6 @@
(deftest with-model-cleanup-test
(testing "Make sure the with-model-cleanup macro actually works as expected"
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/Card other-card]
(let [card-count-before (t2/count :model/Card)
card-name (u.random/random-name)]
@@ -1120,7 +1116,6 @@
`(do-with-discard-model-updates! ~models (fn [] ~@body))))
(deftest with-discard-model-changes-test
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp
[:model/Card {card-id :id :as card} {:name "A Card"}
:model/Dashboard {dash-id :id :as dash} {:name "A Dashboard"}]
@@ -1202,7 +1197,6 @@
For most use cases see the macro [[with-all-users-permission]]."
[permission-path thunk]
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/Permissions _ {:group_id (:id (perms/all-users-group))
:object permission-path}]
(thunk)))
@@ -1280,7 +1274,6 @@
;; remap is integer => fk remap
(let [remapped (t2/select-one :model/Field :id (u/the-id remap))]
(fn []
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/Dimension _ {:field_id (:id original)
:name (format "%s [external remap]" (:display_name original))
:type :external
@@ -1300,7 +1293,6 @@
(testing (format "With human readable values remapping %s -> %s\n"
(describe-field original) (pr-str values-map))
(thunk)))]
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/Dimension _ {:field_id (:id original)
:name (format "%s [internal remap]" (:display_name original))
:type :internal}]
@@ -1308,7 +1300,6 @@
(with-temp-vals-in-db :model/FieldValues preexisting-id {:values (keys values-map)
:human_readable_values (vals values-map)}
(testing-thunk))
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/FieldValues _ {:field_id (:id original)
:values (keys values-map)
:human_readable_values (vals values-map)}]
@@ -1334,7 +1325,6 @@
x))
;;; TODO FIXME -- either rename this to `with-column-remappings!` or fix it and make it thread-safe.
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-column-remappings
"Execute `body` with column remappings in place. Can create either FK \"external\" or human-readable-values
\"internal\" remappings:
@@ -1399,7 +1389,6 @@
(thunk)))))
;;; TODO FIXME -- either rename this to `with-env-keys-renamed-by!` or fix it and make it thread-safe
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-env-keys-renamed-by
"Evaluates body with the current core.environ/env being redefined, its keys having been renamed by the given
rename-fn."
@@ -1505,12 +1494,10 @@
(defn do-with-user-in-groups
([f groups-or-ids]
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/User user]
(do-with-user-in-groups f user groups-or-ids)))
([f user [group-or-id & more]]
(if group-or-id
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [:model/PermissionsGroupMembership _ {:group_id (u/the-id group-or-id), :user_id (u/the-id user)}]
(do-with-user-in-groups f user more))
(f user))))
@@ -1530,7 +1517,6 @@
[[& bindings] & body]
(if (> (count bindings) 2)
(let [[group-binding group-definition & more] bindings]
- #_{:clj-kondo/ignore [:discouraged-var]}
`(t2.with-temp/with-temp [:model/PermissionsGroup ~group-binding ~group-definition]
(with-user-in-groups ~more ~@body)))
(let [[user-binding groups-or-ids-to-put-user-in] bindings]
diff --git a/test/metabase/test/util/misc.clj b/test/metabase/test/util/misc.clj
index 25c68305668..735c04163f3 100644
--- a/test/metabase/test/util/misc.clj
+++ b/test/metabase/test/util/misc.clj
@@ -22,7 +22,6 @@
:else (throw (Exception. (format "Invalid clock: ^%s %s"
(.getName (class clock))
(pr-str clock)))))]
- #_{:clj-kondo/ignore [:discouraged-var]}
(t/with-clock clock
(thunk)))))
@@ -83,7 +82,6 @@
(comp
(memoize
(fn [toucan-model]
- #_{:clj-kondo/ignore [:discouraged-var]}
(t2.with-temp/with-temp [toucan-model x {}
toucan-model y {}]
(let [[_ _ things-in-both] (data/diff x y)]
diff --git a/test/metabase/transforms/jobs_test.clj b/test/metabase/transforms/jobs_test.clj
index 92e2c29ad45..a8287239760 100644
--- a/test/metabase/transforms/jobs_test.clj
+++ b/test/metabase/transforms/jobs_test.clj
@@ -584,6 +584,7 @@
;; ExecutorService worker (transforms-sql-worker), which doesn't convey dynamic bindings, so a
;; proxy-based redef is invisible there and the barrier choreography silently no-ops. A global
;; root swap is seen by every thread.
+ ;; [kondo-keep] suppresses a warning :redundant-ignore can't see; --audit rechecks
#_{:clj-kondo/ignore [:metabase/prefer-with-dynamic-fn-redefs]}
(with-redefs [transforms.u/try-start-unless-already-running
(fn [transform-id run-method user-id & kwargs]
diff --git a/test/metabase/util/encryption_test.clj b/test/metabase/util/encryption_test.clj
index 14da6548801..2d968de5b13 100644
--- a/test/metabase/util/encryption_test.clj
+++ b/test/metabase/util/encryption_test.clj
@@ -26,7 +26,6 @@
;; reset the cache again so nothing that happened during the test is persisted.
(setting.cache/restore-cache!))))
-#_{:clj-kondo/ignore [:metabase/test-helpers-use-non-thread-safe-functions]}
(defmacro with-secret-key
"Run `body` with the encryption secret key temporarily bound to `secret-key`. Useful for testing how functions behave
with and without encryption disabled. A nil secret key disables encryption."
diff --git a/test/metabase/util/honey_sql_2_test.clj b/test/metabase/util/honey_sql_2_test.clj
index 5b080780ebc..e25946535cb 100644
--- a/test/metabase/util/honey_sql_2_test.clj
+++ b/test/metabase/util/honey_sql_2_test.clj
@@ -229,7 +229,6 @@
(h2x/with-database-type-info (h2x/with-database-type-info :field "date") nil))))))
(deftest ^:parallel is-of-type?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [expr tyype expected] (= expected (h2x/is-of-type? expr tyype))
typed-form "text" true
typed-form "TEXT" true
diff --git a/test/metabase/util/jvm_test.clj b/test/metabase/util/jvm_test.clj
index 88dac1c8f00..97e1a5bcd10 100644
--- a/test/metabase/util/jvm_test.clj
+++ b/test/metabase/util/jvm_test.clj
@@ -8,7 +8,6 @@
(deftest ^:parallel host-up?-test
(testing "host-up?"
- #_{:clj-kondo/ignore [:equals-true]}
(are [s expected] (= expected
(u/host-up? s))
"localhost" true
@@ -18,7 +17,6 @@
(u/host-port-up? "nosuchhost" 8005)))))
(deftest ^:parallel ip-address?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [x expected] (= expected
(u/ip-address? x))
"8.8.8.8" true
diff --git a/test/metabase/util/number_test.cljc b/test/metabase/util/number_test.cljc
index 11b4cdde342..a4c97ad1db4 100644
--- a/test/metabase/util/number_test.cljc
+++ b/test/metabase/util/number_test.cljc
@@ -12,7 +12,6 @@
(deftest bigint?-test
(testing "should check if the value is a bigint"
- #_{:clj-kondo/ignore [:equals-true]}
(are [exp value] (= exp (u.number/bigint? value))
true (u.number/bigint 10)
true (u.number/bigint "9007199254740993")
@@ -21,7 +20,6 @@
(deftest integer?-test
(testing "should check if the value is an integer"
- #_{:clj-kondo/ignore [:equals-true]}
(are [exp value] (= exp (u.number/integer? value))
true 0
true 10
diff --git a/test/metabase/util_test.cljc b/test/metabase/util_test.cljc
index 2f1b33fc48d..898e6c2dfff 100644
--- a/test/metabase/util_test.cljc
+++ b/test/metabase/util_test.cljc
@@ -26,7 +26,6 @@
(u/add-period " "))))
(deftest ^:parallel url?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [s expected] (= expected
(u/url? s))
"http://google.com" true
@@ -72,7 +71,6 @@
"[email protected]" false)))
(deftest ^:parallel state?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [x expected] (= expected
(u/state? x))
"louisiana" true
@@ -173,7 +171,6 @@
{} [:c] {}))
(deftest ^:parallel base64-string?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [s expected] (= expected
(u/base64-string? s))
"ABc=" true
@@ -385,7 +382,6 @@
"metabase.com" "[email protected]"))
(deftest ^:parallel email-in-domain-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [in-domain? email domain] (= in-domain?
(u/email-in-domain? email domain))
true "[email protected]" "metabase.com"
@@ -528,7 +524,6 @@
:to-compare #(dissoc % :id :god_id)})))))
(deftest ^:parallel empty-or-distinct?-test
- #_{:clj-kondo/ignore [:equals-true]}
(are [xs expected] (= expected
(u/empty-or-distinct? xs))
nil true
diff --git a/test/metabase/warehouses/models/database_test.clj b/test/metabase/warehouses/models/database_test.clj
index 6760ea4ab47..c94ed630d8b 100644
--- a/test/metabase/warehouses/models/database_test.clj
+++ b/test/metabase/warehouses/models/database_test.clj
@@ -529,7 +529,6 @@
:name "Secret Test"
:details base-details}]
(mt/with-current-user (mt/user->id :crowberto)
- #_{:clj-kondo/ignore [:redundant-nested-call]}
(are [expected extra-details] (= (merge
base-details
expected)