Lint your LookML with lookmlint!

  • 28 November 2018
  • 10 replies
  • 803 views

Userlevel 3

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 @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!


10 replies

Userlevel 7
Badge

Our linter is now officially launched too!

https://discourse.looker.com/t/introducing-lams-a-lookml-style-guide-and-linter/10603/2

Userlevel 7
Badge

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!

Userlevel 2

HI @Ryan_Tuck , do you have any step by step document on how to implement this linter in a Looker instance (using Github)?

Userlevel 3

of course - looking forward to checking it out!

Userlevel 7
Badge

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

Userlevel 7
Badge

Glad to hear it. At this point, the biggest help would be feedback - so let me know what about the linter works or doesn’t work for you!

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

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

Userlevel 7
Badge +1

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

@Ryan_Tuck @fabio Oh My God! Here in Youse we’re working on in a similar feature to improve the code quality. I’m very excited with the good news and let me know if you need any support/help

Reply