Skip to content
Snippets Groups Projects
Unverified Commit 495106ff authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Bump Kondo version to 2024.08.29 (#47418)

* Bump Kondo version to 2024.08.29

* Fix Kondo warnings from new version of Kondo

* Fix failing tests because schema was broken
parent 69d61c2c
No related branches found
No related tags found
No related merge requests found
......@@ -411,7 +411,7 @@
;; Use this to only run Kondo against specific files.
:kondo
{:replace-deps
{clj-kondo/clj-kondo {:mvn/version "2024.08.01"}}
{clj-kondo/clj-kondo {:mvn/version "2024.08.29"}}
:main-opts
["-m" "clj-kondo.main"]}
......
......@@ -12,13 +12,15 @@
(set! *warn-on-reflection* true)
(mu/defn- valid-now? [token :- premium-features/TokenStatus] :- :boolean
(mu/defn- valid-now? :- :boolean
[token :- premium-features/TokenStatus]
(t/before? (t/instant) (t/instant (:valid-thru token))))
(defn- token? [token]
(and token (str/starts-with? token "airgap_")))
(mu/defn- pubkey-reader ^Reader [] :- [:maybe (ms/InstanceOfClass Reader)]
(mu/defn- pubkey-reader :- [:maybe (ms/InstanceOfClass Reader)]
^Reader []
(when-let [pubkey-resource (io/resource "airgap/pubkey.pem")]
(io/reader pubkey-resource)))
......
......@@ -201,11 +201,11 @@
"table" 4
"collection" 5})
(mu/defn get-popular-items-model-and-id
(mu/defn get-popular-items-model-and-id :- [:sequential recent-views/Item]
"Returns the 'popular' items for the current user. This is a list of 5 items that the user has viewed recently.
The items are sorted by a weighted score that takes into account the total count of views, the recency of the view,
whether the item is 'official' or 'verified', and more."
[] :- [:sequential recent-views/Item]
[]
;; we do a weighted score which incorporates:
;; - total count -> higher = higher score
;; - recently viewed -> more recent = higher score
......
......@@ -176,14 +176,18 @@
[:model [:enum :dataset :card :metric :dashboard :collection :table]]
[:can_write :boolean]
[:timestamp :string]]
;; database_id was commented out below because this schema was not actually being used correctly
;; by [[metabase.api.activity/get-popular-items-model-and-id]] and when I fixed it in #47418
;; [[metabase.api.activity-test/popular-items-test]] started failing because things don't actually come back with
;; database IDs... commented out for now until someone gets a change to look at this. -- Cam
[:multi {:dispatch :model}
[:card [:map
[:display :string]
[:database_id :int]
#_[:database_id :int]
[:parent_collection ::pc]
[:moderated_status ::verified]]]
[:dataset [:map
[:database_id :int]
#_[:database_id :int]
[:parent_collection ::pc]
[:moderated_status ::verified]]]
[:metric [:map
......@@ -195,7 +199,7 @@
[:display_name :string]
[:table_schema [:maybe :string]]
[:database [:map
[:id [:int {:min 1}]]
#_[:id [:int {:min 1}]]
[:name :string]]]]]
[:collection [:map
[:parent_collection ::pc]
......
......@@ -134,9 +134,9 @@
;;;;;;;;;;;;;;;;;;;; Airgap Tokens ;;;;;;;;;;;;;;;;;;;;
(declare decode-airgap-token)
(mu/defn max-users-allowed
(mu/defn max-users-allowed :- [:maybe pos-int?]
"Returns the max users value from an airgapped key, or nil indicating there is no limt."
[] :- [:or pos-int? :nil]
[]
(when-let [token (premium-embedding-token)]
(when (str/starts-with? token "airgap_")
(let [max-users (:max-users (decode-airgap-token token))]
......
......@@ -619,7 +619,7 @@
[:verified {:optional true} [:maybe true?]]
[:ids {:optional true} [:maybe [:set ms/PositiveInt]]]])
(mu/defn search-context
(mu/defn search-context :- SearchContext
"Create a new search context that you can pass to other functions like [[search]]."
[{:keys [archived
created-at
......@@ -637,7 +637,7 @@
table-db-id
search-native-query
verified
ids]} :- ::search-context.input] :- SearchContext
ids]} :- ::search-context.input]
;; for prod where Malli is disabled
{:pre [(pos-int? current-user-id) (set? current-user-perms)]}
(when (some? verified)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment