Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Oct 14, 2024
  2. Aug 26, 2024
  3. Aug 20, 2024
    • Cam Saul's avatar
      Test defn/defmacro exclamation point linter should also use `:parallel/disallowed` (#46943) · ee25e763
      Cam Saul authored
      * Kondo Config cleanup
      
      * Restore warnings for with-log-messages-for-level until #28827 is merged
      
      * Updated clojure.test hooks
      
      * Fix kondo warning
      
      * Test defn/defmacro exclamation point linter should also use :parallel/disallowed (part 1)
      
      * WIP
      
      * Time for me to learn to spell
      
      * Finish the cleanup
      
      * Remove code I was typing as an example
      
      * Fix renamed var
      
      * Fix the SAML tests
      
      * Fix Kondo warning
      Unverified
      ee25e763
  4. Aug 13, 2024
  5. Aug 05, 2024
    • Chris Truter's avatar
      Various hardenings for SQL analysis (#46432) · 39bb33ec
      Chris Truter authored
      ### Description
      
      This change should fix some explosions in stats due to phantom fields, while also making things a bit more rigorous.
      
      - Record the table schema in query_field - especially useful for unknown tables
      - Allow null table names in query_field - they might be phantoms, or they might not
        - We still have the option to filter them out in tools we build on top
      - Tighten up matching logic to consider schema
      Unverified
      39bb33ec
  6. Aug 01, 2024
  7. Jul 31, 2024
    • John Swanson's avatar
      Some improvements to the REST API for query field validation (#46024) · c4196d99
      John Swanson authored
      * Allow filtering on collection
      
      * Add `effective_ancestors` to collection data
      
      Note: I removed the `qv=` comparator. I think it'.s better to be more explicit
      about what exactly we're asserting. In particular, I hadn't updated the
      `:count` when we were filtering on collection type, so the count was
      still the total for *every* collection even though the results were being
      restricted by the collection. However the `qv=-data` function was still
      reporting that everything was OK, because it was accounting for other
      data from the App DB by just asserting that the count we'd specified was
      lower than the actual count. I'd argue it's better for tests to fail
      locally because I have garbage in my app DB (which I can clean up) than
      succeed when they really shouldn't.
      
      * Consolidate effective ancestors
      
      For the Search API, we're currently returning slightly different
      ancestors:
      
      - it never has the Root Collection, and
      
      - the ancestors don't have a `personal_owner_id`
      
      We could change the API (and maybe will soon - it seems pretty
      unexpected to have `effective_ancestors` sometimes act one way and
      sometimes act another) but for now we can just reshape things to look
      the same as they did before, while using the same code under the hood.
      Unverified
      c4196d99
  8. Jul 23, 2024
  9. Jul 18, 2024
  10. Jul 17, 2024
  11. Jul 10, 2024
  12. May 31, 2024
  13. May 10, 2024
  14. Apr 19, 2024
  15. Mar 20, 2024
  16. Mar 14, 2024
    • Tim Macdonald's avatar
      SQL Lineage: Track field usage, expose stale queries (#39707) · 3093f7c3
      Tim Macdonald authored
      * SQL Lineage: Create the QueryField model
      
      This links Cards (with native queries) to Fields, showing us which
      queries use which Fields.
      
      QueryFields are automatically maintained as part of the Card lifecycle
      
      Cards with stale queries (powered by QueryField info) are exposed via the `card?f=stale` API
      Unverified
      3093f7c3
  17. Mar 07, 2024
  18. Jan 22, 2024
  19. Jul 25, 2023
  20. Mar 22, 2023
    • Braden Shepherdson's avatar
      [MLv2] Fix `mu/defn` in CLJS · 61ba33e0
      Braden Shepherdson authored
      It's broken there because it tries to capture the Var returned by
      `defn` in a `let`. Vars aren't real in CLJS, so this doesn't work.
      The compile succeeds but the JS output is subtly broken.
      61ba33e0
  21. Mar 16, 2023
  22. Mar 13, 2023
  23. Feb 27, 2023
    • Braden Shepherdson's avatar
      [metabase-lib] Dev experience and CLJC infra improvements · 4580eab9
      Braden Shepherdson authored
      Dev experience:
      - CLJS now has source maps
      - Devtools extension renders CLJS data in Chrome (et al) Devtools
      - Use a debug build of CLJS in the tests
      - Fixed line numbers and breakpoints being off-by-one in Devtools
      
      CLJC infra:
      - More robust direct approach to JS<->CLJS conversions, powered by
        Malli transformers.
      - Powerful `define-getters-and-setters` macro to generate the accessors.
      4580eab9
  24. Feb 14, 2023
    • Braden Shepherdson's avatar
      [metabase-lib] PoC for wrapping JS objects with cljs-bean in CLJC · 4c15f80c
      Braden Shepherdson authored
      A `metabase.domain-entities.malli/defn` macro that (in CLJS) uses the
      schemas for the arguments to drive wrapping of vanilla JS objects for
      idiomatic use in CLJC code.
      
      See the first two functions in `metabase.domain-entities.queries.util`
      which get passed vanilla JS objects but can use them as CLJS maps.
      4c15f80c
  25. Feb 10, 2023
  26. Feb 02, 2023
  27. Jan 19, 2023
  28. Jan 18, 2023
  29. Jan 13, 2023
    • Braden Shepherdson's avatar
      [metabase-lib] Port date and time parsing and formatting to CLJC (#27551) · 335d161f
      Braden Shepherdson authored
      This adds a cross-platform date/time formatting library in CLJC, with
      (nearly) identical output in both JVM and JS environments.
      
      The only known difference is week numbers.
      
      CLJS (through Moment.js) has ordinal numbers, and renders the week
      number as "34th". Neither the JVM nor Clojure has a handy library for
      this (I'm sure it's out there somewhere, but it seems like a silly
      dep to add) so it renders week numbers as simply "34".
      
      Both platforms have date formatters that use pattern strings (eg.
      `"YYYY-MM-dd"`) to turn date/time objects into strings. There's a strong
      resemblance in how these work and what letters stand for what parts of
      the date and time, but they are far from identical.
      
      Rather than try to hackily convert one set of strings to another with
      regexes or other manipulations, this PR defines a set of names for
      fragments of dates (eg. `:year`, `:day-of-week-full`, `:hour-24-dd`)
      and includes functions to transform a list of these keys into a
      platform-specific format function.
      
      This is portable and transparent, and can be written in Clojure or
      JS code:
      
      ```clj
      [:year "-" :month-dd "-" :day-of-month-dd]   ; 2022-04-08
      [:month-full " " :day-of-month-d ", " :year] ; April 8, 2022
      [:hour-12-dd ":" :minute-dd " " :am-pm]      ; 7:52 AM
      ```
      
      ```js
      [":year", "-", ":month-dd", "-", ":day-of-month-dd"]   ; 2022-04-08
      [":month-full", " ", ":day-of-month-d", ", ", ":year"] ; April 8, 2022
      [":hour-12-dd", ":", ":minute-dd", " ", ":am-pm"]      ; 7:52 AM
      ```
      
      Note that the original code allowed an unrecognized `:date-style` string
      to be used directly as the formatting string. With the move to
      formatting data structures that no longer works. Instead there is a
      fixed map of format strings to the above data structures, that contains
      all the currently used `:date-style` inputs.
      
      If some caller needs a new format someday, we can either: (a) add the
      style to the map; or (b) pass the data structure form directly to the
      `:date-format` option, which if provided is used as the format.
      
      It's tempting to go to all the call sites and replace these `:date-style`
      strings with the new format structures. However, the strings are still
      embedded in the `:visualization_settings` in user appDBs, so we still
      need to recognize them.
      
      Most of the existing functions in the TS library have the same API.
      
      The set of allowed `:date-style` and `:time-style` values is turned into
      a type using `keyof`, so that we get precise type-checking of these
      values rather than simply `string`.
      
      One function has been dropped from the API: `getDateFormatFromStyle`.
      There was no practical way to implement it using the new format data
      structures. The only caller was the date format column settings, and it
      has been rewritten to use the formatted string for its sample date as
      its key instead.
      Unverified
      335d161f
  30. Sep 26, 2022
    • dpsutton's avatar
      Substitute persisted queries in parameter card references (#25610) · 1ebae228
      dpsutton authored
      * Substitute persisted queries in parameter card references
      
      ```sql
      select o.total, o.quantity, model_p.category, model_p.title
      from orders o
      left join {{#14-pg-products}} model_p -- reference to products model
      on o.product_id = model_p.id
      limit 4
      ```
      
      Testing:
      
      I'm unhappy with how verbose the test is. At some point we're going to
      need a better, standardized way to test persistence. But the test makes
      a persisted table of the test-data.categories
      table (test/metabase/test/data/dataset_definitions/test-data.edn). It
      runs some sql to update the values in the table to turn `"Winery"` ->
      `"Winery from cached table"`, joins the two tables together to have both
      at once.
      
      There's a lot of moving pieces and the setup is a bit verbose. There's
      also no obvious place where these types of tests should go. We'll need
      to consolidate them in the future (and extend them).
      
      * persisted macro
      
      * docstring for `persisted-info-native-query`
      
      * alignments and small nits
      
      * Reuse persistence macro
      
      * clj-kondo cleanups
      
      * remove clj-kondo change before rebase
      Unverified
      1ebae228
  31. Sep 22, 2022
  32. Aug 22, 2022
  33. May 19, 2022
    • Cam Saul's avatar
      `defsetting` setter functions should end in `!` (#22800) · 9dd96b3c
      Cam Saul authored
      * `defsetting` setter functions should end in `!`
      
      * Fix typo
      
      * Update .clj-kondo/hooks/metabase/models/setting.clj
      
      * Fix clj-kondo for Toucan defmodel not emitting a docstring
      
      * Remove `^:private` metadata on a couple of Settings since it makes Eastwood fussy
      Unverified
      9dd96b3c
  34. May 02, 2022
    • Braden Shepherdson's avatar
      One Clojure lint to rule them all (#22213) · 390d10e5
      Braden Shepherdson authored
      Background:
      
      We had two lint configs: lint-config.edn which was enfored by Github Actions, and
      .clj-kondo/config.edn, the default location used by editors.
      
      
      Problem:
      
      Patchy enforcement of the (larger) config in .clj-kondo/config.edn since not
      everyone uses an editor.
      
      Some new lint, like canonical namespace aliases (#21738, #19930) is not enforced
      automatically and has begun to bit-rot.
      
      Solution:
      
      Combine both configs, fix any outstanding lint, and update our tooling to use
      the unified config.
      
      Caveats:
      
      Anyone who has their local editor configured to use lint-config.edn will have
      their linting broken by this change.
      Unverified
      390d10e5
  35. Mar 04, 2022
  36. Feb 10, 2022
    • Michiel Borkent's avatar
      Linting improvements (#20424) · 8f119d64
      Michiel Borkent authored
      * honeysql var improvements
      
      * Define routes
      
      * Define routes
      
      * define-routes improvement
      
      * honeysql helpers
      
      * honesql
      
      * abs in clojure 1.11
      
      * fix logic unresolved vars
      
      * deprecated
      
      * deprecated var warnings
      
      * undo replace
      Unverified
      8f119d64
  37. Feb 03, 2022
  38. Jan 25, 2022
Loading