Skip to content

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

Replace Eastwood with a reflection check in the namespace loader (#84949)

dpsutton14cd26d0861e
diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml
index 2b6c83be1be..957fd65c731 100644
--- a/.github/workflows/backend.yml
+++ b/.github/workflows/backend.yml
@@ -161,108 +161,6 @@ jobs:
- name: Run clj-kondo
run: ./bin/mage kondo
- be-linter-eastwood:
- needs: *backend-gate-needs
- if: *backend-gate
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 30
- name: Eastwood
- steps:
- - uses: actions/checkout@v7
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- - run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
- name: Run Eastwood linter
-
- be-linter-eastwood-test:
- # Master / release safety net: lint every backend test namespace. A force-run never probes
- # static-viz, so the gate alone decides this one.
- needs: gate
- if: >-
- ${{ needs.gate.outputs.force-run == 'true'
- && contains(fromJSON(needs.gate.outputs.matched), 'backend_all') }}
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 50
- name: Eastwood (tests only)
- steps:
- - uses: actions/checkout@v7
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- - run: clojure -X:dev:dev/test:ee:ee-dev:drivers:drivers-dev:test:eastwood/test
- name: Run Eastwood linter on our backend tests
-
- be-linter-eastwood-test-changed:
- # Lint only the test namespaces touched by the diff.
- needs: *backend-gate-needs
- if: >-
- ${{ !cancelled() && needs.gate.result == 'success'
- && needs.static-viz-files-changed.result != 'failure'
- && needs.gate.outputs.force-run != 'true' && github.event_name == 'pull_request'
- && (contains(fromJSON(needs.gate.outputs.matched), 'backend_all')
- || needs.static-viz-files-changed.outputs.static_viz == 'true') }}
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 15
- name: Eastwood (changed tests only)
- steps:
- - uses: actions/checkout@v7
- with:
- # Enough history for `git merge-base` on a typical PR.
- fetch-depth: 200
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- - name: Compute changed test namespaces
- id: changed
- env:
- BASE_SHA: ${{ needs.gate.outputs.diff-base || github.event.pull_request.base.sha }}
- HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- run: |
- set -euo pipefail
-
- # Diff from the merge-base so changes that landed on the base branch after the PR was
- # last synced don't widen our scope. Falls back to BASE_SHA if older than fetched depth.
- git fetch --no-tags --depth=200 origin "$BASE_SHA"
- DIFF_BASE=$(git merge-base "$BASE_SHA" "$HEAD_SHA" 2>/dev/null || echo "$BASE_SHA")
- # Test roots we lint: core, EE, dev/test, and each driver module's test tree.
- # :eastwood/test derives matching :source-paths from the classpath, so any
- # namespace we name here is reachable. Include renames (R) so a test that
- # was just renamed still gets linted under its new name.
- FILES=$(git diff --name-only --diff-filter=AMR "$DIFF_BASE" "$HEAD_SHA" \
- -- 'test/**/*.clj' 'test/**/*.cljc' \
- 'enterprise/backend/test/**/*.clj' 'enterprise/backend/test/**/*.cljc' \
- 'dev/test/**/*.clj' 'dev/test/**/*.cljc' \
- 'modules/drivers/**/test/**/*.clj' 'modules/drivers/**/test/**/*.cljc')
-
- if [ -z "$FILES" ]; then
- echo "No backend test files changed; skipping lint."
- echo "namespaces=" >> "$GITHUB_OUTPUT"
- exit 0
- fi
-
- # Defence-in-depth: paths flow into a subsequent shell command via $GITHUB_OUTPUT.
- if grep -Eqv '^[A-Za-z0-9_./-]+$' <<<"$FILES"; then
- echo "Refusing to lint: unexpected characters in changed file paths:" >&2
- echo "$FILES" >&2
- exit 1
- fi
-
- # Convert each test path to a Clojure namespace: strip its known test root and
- # extension, then translate path separators and underscores. Keep these roots
- # aligned with FILES above and the Eastwood classpath aliases below.
- NS=$(sed -E \
- -e 's#^(test/|enterprise/backend/test/|dev/test/|modules/drivers/[^/]+/test/)##' \
- -e 's#\.cljc?$##' \
- -e 's#/#.#g' \
- -e 's#_#-#g' <<<"$FILES" \
- | sort -u \
- | paste -sd' ' -)
- echo "Changed test namespaces: $NS"
- echo "namespaces=$NS" >> "$GITHUB_OUTPUT"
- - name: Run Eastwood on changed test namespaces
- if: steps.changed.outputs.namespaces != ''
- env:
- NAMESPACES: ${{ steps.changed.outputs.namespaces }}
- run: clojure -X:dev:dev/test:ee:ee-dev:drivers:drivers-dev:test:eastwood/test :namespaces "[$NAMESPACES]"
-
be-tests:
needs: *backend-gate-needs
if: *backend-gate
@@ -506,9 +404,6 @@ jobs:
- gate
- static-viz-files-changed
- project-tests
- - be-linter-eastwood
- - be-linter-eastwood-test
- - be-linter-eastwood-test-changed
- be-linter-clj-kondo
- be-cljfmt
- be-check
diff --git a/.github/workflows/cache-warm.yml b/.github/workflows/cache-warm.yml
index 6806eda1ee5..fefca46fd4f 100644
--- a/.github/workflows/cache-warm.yml
+++ b/.github/workflows/cache-warm.yml
@@ -118,8 +118,6 @@ jobs:
combos=(
":build:dev:ee:ee-dev:drivers:drivers-dev:cljs" # build + uberjar (combined classpath)
":cljs" # shadow-cljs (build:cljs); resolves :cljs alone -> covers asm:9.2
- ":dev:ee:ee-dev:drivers:drivers-dev:test:eastwood" # backend.yml (eastwood)
- ":dev:dev/test:ee:ee-dev:drivers:drivers-dev:test:eastwood/test" # backend.yml (eastwood tests)
":dev:dev/test:ee:ee-dev:drivers:drivers-dev:test:ci" # run-tests.yml (project tests)
":dev:ci:ee:ee-dev:drivers:drivers-dev:test" # test-driver.yml (ee) -> covers data.json:2.4.0
":dev:ci:oss:oss-dev:drivers:drivers-dev:test" # test-driver.yml (oss)
diff --git a/.gitignore b/.gitignore
index c54094b6737..24d80c4cde1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
.DS_Store
.\#*
.cpcache
-.eastwood
.bot
.idea/
.nrepl-port
diff --git a/bin/load-namespaces/deps.edn b/bin/load-namespaces/deps.edn
index e024c57b5b9..3b6db143a01 100644
--- a/bin/load-namespaces/deps.edn
+++ b/bin/load-namespaces/deps.edn
@@ -1,7 +1,8 @@
{:paths ["src"]
:aliases
- {:test {:extra-paths ["test" "test-resources/protocol-reload" "test-resources/broken"]
+ {:test {:extra-paths ["test" "test-resources/protocol-reload" "test-resources/broken"
+ "test-resources/reflection" "test-resources/reflection-lib"]
:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "209b64504cb3bd3b99ecfec7937b358a879f55c1"}}
:main-opts ["-m" "cognitect.test-runner"]}}}
diff --git a/bin/load-namespaces/src/load_namespaces/core.clj b/bin/load-namespaces/src/load_namespaces/core.clj
index 4f627e2048a..e803cdec186 100644
--- a/bin/load-namespaces/src/load_namespaces/core.clj
+++ b/bin/load-namespaces/src/load_namespaces/core.clj
@@ -1,12 +1,15 @@
(ns load-namespaces.core
"Loads every namespace under the given source paths, with reflection warnings on, so that CI catches
namespaces that only fail against a shipped classpath -- one without the `:dev` dependencies. Circular
- dependencies and compilation errors surface here too, since both make a namespace fail to load."
+ dependencies and compilation errors surface here too, since both make a namespace fail to load.
+
+ A reflection warning in a file under one of the source paths also fails the run. Warnings in libraries
+ don't: `load` turns reflection warnings on for everything it pulls in, and libraries are not ours to fix."
(:require
[clojure.java.io :as io]
[clojure.string :as str])
(:import
- (java.io File PrintWriter Writer)))
+ (java.io File PrintWriter StringWriter Writer)))
(set! *warn-on-reflection* true)
@@ -34,43 +37,67 @@
[path]
(symbol (-> path (str/replace "/" ".") (str/replace "_" "-"))))
+(defn- reflection-warnings
+ "The reflection warnings in compiler `output` that point into one of `owned-paths`. The compiler names the
+ file by its classpath-relative path, which is the form [[loadable-paths]] returns, plus an extension."
+ [output owned-paths]
+ (for [[line path] (re-seq #"(?m)^Reflection warning, (.+?)\.cljc?:\d+:\d+ - .*$" output)
+ :when (contains? owned-paths path)]
+ line))
+
(defn- load-path
- "Loads `path`, returning the Throwable it threw, or nil if it loaded or was already loaded."
- [path]
+ "Loads `path`, returning the problems it caused: `:error`, the Throwable it threw, and `:reflection`, the
+ warnings it caused in `owned-paths`. Returns nil if it was already loaded."
+ [path owned-paths]
(let [lib (path->lib path)]
;; Namespaces this one already required must not be loaded a second time: reloading a namespace
;; redefines its protocols, and every implementation compiled against the previous definition breaks.
(when-not (contains? (loaded-libs) lib)
(binding [*out* *err*]
(println "Loading namespace" lib))
- (try
- (binding [*warn-on-reflection* true]
- ;; leading slash: without it `load` resolves the path against the *calling* namespace's directory
- (load (str "/" path)))
- nil
- (catch Throwable e
- (binding [*out* *err*]
- (println "Failed to load" lib))
- (.printStackTrace e (PrintWriter. ^Writer *err* true))
- e)))))
+ ;; the compiler prints its warnings to `*err*`; collect them for this load, then pass them on
+ (let [captured (StringWriter.)
+ error (binding [*err* (PrintWriter. captured true)]
+ (try
+ (binding [*warn-on-reflection* true]
+ ;; leading slash: without it `load` resolves the path against the *calling*
+ ;; namespace's directory
+ (load (str "/" path)))
+ nil
+ (catch Throwable e
+ (binding [*out* *err*]
+ (println "Failed to load" lib))
+ (.printStackTrace e (PrintWriter. ^Writer *err* true))
+ e)))
+ output (str captured)]
+ (binding [*out* *err*]
+ (print output)
+ (flush))
+ {:error error
+ :reflection (reflection-warnings output owned-paths)}))))
(defn- load-namespaces
- "Loads every namespace under `source-paths`, returning how many of them failed."
+ "Loads every namespace under `source-paths`, returning `:failures`, how many of them failed to load, and
+ `:reflection`, the reflection warnings in files under `source-paths`."
[source-paths]
- (->> source-paths
- (mapcat loadable-paths)
- (map load-path)
- (filter some?)
- count))
+ (let [paths (mapcat loadable-paths source-paths)
+ owned (set paths)
+ problems (doall (map #(load-path % owned) paths))]
+ {:failures (count (filter :error problems))
+ :reflection (vec (mapcat :reflection problems))}))
(defn -main
- "Loads every namespace under `source-paths`, or under `src` if none are given, and exits non-zero if any
- of them failed."
+ "Loads every namespace under `source-paths`, or under `src` if none are given, and exits non-zero if any of
+ them failed or caused a reflection warning in one of our files."
[& source-paths]
- (let [failures (load-namespaces (or (seq source-paths) ["src"]))]
+ (let [{:keys [failures reflection]} (load-namespaces (or (seq source-paths) ["src"]))]
(shutdown-agents)
- (when (pos? failures)
- (binding [*out* *err*]
+ (binding [*out* *err*]
+ (when (pos? failures)
(println failures "namespace(s) failed to load"))
+ (when (seq reflection)
+ (println (count reflection) "reflection warning(s) in our code; add type hints to fix them:")
+ (run! println reflection)))
+ (when (or (pos? failures) (seq reflection))
;; exiting with `failures` would wrap past 255 and could be read as success
(System/exit 1))))
diff --git a/bin/load-namespaces/test-resources/reflection-lib/reflection_lib/sloppy.clj b/bin/load-namespaces/test-resources/reflection-lib/reflection_lib/sloppy.clj
new file mode 100644
index 00000000000..b4f427ac1a7
--- /dev/null
+++ b/bin/load-namespaces/test-resources/reflection-lib/reflection_lib/sloppy.clj
@@ -0,0 +1,4 @@
+(ns reflection-lib.sloppy)
+
+(defn upper [x]
+ (.toUpperCase x))
diff --git a/bin/load-namespaces/test-resources/reflection/reflection_fixtures/reflective.clj b/bin/load-namespaces/test-resources/reflection/reflection_fixtures/reflective.clj
new file mode 100644
index 00000000000..72173ee3502
--- /dev/null
+++ b/bin/load-namespaces/test-resources/reflection/reflection_fixtures/reflective.clj
@@ -0,0 +1,4 @@
+(ns reflection-fixtures.reflective)
+
+(defn length [x]
+ (.length x))
diff --git a/bin/load-namespaces/test-resources/reflection/reflection_fixtures/uses_lib.clj b/bin/load-namespaces/test-resources/reflection/reflection_fixtures/uses_lib.clj
new file mode 100644
index 00000000000..e6f766263bb
--- /dev/null
+++ b/bin/load-namespaces/test-resources/reflection/reflection_fixtures/uses_lib.clj
@@ -0,0 +1,6 @@
+(ns reflection-fixtures.uses-lib
+ (:require
+ [reflection-lib.sloppy :as sloppy]))
+
+(defn shout [^String s]
+ (sloppy/upper s))
diff --git a/bin/load-namespaces/test/load_namespaces/core_test.clj b/bin/load-namespaces/test/load_namespaces/core_test.clj
index 10354beaab9..cc57bc7f46b 100644
--- a/bin/load-namespaces/test/load_namespaces/core_test.clj
+++ b/bin/load-namespaces/test/load_namespaces/core_test.clj
@@ -29,7 +29,7 @@
(deftest load-failures-are-counted-and-reported-test
(let [err (StringWriter.)
- failures (binding [*err* err] (#'core/load-namespaces ["test-resources/broken"]))
+ failures (:failures (binding [*err* err] (#'core/load-namespaces ["test-resources/broken"])))
output (str err)]
(is (= 1 failures))
(is (str/includes? output "Failed to load broken-fixtures.boom"))
@@ -37,7 +37,7 @@
(deftest already-loaded-namespaces-are-not-reloaded-test
(let [err (StringWriter.)
- failures (binding [*err* err] (#'core/load-namespaces ["test-resources/protocol-reload"]))
+ failures (:failures (binding [*err* err] (#'core/load-namespaces ["test-resources/protocol-reload"])))
output (str err)]
(is (zero? failures))
(testing "the consumer pulled the protocol in, so the scan left it alone"
@@ -47,3 +47,14 @@
(testing "reloading it redefines the protocol, breaking implementations compiled against the old one"
(load "/reload_fixtures/proto")
(is (thrown? IllegalArgumentException (greet-the-friend)))))
+
+(deftest reflection-in-our-files-is-reported-test
+ (let [err (StringWriter.)
+ result (binding [*err* err] (#'core/load-namespaces ["test-resources/reflection"]))]
+ (is (zero? (:failures result)))
+ (testing "the warning in our file is reported, and still printed"
+ (is (= ["Reflection warning, reflection_fixtures/reflective.clj:4:3 - reference to field length can't be resolved."]
+ (:reflection result)))
+ (is (str/includes? (str err) "reflection_fixtures/reflective.clj:4:3")))
+ (testing "a warning in a library we pulled in is printed but not reported"
+ (is (str/includes? (str err) "Reflection warning, reflection_lib/sloppy.clj")))))
diff --git a/deps.edn b/deps.edn
index e4ce59984e3..b141f7d9253 100644
--- a/deps.edn
+++ b/deps.edn
@@ -281,9 +281,6 @@
io.zonky.test.postgres/embedded-postgres-binaries-linux-amd64 {:mvn/version "18.3.0"} ; Linux x86_64 (covers ubuntu-latest GH Actions runner)
io.zonky.test.postgres/embedded-postgres-binaries-linux-arm64v8 {:mvn/version "18.3.0"} ; Linux arm64
io.zonky.test.postgres/embedded-postgres-binaries-windows-amd64 {:mvn/version "18.3.0"} ; Windows x86_64
- jonase/eastwood {:mvn/version "1.4.3" ; inspects namespaces and reports possible problems using tools.analyzer
- :exclusions
- [org.ow2.asm/asm-all]}
lambdaisland/deep-diff2 {:mvn/version "2.12.219"} ; way better diffs
net.solovyov/hashp {:mvn/version "0.4.0-1"} ; debugging/spying utility
nrepl/nrepl {:mvn/version "1.5.1"} ; nREPL server
@@ -638,84 +635,6 @@
"modules/drivers/vertica/src"]
:jvm-opts ["-Dclojure.main.report=stderr"]}
- ;; clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
- :eastwood
- {:exec-fn metabase.linters.eastwood/eastwood
- :exec-args {;; manually specify the source paths for the time being (exclude test paths) until we fix Eastwood
- ;; errors in the test paths (once PR #17193 is merged)
- :source-paths ["src"
- "enterprise/backend/src"
- "modules/drivers/athena/src"
- "modules/drivers/bigquery-cloud-sdk/src"
- "modules/drivers/clickhouse/src"
- "modules/drivers/databricks/src"
- "modules/drivers/druid-jdbc/src"
- "modules/drivers/hive-like/src"
- "modules/drivers/mongo/src"
- "modules/drivers/oracle/src"
- "modules/drivers/presto-jdbc/src"
- "modules/drivers/redshift/src"
- "modules/drivers/snowflake/src"
- "modules/drivers/sparksql/src"
- "modules/drivers/sqlserver/src"
- "modules/drivers/starburst/src"
- "modules/drivers/vertica/src"]
- :exclude-linters [;; Turn this off temporarily until we finish removing
- ;; self-deprecated functions & macros
- :deprecations
- ;; this has a fit in libs that use Potemkin `import-vars` such
- ;; as `java-time`
- :implicit-dependencies
- ;; too many false positives for now
- :unused-ret-vals
- :unused-ret-vals-in-try
- ;; hard to clear on for metabase.util.match macros, and disabling the linter just
- ;; there doesn't seem to work
- :unused-meta-on-macro
- ;; Kondo lints this for us anyway, and this isn't as easy to configure.
- :wrong-arity
- ;; Kondo lints this for us anyway, and this isn't as easy to configure.
- :suspicious-expression]
- ;; Snowplow has a dynamic dependency on okhttp3.CookieJar that we
- ;; don't use but eastwood detects. This is discussed in Slack here
- ;; https://clojurians.slack.com/archives/C03S1KBA2/p1667925853699669
- ;; An issue has been filed here https://github.com/jonase/eastwood/issues/444
- ;; and a simple reproduction repo can be found here https://github.com/metabase/snowplow-eastwood-issue
- ;;
- ;; The two Quartz queue-affinity DriverDelegate shims are `gen-class` namespaces whose
- ;; only body is a `(.superRtp this ...)` call to their own exposed super method. That
- ;; method exists only on the class the namespace itself generates, so `this` can't be
- ;; type-hinted with it at compile time (the class isn't defined yet) — the reflective
- ;; call is unavoidable. Eastwood also can't reliably analyze these gen-class shims.
- :exclude-namespaces [metabase.analytics.snowplow
- metabase.mq.quartz-affinity-delegate-std
- metabase.mq.quartz-affinity-delegate-postgres]}}
-
- ;; Test counterpart of :eastwood. Starts with :reflection only; add more linters as we fix other eastwood
- ;; issues in tests.
- ;;
- ;; clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood/test
- :eastwood/test
- {:exec-fn metabase.linters.eastwood/eastwood-tests
- :exec-args {:linters [:reflection]
- :exclude-namespaces
- [;; byte/1 dispatch value trips up Eastwood's reader
- metabase.test.http-client
- ;; Cookie/.getName qualified method trips up Eastwood's analyzer
- metabase.server.middleware.settings-cache-test
- ;; .cljc syntax error during Eastwood's analyze+eval phase
- metabase.lib.query-test
- ;; "count not supported on this type: Symbol" in Eastwood's analyzer
- metabase.query-processor.parameters.temporal-units-test
- ;; Syntax error compiling fn* in Eastwood's analyzer
- metabase.sql-tools.macaw.references-test
- ;; Method too large for Eastwood's analyzer
- metabase.sql-tools.sqlglot.references-test
- ;; dev/test namespaces that no longer load; nothing runs them
- dev.deps-graph-test
- dev.migrate-test
- dev.model-tracking-test]}}
-
;; clojure -T:whitespace-linter
:whitespace-linter
{:deps {com.github.camsaul/whitespace-linter {:sha "e35bc252ccf5cc74f7d543ef95ad8a3e5131f25b"}}
diff --git a/docs/developers-guide/devenv.md b/docs/developers-guide/devenv.md
index 1f3e9a99b2c..0d1d4d075c7 100644
--- a/docs/developers-guide/devenv.md
+++ b/docs/developers-guide/devenv.md
@@ -463,8 +463,8 @@ mage kondo
# Lint the migrations file (if you've written a database migration):
mage lint-migrations
-# Run Eastwood
-clojure -X:dev:ee:ee-dev:drivers:drivers-dev:eastwood
+# Load every namespace we ship, failing on reflection warnings
+clojure -M:ee:drivers:load-namespaces
# Run the namespace checker
clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:namespace-checker
diff --git a/package.json b/package.json
index 156fdf62f78..d80dcf6db13 100644
--- a/package.json
+++ b/package.json
@@ -443,7 +443,7 @@
"build:js": "bun install && rspack build",
"chromatic": "bun run build:cljs && NODE_OPTIONS=--max-old-space-size=8192 chromatic",
"ci": "bun run ci-frontend && bun run ci-backend",
- "ci-backend": "clojure -X:dev:ee:ee-dev:drivers:drivers-dev:eastwood && clojure -X:dev:test",
+ "ci-backend": "clojure -M:ee:drivers:load-namespaces && clojure -X:dev:test",
"ci-frontend": "bun run lint && bun run type-check && bun run test",
"clean-cypress-artifacts": "rm -R -f cypress/",
"clean-dev:cljs": "rm -rf target/cljs_dev/*",
diff --git a/src/metabase/mq/quartz_affinity_delegate_postgres.clj b/src/metabase/mq/quartz_affinity_delegate_postgres.clj
index 14147b4eb28..e05a4187ae8 100644
--- a/src/metabase/mq/quartz_affinity_delegate_postgres.clj
+++ b/src/metabase/mq/quartz_affinity_delegate_postgres.clj
@@ -13,14 +13,19 @@
(set! *warn-on-reflection* true)
+;; `-selectTriggerToAcquire` makes one call that can only be reflective; see the comment inside it.
+(set! *warn-on-reflection* false)
+
(defn -selectTriggerToAcquire
"gen-class override: acquire triggers with this node's queue-affinity predicate baked into the query
(see [[metabase.mq.quartz-affinity/select-trigger-to-acquire]]), rather than Quartz's unfiltered scan."
;; `(.superRtp this ...)` is a reflective call: `superRtp` is the gen-class's own exposed super
;; method, so it only exists on the class this very namespace generates — `this` can't be type-hinted
;; with that class at its own compile time (it isn't defined yet). The reflection is therefore
- ;; unavoidable here and harmless (one call per trigger-acquire query); this shim ns is excluded from
- ;; Eastwood's reflection linter in deps.edn for the same reason.
+ ;; unavoidable here and harmless (one call per trigger-acquire query), so warnings are off around this
+ ;; one form.
[this conn no-later no-earlier max-count]
(quartz-affinity/select-trigger-to-acquire conn no-later no-earlier max-count
(fn [sql] (.superRtp this sql))))
+
+(set! *warn-on-reflection* true)
diff --git a/src/metabase/mq/quartz_affinity_delegate_std.clj b/src/metabase/mq/quartz_affinity_delegate_std.clj
index 161f4967545..beed8d84cb0 100644
--- a/src/metabase/mq/quartz_affinity_delegate_std.clj
+++ b/src/metabase/mq/quartz_affinity_delegate_std.clj
@@ -15,14 +15,19 @@
(set! *warn-on-reflection* true)
+;; `-selectTriggerToAcquire` makes one call that can only be reflective; see the comment inside it.
+(set! *warn-on-reflection* false)
+
(defn -selectTriggerToAcquire
"gen-class override: acquire triggers with this node's queue-affinity predicate baked into the query
(see [[metabase.mq.quartz-affinity/select-trigger-to-acquire]]), rather than Quartz's unfiltered scan."
;; `(.superRtp this ...)` is a reflective call: `superRtp` is the gen-class's own exposed super
;; method, so it only exists on the class this very namespace generates — `this` can't be type-hinted
;; with that class at its own compile time (it isn't defined yet). The reflection is therefore
- ;; unavoidable here and harmless (one call per trigger-acquire query); this shim ns is excluded from
- ;; Eastwood's reflection linter in deps.edn for the same reason.
+ ;; unavoidable here and harmless (one call per trigger-acquire query), so warnings are off around this
+ ;; one form.
[this conn no-later no-earlier max-count]
(quartz-affinity/select-trigger-to-acquire conn no-later no-earlier max-count
(fn [sql] (.superRtp this sql))))
+
+(set! *warn-on-reflection* true)
diff --git a/test/metabase/linters/common.clj b/test/metabase/linters/common.clj
deleted file mode 100644
index 82e9994942c..00000000000
--- a/test/metabase/linters/common.clj
+++ /dev/null
@@ -1,14 +0,0 @@
-(ns metabase.linters.common
- (:require
- [clojure.java.classpath :as classpath]
- [clojure.string :as str]))
-
-(set! *warn-on-reflection* true)
-
-(defn source-paths
- "Find all the Metabase Clojure source and test paths to lint."
- []
- (filter (fn [^java.io.File file]
- (and (.isDirectory ^java.io.File file)
- (not (str/ends-with? (.getName file) "resources"))))
- (classpath/system-classpath)))
diff --git a/test/metabase/linters/eastwood.clj b/test/metabase/linters/eastwood.clj
deleted file mode 100644
index 524ecf11891..00000000000
--- a/test/metabase/linters/eastwood.clj
+++ /dev/null
@@ -1,30 +0,0 @@
-(ns metabase.linters.eastwood
- (:require
- [eastwood.lint :as eastwood]
- [metabase.linters.common :as common])
- (:import (java.io File)))
-
-(set! *warn-on-reflection* true)
-
-(defn eastwood
- "Entrypoint for running Eastwood from the CLI. Adds some programatically-determined config options. See comments in
- `deps.edn` for usage instructions."
- [options]
- (eastwood/eastwood-from-cmdline
- (merge
- {:source-paths (common/source-paths)}
- options)))
-
-(defn eastwood-tests
- "Entry-point for the :eastwood/test alias. Derives :source-paths from classpath directories
- whose basename is `test` so we don't have to hardcode the per-driver test paths in deps.edn —
- they're already on the classpath via :drivers-dev's :extra-paths. Excludes `.clj-kondo/test`,
- which is for clj-kondo hook tests and uses a different toolchain."
- [options]
- (eastwood/eastwood-from-cmdline
- (merge
- {:source-paths (filterv (fn [^File f]
- (and (= "test" (.getName f))
- (not= ".clj-kondo" (some-> (.getParentFile f) .getName))))
- (common/source-paths))}
- options)))