A style guide and linter for Looker's LookML data modeling language
View the Project on GitHub looker-open-source/look-at-me-sideways
V3 of LAMS is a big change that brings on board many of the underlying LookML Parser’s output options that have accumulated over time: whitespace awareness, extension/refinement support, a simplified file representation, and imported project support.
The broad overhaul that this required for built-in rules also presented an opportunty. Many of the built-in rules have been made more streamlined and consistent. But, most importantly as of 3.0, built-in rules will be opt-in rather than opt-out. These two changes will greatly improve the ability to publish new built-in rules and patch existing built-in rules without unduly burdening existing LAMS users.
As a result, users upgrading to 3.0 should expect to paste a simple declaration into their manifest to opt-in to each built-in rule.
Beyond that rote change, the primary impact will be to LAMS users who have implemented custom rules, who may have to update their rules for the updated LookML representations.
Usage of LAMS that only uses the built-in style guide rules should not see a large impact, except that some rules may now work correctly based on extensions/refinements, whereas they may have thrown “false positive” errors previously because the parser did not apply any extensions/refinements.
model
construct. The file
construct continues to provide the lexical / “as written” representation.$strings
property within each object. An initial built-in rule pertaining to whitespce, W1, is also included in the initial release as an example.$strings
whitespace data is now available#LAMS
declarations, like rule: F1 {}
to opt-in to a rule. A sample declaration to opt-in to all rules is provided in the readme.[A-Z][0-9]+
are nominally reserved for built-in rules, if you’ve written a custom rule whose name overlaps with a built-in rule, you can mark the rule as custom: yes
to disambiguate.T2
. You may still apply exemptions for individual sub-rules if you wish, though in some cases, dependencies between the sub-rules means that not all parts of the rule will always be evaluated.jsonpath
, which was rarely maintained, to jsonpath-plus
. This is primarily to address the old library’s failure to correctly match union expressions, which were a common use case for expressions like $.model.*['dimension','measure'].*
For any error not detailed below, please submit an issue!
$.files.*
to $.file.*
. Note that the path/location will now contain the filename.This update introduces, as beta features, centrally managed exemptions, and an add-exemptions
output mode. Together, these features serve to enable incremental linting use cases.
Feedback on these beta features and the overall incremental linting use case is welcome in issue #142.
lams-exemptions.ndjson
in a newline-delimited JSON format.output=add-exemptions
can append any errors from the current run as new exemptions in the lams-exemptions.ndjson
file.New rules available. Make sure to add them to your manifest.lkml to opt-in. An updated sample snippet to opt-in to all rules is provided on the main README page.
primary_key
. K7 detailsprimary_key
must be or use PK-named dimension(s). K8 detailsforeign_key
-based joins are many_to_one. E6 detailsPatches:
LookML Dashboards are now supported. This functionality is disabled by default. To enable it, also install js-yaml
, and including dashboard file pattern into your source
argument. (Note: no built-in rules currently relate to dashboards, but you may apply custom rules to them)
allow_exemptions
argument for rules to specify if they do not want to allow exemptionsrule_exemptions: {rule: "reason"}
syntax is still supported, though no longer emphasizedPatches:
v3.4.0 had introduced a change in behavior at the intersection of conditional comments and whitespace rule W1. Since whitespace behavior for conditional comments had not been formally defined or desrcribed, this release defines the conditional comment whitespace handling going forward, primarily chosen to mirror the in-Looker IDE behavior when a block is commented via the Ctrl+/ shortcut. Conditional comments will preserve the whitespace before the comment, consume the comment character and up to one space or tab character following the comment character and/or conditional comment token.
/
) pathoptions
Patches:
⚡ icons below indicate breaking changes.
github-job-summary
for GitHub usersonParserError
option was removed. Parsing errors now always result in error-level messages. For use cases where parsing errors should be ignored, users can instead use global or central exemptions on rules P0 and P1.model
object inserted into the top-level of model files (i.e., under the file
object). For example, previously, the output may have contained a path like $.file['my_model.model'].model.my_model.explore.foo
, and would now simply contain a path like $.file['my_model.model'].explore.foo
. Any custom rules that attempted to match this previous construct should be updated. That said, I expect most use cases will instead use the top-level (non-file) model
object, rather than the file
object.path
argument./
or :
characters, which notably may be present in file paths. All path elements in location
properties must now escape any /
, :
, or \
characters with a preceding backslash (\
)