sourcery_analytics.main

CLI interface to sourcery-analytics.

sourcery_analytics.main.cli_analyze(path: Path = typer.Argument(..., exists=True, file_okay=True, dir_okay=True), method_metric: List[MethodMetricChoice] = typer.Option(['length', 'cyclomatic_complexity', 'cognitive_complexity', 'working_memory']), sort: Optional[MethodMetricChoice] = typer.Option(None), output: OutputChoice = typer.Option('rich'))

Produces a table of method metrics for all methods found in path.

sourcery_analytics.main.cli_aggregate(path: Path = typer.Argument(..., exists=True, file_okay=True, dir_okay=True), method_metric: List[MethodMetricChoice] = typer.Option(['length', 'cyclomatic_complexity', 'cognitive_complexity', 'working_memory']), aggregation: AggregationChoice = typer.Option('average'), output: OutputChoice = typer.Option('rich'))

Produces an aggregate of the metrics for all methods found in path.

sourcery_analytics.main.cli_assess(path: Path = typer.Argument(..., exists=True, file_okay=True, dir_okay=True), method_metric: List[MethodMetricChoice] = typer.Option(['length', 'cyclomatic_complexity', 'cognitive_complexity', 'working_memory']), settings_file: Path = typer.Option('pyproject.toml', file_okay=True, dir_okay=False))

Using configurable values, will pass or fail according to calculated metrics.

Exits with code 1 if assessment fails i.e. any methods exceed the thresholds. Exits with code 2 for runtime errors, such as mis-configured settings.