About Spectacles
March 8, 2023

Introducing the Style Validator

Headshot of Spectacles co-founder Josh Temple
Josh Temple
Co-Founder, Spectacles
A very stylish robot wearing fashionable sunglasses and a futuristic dress.

Code review just got way faster.

We’re thrilled to announce a brand new validator: our latest addition to the Spectacles suite of developer tools for LookML. The Style Validator is a linter and style checker for LookML.

Say goodbye to dimensions without descriptions, Explores without labels, and views without primary keys. Flag bad practices like views referencing the same underlying table, joins without relationships, or wildcard include statements. Encourage naming conventions like snake-casing or prefixes for measure names.

Why is this important? We believe that a Looker project that enforces style standards is…

  • Faster for developers to navigate, upgrade, and maintain
  • More thoroughly documented and business user-friendly
  • More resilient to bugs and mistakes caused by code ambiguity or misunderstandings
A screenshot of the Spectacles Style Validator
The Style Validator in action.

Let me show you why we’re proud of this new validator and make the case for turning it on for your projects today!

Get started quickly

Quickly assemble your own style guide from our catalog of 20+ predefined rules. We’ve scoured the Internet for style guides and consulted with our partners (including Google) to understand what style means to the most sophisticated Looker teams.

Customize and create rules your team cares about

We’ve defined plenty of rules to get you started, but you can always modify our predefined rules or create your own rules in a flexible YAML-based format.

Want to force every new SQL derived table to contain a comment that says “I’m sorry I made this”? You can do that.

custom_rules:
  - title: No apology found for new derived table
    code: V204
    rationale: >
      Adding more SQL derived tables makes us sad. If you're going to do it anyway,
      you should feel bad for making us sad and this tells us that you do.
    type: PatternMatchRule
    select: view.derived_table.sql
    regex: '^-- I''m sorry I made this'

Configure the Style Validator with a YAML file in your Looker project’s repository so changes can be tracked and version controlled.

Check only new code without having to clean up your whole project

We love clean LookML, but we also recognize that cleaning up thousands of pre-existing style violations across a large project is a significant undertaking. If you’d rather save the mess for later, turn on incremental mode and Spectacles will only inspect new or changed LookML.

This way, you can be firm about stylistic standards for new LookML while relaxing the requirement for existing code.

Turn it on today!

If you prefer to watch rather than read, we've recorded a short demo explaining how the Style Validator works and how to set it up.

If you'd prefer to read, we’ve added a section to our Validators docs tutorial that describes how to enable the Style Validator. You’ll need to add a deploy key to your repo so we can read your LookML and add a configuration file to the root of your LookML project. Don’t worry, we cover it all in the tutorial.

As always, we’re eager to hear what you think. Love it? Hate it? Let us know via in-app chat, on Twitter, or by sending us an email at support@spectacles.dev.

Stop stressing about Looker today

Spectacles saves you hours of bug-fixing and boosts confidence in your Looker dashboards. Book a call with our Looker experts to find out how!