Skip to main content

Configuring the Style Validator

Configure the Style Validator for your project by placing a file called lkmlstyle.yaml in the root of your project's repository.

Here's an example file that covers the different sections you can define.

# To use this in your own project, copy it to the root of your LookML project's
# repo and change the name of the file to `lkmlstyle.yaml`.
# The Style Validator will automatically configure itself from this file.

# The codes of rules you'd like to test, excluding all others.
# Find all predefined rule codes here:
# https://docs.spectacles.dev/app/reference/style-validator-rules/
select:
- D100
- D101
- D107
- D200
- D301
- I100
- M100
- J100
- V111

# If you'd rather test everything by default, ignoring specific codes,
# put the codes of rules here that you'd like to ignore.
# ignore: [D106, D107]

# Override the top-level configuration with modifications
# for specific files or directories.
file_overrides:
- path: views/ecommerce
select: [D301, V100]
- path: views/orders.view.lkml
ignore: [I100]

# If a rule's code already exists in the default rules,
# the custom rule will override the default rule
# Read more about custom rules here:
# https://docs.spectacles.dev/app/reference/custom-style-rules/
custom_rules:
- title: Name of count measure doesn't start with 'c_'
code: M100
rationale: >
You should explicitly state the aggregation type in the dimension name
because it makes it easier for other developers and Explore users
to understand how the measure is calculated.
select:
- measure
filter:
- type: ParameterFilter
parameter_name: type
value: count
type: PatternMatchRule
regex: "^c_"