checksit.specs
Load and parse specs and run spec checks.
Class and functions to handle loading and printing of specs, and running checks defined in specs.
Functions
|
Loads specs into dictionary. |
|
Print out information on specs. |
Classes
|
Manage checks from spec files. |
- class checksit.specs.SpecificationChecker(spec_id: str)[source]
Manage checks from spec files.
Load spec from file and run the checks against record.
- spec_id
Name of spec file.
- spec
Spec loaded in as dictionary.
- run_checks(record: Dict[str, Dict[str, str] | Dict[str, Dict[str, str]] | str], skip_spellcheck: bool = False) Tuple[List[str], List[str]][source]
Runs checks in spec against record.
Takes the record of a file, as produced by the to_dict() function from the file parser, and checks it against the checks specified in the spec file.
- Parameters:
record – dictionary of file content from file parser to_dict() function.
skip_spellcheck – Skip the spellcheck in rules and functions that utilise spell checking.
- Returns:
List of errors and list of warnings from all spec file checks.
- checksit.specs.load_specs(spec_ids: List[str] | None = None) Dict[str, Dict[str, Dict[str, str | Dict[str, Any]]]][source]
Loads specs into dictionary.
For a given list of spec file names, appends the specs directory (by default “specs/groups”) and loads all specs. If no specs are given, all specs in the specs directory (but not in subdirectories) are loaded.
- Parameters:
spec_ids – names of spec files to load
- Returns:
Dictionary of loaded specs.
- checksit.specs.show_specs(spec_ids: List[str] | None = None) None[source]
Print out information on specs.
For a given list of spec file names, prints the specs to output. If no spec file name is given, all specs in the spec directory (by default “specs/groups”), but not in subdirectories, are printed.
- Parameters:
spec_ids – name of spec files to print