project_config.project module

High level logic for checking a project.

exception project_config.project.ConditionalsFalseResult[source]

Bases: project_config.project.InterruptCheck

A conditional must skip a rule.

exception project_config.project.InterruptCheck[source]

Bases: Exception

An action has reported an invalid context for a rule.

This exceptions prevents to continue executing subsecuents rules.

class project_config.project.Project(config_path: str, rootdir: str, reporter_: Dict[str, Any], color: bool, _actions_context: Optional[project_config.types.ActionsContext] = None, fix: bool = False, only_hints: bool = False)[source]

Bases: object

Wrapper for a single project.

This class encapsulates all the high level logic to execute all CLI commands against a project.

Its public method expose the commands that can be executed through the CLI.

Parameters
  • config_path (str) – Custom configuration file path.

  • rootdir (str) – Root directory of the project.

  • reporter (dict) – Reporter to use.

  • color (bool) – Colorized output in reporters.

  • fix (bool) – Fix errors.

_actions_context: Optional[project_config.types.ActionsContext] = None
_check_files_absence(files: Union[List[str], Dict[str, str]], rule_index: int) None[source]
_check_files_existence(files: List[Tuple[str, Any]], rule_index: int) None[source]
_load(fetch_styles: bool = True, init_tree: bool = True) None[source]
_process_conditionals_for_rule(conditionals: List[str], tree: project_config.tree.Tree, rule: project_config.types.Rule, rule_index: int) None[source]
_run_check() None[source]
check(args: argparse.Namespace) None[source]

Checks that the styles configured for a project match.

Raises an error if report errors.

clean(args: argparse.Namespace) None[source]

Cleaning command.

color: bool
config_path: str
fix: bool = False
init(args: argparse.Namespace) None[source]

Initialize the configuration for a project.

only_hints: bool = False
reporter_: Dict[str, Any]
rootdir: str
show(args: argparse.Namespace) None[source]

Show configuration or fetched style for a project.

It will depend in the args.data property.