linter package¶
Subpackages¶
- linter.rules package
- Subpackages
- linter.rules.fieldrules package
- Submodules
- linter.rules.fieldrules.all_caps_rule module
- linter.rules.fieldrules.count_name_rule module
- linter.rules.fieldrules.description_rule module
- linter.rules.fieldrules.drill_down_rule module
- linter.rules.fieldrules.lexicon_rule module
- linter.rules.fieldrules.yesno_name_rule module
- Module contents
- linter.rules.filerules package
- linter.rules.otherrules package
- linter.rules.fieldrules package
- Module contents
- Subpackages
Submodules¶
linter.field_rule module¶
abstract base / interface for a field rule
- Authors:
Carl Anderson (carl.anderson@weightwatchers.com)
-
class
linter.field_rule.
FieldRule
(config_dict=None)¶ Bases:
lkmltools.abstract_rule.AbstractRule
concept of a rule that is applied to some view field: dimension, dimension_group, or measure
-
name
()¶ name of the the rule
- Returns
name of the the rule
-
abstract
run
(lookml_field)¶ run the rule
- Parameters
lookml (LookMLField) – LookMLField instance
- Returns
tuple containing:
relevant (bool): is this rule relevant for this JSON chunk?
passed (bool): did the rule pass?
- Return type
(tuple)
-
linter.lookml_linter module¶
LookML linter: applies set of rules to some LookML file
- Authors:
Carl Anderson (carl.anderson@weightwatchers.com)
-
class
linter.lookml_linter.
LookMlLinter
(config)¶ Bases:
object
A LookML linter that lints a set of LookML files specified in some config using a set of rules, specified in same config
-
initialize_rules
(config)¶ create the set of rules, as specified in the config file
- Parameters
config (JSON) – the config
- Returns
nothing. side effect is to create internal list of file level rules and internal list of field level rules
-
other_rules_to_run
()¶ Get set of other rules to run
- Returns
set of names of rules
- Return type
out (set)
-
run
()¶ run the set of file and field-level rules against all files in the file glob
- Returns
nothing. Saves two CSV files, specified in the config
-
run_field_rules
(v, single_key, plural_key, simple_filepath, field_out)¶ - run the set of field-level rules against some json_data, that came from simple_filepath,
and append results to field_out list
- Parameters
v (JSON) – list of views
single_key (str) – e.g. dimension
plural_key (str) – e.g. dimensions
simple_fileapath (str) – path to some file
field_out (list) – list of results for field-level rules
- Returns
input field_out list with additional dictionary results
-
run_file_rules
(lookml, simple_filepath, file_out)¶ - run the set of file level rules against some json_data, that came from simple_filepath,
and append results to file_out list
- Parameters
lookml (LookML) – instance of LookML
simple_fileapath (str) – path to some file
file_out (list) – list of results for file-level rules
- Returns
input file_out list with additional dictionary results
-
write_field_csv
(df)¶ write field data to CSV :param df: dataframe :type df: pandas dataframe
- Returns
nothing. Writes data to CSV
-
write_file_csv
(df)¶ write file data to CSV
- Parameters
df (pandas dataframe) – dataframe
- Returns
nothing. Writes data to CSV
-
linter.rule module¶
abstract base / interface for a rule
- Authors:
Carl Anderson (carl.anderson@weightwatchers.com)
-
class
linter.rule.
Rule
(config_dict=None)¶ Bases:
lkmltools.abstract_rule.AbstractRule
concept of a rule that is applied to some LookML
-
name
()¶ name of the the rule
- Returns
name of the the rule
-