Lint your LookML with lookmlint!

develop

(Ryan Tuck) #1

lookmlint

I just open-sourced lookmlint, a linter I built for LookML.

lookmlint is a configurable CLI that runs various checks on your LookML repo to catch style issues, unused views, semicolons in derived table SQL, raw SQL references in joins, and more.

We use it internally here at Warby Parker as part of our CI process, ensuring all lint checks have passed before merging in PRs.

It’s written in python and is available via pip:

$ pip install lookmlint

Under the hood, this tool leverages (and was inspired by) the excellent lookml-parser CLI, written by @fabio - thanks!

usage

Specify checks to run against your lookml repo:

$ lookmlint lint ~/src/lookmlint/examples/sample_repo/ --checks label-issues,views-missing-primary-keys
Error:


label-issues
------------
Fields:
  View: order_items
    - Qty: ['Qty']
    - Unit Cost Usd: ['USD']


views-missing-primary-keys
--------------------------
- order_items

Output as JSON:

$ lookmlint lint ~/src/lookmlint/examples/sample_repo/ --checks label-issues --json
{
    "label-issues": {
        "fields": {
            "order_items": {
                "Qty": [
                    "Qty"
                ],
                "Unit Cost Usd": [
                    "USD"
                ]
            }
        }
    }
}

Or run all checks:

$ lookmlint lint ~/src/lookmlint/examples/sample_repo/
Error:


duplicate-view-labels
---------------------
Model: test
  Explore: inventory_transfers
    Inventory Locations: 2


label-issues
------------
Fields:
  View: order_items
    - Qty: ['Qty']
    - Unit Cost Usd: ['USD']
...

Please feel free to give it a whirl, and bubble up any feedback here or over on github. Happy linting!


(fabio) #2

Thanks for the shoutout and for building something awesome! A colleague and I are actually working on a linter of our own as well :slight_smile: We’re just a week or two away from sharing it.


(Ryan Tuck) #3

of course - looking forward to checking it out!


(Izzy) #4

This is super cool! Thanks for making it open source for everyone to use :slight_smile:


(longfei) #5

Great! Fabio, any news on the linter of your own?


(fabio) #6

We’re still working on the documentation around how to deploy it with Github & CI (Jenkins), but the linter itself is ready if you want to preview it: https://github.com/fabio-looker/look-at-me-sideways . Be warned though, our ruleset is quite opinionated!


(longfei) #7

Thanks Fabio, very exciting. Looking forward when it’s all ready to go!