Manifest Checks: Macros#
Note
The below checks require manifest.json
to be present.
Classes:
Name | Description |
---|---|
CheckMacroArgumentsDescriptionPopulated |
Macro arguments must have a populated description. |
CheckMacroCodeDoesNotContainRegexpPattern |
The raw code for a macro must not match the specified regexp pattern. |
CheckMacroDescriptionPopulated |
Macros must have a populated description. |
CheckMacroMaxNumberOfLines |
Macros may not have more than the specified number of lines. |
CheckMacroNameMatchesFileName |
Macros names must be the same as the file they are contained in. |
CheckMacroPropertyFileLocation |
Macro properties files must follow the guidance provided by dbt here. |
CheckMacroArgumentsDescriptionPopulated
#
Macro arguments must have a populated description.
Receives at execution time:
Name | Type | Description |
---|---|---|
macro |
Macros
|
The Macros object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the macro path. Macro paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the macro path. Only macro paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
# Only "common" macros need to have their arguments populated
manifest_checks:
- name: check_macro_arguments_description_populated
include: ^macros/common
Source code in src/dbt_bouncer/checks/manifest/check_macros.py
CheckMacroCodeDoesNotContainRegexpPattern
#
The raw code for a macro must not match the specified regexp pattern.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
regexp_pattern
|
str
|
The regexp pattern that should not be matched by the macro code. |
required |
Receives at execution time:
Name | Type | Description |
---|---|---|
macro |
Macros
|
The Macros object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the macro path. Macro paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the macro path. Only macro paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
# Prefer `coalesce` over `ifnull`: https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.rules.sphinx.Rule_CV02
- name: check_macro_code_does_not_contain_regexp_pattern
regexp_pattern: .*[i][f][n][u][l][l].*
Source code in src/dbt_bouncer/checks/manifest/check_macros.py
CheckMacroDescriptionPopulated
#
Macros must have a populated description.
Receives at execution time:
Name | Type | Description |
---|---|---|
macro |
Macros
|
The Macros object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the macro path. Macro paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the macro path. Only macro paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
# Only "common" macros need to have a populated description
manifest_checks:
- name: check_macro_description_populated
include: ^macros/common
Source code in src/dbt_bouncer/checks/manifest/check_macros.py
CheckMacroMaxNumberOfLines
#
Macros may not have more than the specified number of lines.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_number_of_lines
|
int
|
The maximum number of permitted lines. |
required |
Receives at execution time:
Name | Type | Description |
---|---|---|
macro |
Macros
|
The Macros object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the macro path. Macro paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the macro path. Only macro paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_macros.py
CheckMacroNameMatchesFileName
#
Macros names must be the same as the file they are contained in.
Generic tests are also macros, however to document these tests the "name" value must be preceded with "test_".
Receives at execution time:
Name | Type | Description |
---|---|---|
macro |
Macros
|
The Macros object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the macro path. Macro paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the macro path. Only macro paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_macros.py
CheckMacroPropertyFileLocation
#
Macro properties files must follow the guidance provided by dbt here.
Receives at execution time:
Name | Type | Description |
---|---|---|
macro |
Macros
|
The Macros object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the macro path. Macro paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the macro path. Only macro paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):