• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A style guide and linter for Looker's LookML data modeling language

Look At Me Sideways (LAMS)

>_>

LAMS is a style guide and linter for Looker's LookML data modeling language. It is designed to help a team of developers to produce more maintainable LookML projects.

  • The style guide alone can help your project, even without enforcement by the linter.
  • The linter comes with a number of built-in rules from the style guide.
  • The linter also allows you to conveniently specify custom rules to enforce.
  • The linter can be deployed to enforce rules for all commits to your master branch.

Interested? See a video of LAMS in action!

LAMS video

Contents

Functionality & Features

Built-in Linter Rules

The linter comes with built-in rules that can enforce rules K1-4, F1-4, E1-2, T1-2, and W1 from the style guide.

As of LAMS v3, you must opt-in via your manifest.lkml file to use the built-in rules. Here is an example declaration opting in to all the currently available built-in rules:

#LAMS
#rule: K1{} # Primary key naming
#rule: K3{} # Primary keys first
#rule: K4{} # Primary keys hidden
#rule: K7{} # Provide one `primary_key`
#rule: K8{} # `primary_key` uses PK dims
#rule: F1{} # No cross-view fields
#rule: F2{} # No view-labeled fields
#rule: F3{} # Count fields filtered
#rule: F4{} # Description or hidden
#rule: E1{} # Join with subst'n operator
#rule: E2{} # Join on PK for "one" joins
#rule: E6{} # FK joins are m:1
#rule: E7{} # Explore label 25-char max
#rule: T1{} # Triggers use datagroups 
#rule: T2{} # Primary keys in DT
#rule: W1{} # Block indentation
#rule: W1{} # Block indentation

Custom Rules

In addition to linting against its style guide, LAMS also lets you specify your own rules. See Customizing LAMS.

Rule Exemptions

You can opt-out of rules granularly by locally specifying rule_exemptions.

The rule exemption syntax encourages developers to document the reason for each such exemption:

view: rollup {
  sql_table_name: my_table ;;

  #LAMS
  #rule_exemptions: {
  #  K3: "2018-11-12 - Bob said it's ok"
  #}
  dimension: info {...}
  ...

(BETA) You can also opt-out of rules granularly from a centrally maintained lams-exemptions.ndjson file. Simply specify the rule name and location to exempt in a series of newline-terminated JSON objects:

{"rule":"K3","location":"model:my_model/view:rollup"}
{"rule":"K3","location":"model:my_other_model/view:foo"}

You may also apply rule_exemptions globally in your project.manifest, but this is generally unnecessary as of LAMS v3.

Output

Once LAMS has evaluated your project against the necessary rules, the resulting list of messages are communicated back to you through one of several output modes.

The default mode is a human-readable tabble logged to the command line / stdout, where each line represents a distinct message:

"Lines" output example

Another available output mode is formatting the messages into a markdown file in your project, so that they can be viewed in Looker's IDE. Here is an example of a resulting markdown file as displayed in Looker:

"Markdown" output example

Deployment Examples

Although LAMS can be deployed in many ways to fit your specific CI flow, we have put together a few examples and resources to get you up and running quicker. (If you'd like to contribute your configuration, get in touch!)

Regardless of which example you follow, we recommend pinning your LAMS version to a particular major version.

  • Local Interactive Usage - To use LAMS with the least overhead for simple interactive local use and testing:
npm install -g @looker/look-at-me-sideways@3
cd <your-lookml-project>
lams
  • Github Action - This option is very quick to get started if you're using Github, and offers a compromise between convenience of setup and per-commit run performance.

The following examples were prepared for v1 of LAMS, though updating them for v2+ should be straightforward. Please review v2 release notes for details. In particular, look for error messages on the console's standard output rather than a file output to be committed back to the repo.

  • GitLab CI - A community-contributed configuration for GitLab, which offers similarly low overhead as our dockerized Jenkins configuration
  • Dockerized Jenkins Server - We have provided a Docker image with an end-to-end configuration including a Jenkins server, LAMS, and Github protected branches & status checks configuration.
  • CircleCI - A community-contributed configuration for CircleCI (external link)

Configuration

Command-line arguments

  • reporting - Required. One of yes, no, save-yes, or save-no. See PRIVACY.md for details.
  • report-user - An email address to use in reporting. See PRIVACY.md for details.
  • report-license-key - A Looker license key to use in reporting. See PRIVACY.md for details.
  • output - A comma-separated string of output modes from among: lines (default), markdown, markdown-developer, jenkins, legacy-cli, or (BETA) add-exemptions
  • source - A glob specifying which files to read. Defaults to **/{*.model,*.explore,*.view,manifest}.lkml.
  • cwd - A path for LAMS to use as its current working directory. Useful if you are not invoking lams from your LookML repo directory.
  • project-name - An optional name for the project, used to generate links back to the project in mardown output. Specifying this in manifest.lkml is preferred.
  • manifest - A JSON-encoded object to override any properties that are normally set via the manifest.lkml file.
  • on-parser-error - Set to "info" to indicate that LookML parsing errors should not fail the linter, but yield an info level message instead (not all output modes display info level messages)
  • verbose - Set to also output verbose level messages, for output modes that support it (lines)
  • date-output - Set to "none" to skip printing the date at the top of the issues.md file.
  • allow-custom-rules - Experimental and not recommended. Used to approve the running of Javascript-based custom rules. DO NOT USE TO RUN UNTRUSTED CODE. See custom rules for details.

Manifest.lkml arguments

If your LookML project doesn't have a manifest.lkml file, you may want to consider adding one! LAMS uses the following information from your project's mainfest.lkml file:

  • name - Recommended. A name for the project, used to generate links back to the project in mardown output. If the native LookML validator complains about an unnecessary project name, you can use a conditional #LAMS comment to specify it.
  • rule: rule_name - Recommended. Used to opt-in to built-in rules and to specify custom rules. See customizing LAMS
  • rule_exemptions - Optional. Originally used in 1 & v2 to opt-out of rules globally. A global opt-out can still be useful for opting-out of certain "sub rules" that a rule may return without opting-out of the entire rule. See customizing LAMS

About

Release Notes

Privacy Policy

LAMS respects user privacy. See PRIVACY.md for details.

License

LAMS is Copyright (c) 2023 Looker Data Sciences, Inc. and is licensed under the MIT License. See LICENSE.txt for license details.

Support

LAMS is NOT officially supported by Looker. Please do not contact Looker support for issues with LAMS. Issues may be reported via the Issues tracker, but no SLA or warranty exists that they will be resolved.

Authors

LAMS has primarily been developed by Joseph Axisa and Fabio Beltramini. See all contributors

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/looker-open-source/look-at-me-sideways.

Trying to install LAMS for development?

git clone [email protected]:looker-open-source/look-at-me-sideways.git
cd look-at-me-sideways
mv npm-shrinkwrap.dev.json npm-shrinkwrap.json 
npm install

Publishing an update? The following hooks will run:

npm version {minor|major|patch}
> Pre-verion: npm run lint-fix
> Pre-verion: npm run test

npm publish
> Pre-publish: npm shrinkwrap
> Pre-publish: mv npm-shrinkwrap.json npm-shrinkwrap.dev.json
> Pre-publish: npm prune --prod
> Pre-publish: npm shrinkwrap

Code of Conduct

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributer Covenant Code of Conduct. Concerns or incidents may be reported confidentially to [email protected].

Other LookML Linting Projects

Interested in LookML linting but looking to shop around a bit? The community has come up with a few other options:

Or if you want to write your own, you may want to start with one of these LookML parsers:

>_>

More Repositories

1

sdk-codegen

One SDK to rule them all, and in the codegen bind them
TypeScript
231
star
2

gzr

A Command Line Tool for Looker Content Management
Ruby
120
star
3

looker-explore-assistant

A React Application for interacting with Looker data through natural language.
TypeScript
93
star
4

henry

A command line tool for Looker instance cleanup
Python
81
star
5

extension-gen-ai

Looker Extension GenAI - using LLMs to make exploration easier and getting dashboard insights
TypeScript
71
star
6

lookr

An R library for the Looker API (4.0)
R
71
star
7

embed-sdk

The Looker browser embedding SDK
TypeScript
70
star
8

actions

TypeScript
58
star
9

components

Looker's UI Components, Design Infrastructure and more
HTML
50
star
10

looker_deployer

A tool to help deploy objects from one Looker instance to another
Python
45
star
11

pylookml

A pythonic api for automatic lookml
Python
41
star
12

sdk-examples

Example source code and projects for the Looker SDKs
Swift
40
star
13

customer-scripts

customer scripts
Shell
36
star
14

dashboard-summarization

TypeScript
22
star
15

extension-examples

Examples and templates for use with the Looker Extension Framework.
JavaScript
22
star
16

block-cortex-sap

Cortex - Order to Cash and Finance
LookML
21
star
17

bqjdbc

Fork of Starschema's JDBC driver for BigQuery. https://code.google.com/p/starschema-bigquery-jdbc/
Java
19
star
18

admin_power_pack

TypeScript
17
star
19

LookerEmbedReference

Examples of how to embed Looker into a web application
JavaScript
16
star
20

app-lookml-diagram

An "ERD for LookML". Now available for download on the Looker Marketplace.
TypeScript
15
star
21

looker-sdk-ruby

Looker SDK for Ruby
Ruby
14
star
22

app-ml-accelerator

Looker extension designed to give business users access to BigQuery and Vertex AI's machine learning capabilities.
LookML
12
star
23

viz-report-table-marketplace-open-source

JavaScript
11
star
24

extension-template-react

TypeScript
11
star
25

looker-scim-proxy

TypeScript
9
star
26

extension-api-explorer

LookML
9
star
27

app-data-dictionary

TypeScript
8
star
28

micro-admin-for-looker

JavaScript
8
star
29

looker-load-testing

locust-based realbrowser load testing for looker instances
Python
8
star
30

lmanage

Python
8
star
31

vertex-ai-actions

Python
7
star
32

chatty

A simple iframe host/client channel manager
TypeScript
7
star
33

github_actions_looker_cicd

This is a repo that walks through the process on how to enable Github actions to automate a basic LookML testing suite.
7
star
34

bqml-actions

BigQuery ML Actions using Google Cloud Functions for Looker
Python
6
star
35

component-examples

JavaScript
6
star
36

block-google-cloud-billing

Ticket # 200225073
LookML
6
star
37

healthcare_demo

This repo contains the LookML for the model and dashboards used with the FHIR healthcare dataset to showcase how Looker can add value to healthcare providers
LookML
6
star
38

viz-force_directed_graph-marketplace

TypeScript
5
star
39

looker-demo-dashboard-match

A Looker Extension Showcasing the Looker API Paired with Generative AI, Powering a Dashboard Search/Recommendation App
TypeScript
5
star
40

custom-action-hub-example

A template for building a custom Looker action hub with your own actions.
TypeScript
5
star
41

themis

Automate health reporting and bring order in your Looker instance
Python
5
star
42

looker-query-insights

JavaScript
5
star
43

extension-template-kitchensink

TypeScript
5
star
44

custom-viz-builder

JavaScript
4
star
45

block-cortex-salesforce

LookML
4
star
46

looker_content_observer

A command line tool for automated checking of dashboards and looks across instances and branches
Python
4
star
47

app-ml-accelerator-src

TypeScript
3
star
48

bqml_semantic_search_block

LookML
3
star
49

marketing_demo

LookML
3
star
50

cluster_terraform

HCL
3
star
51

block-cortex-demand-sensing

LookML
3
star
52

block-multicloud-billing-dashboard

LookML
3
star
53

block-cloud-armor

LookML
2
star
54

ecomm_demo

LookML
2
star
55

block-workspace-audit-logs

LookML
2
star
56

supermetrics_partner

LookML
2
star
57

google_cloud_focus

LookML
2
star
58

block-cortex-meta

LookML
2
star
59

extension-template-redux

TypeScript
2
star
60

blocks_zendesk

LookML
1
star
61

dropbox_app

LookML
1
star
62

block-generate-text-llm

LookML
1
star
63

jk-sandbox

Sandbox for experimentation
Kotlin
1
star
64

block-new-bigquery-optimization-non-marketplace

LookML
1
star
65

google_adwords

LookML
1
star
66

create-looker-extension

Create Looker Extensions with zero manual configuration
JavaScript
1
star
67

snowflake-usage-block

LookML
1
star
68

block-multicloud-billing-bq-export

LookML
1
star
69

block-aws-billing

LookML
1
star
70

ga_360_new

LookML
1
star
71

extension-access-key-demo

TypeScript
1
star
72

datablocks-weathersource

LookML
1
star
73

google_ga360

LookML
1
star
74

block-cortex-sfmc

LookML
1
star
75

thelookevent

LookML
1
star