diff --git a/Justfile b/Justfile index 4018b96..fa60232 100644 --- a/Justfile +++ b/Justfile @@ -14,15 +14,15 @@ install: sync uv run pre-commit install # Run the CLI, e.g. `just run user list` -run *ARGS: - uv run core {{ ARGS }} +run *ARGUMENTS: + uv run core {{ ARGUMENTS }} # Run the test suite, e.g. `just test -k users` -test *ARGS: - uv run pytest {{ ARGS }} +test *ARGUMENTS: + uv run pytest {{ ARGUMENTS }} # Run the test suite with a coverage report -test-cov: +test-coverage: uv run pytest --cov=src # Lint with ruff @@ -34,15 +34,15 @@ lint-fix: uv run ruff check . --fix # Format with ruff -fmt: +format: uv run ruff format . # Report formatting problems without rewriting files -fmt-check: +format-check: uv run ruff format . --check # Static type analysis with ty -typecheck: +type-check: uv run ty check # Security scan only (bandit rules, already part of `just lint`) @@ -54,18 +54,18 @@ hooks: uv run pre-commit run --all-files # Full read-only quality gate: lint (incl. security), formatting, types, tests -check: lint fmt-check typecheck test +check: lint format-check type-check test # Reformat and autofix, then run the full quality gate -fix: fmt lint-fix check +fix: format lint-fix check # Build the Docker image docker-build: docker buildx build -f {{ DOCKERFILE }} -t {{ IMAGE }} . # Run the CLI inside the Docker image, e.g. `just docker-run user list` -docker-run *ARGS: - docker run -it --rm {{ IMAGE }} core {{ ARGS }} +docker-run *ARGUMENTS: + docker run -it --rm {{ IMAGE }} core {{ ARGUMENTS }} # Refresh the lockfile without changing pinned versions lock: diff --git a/README.md b/README.md index 3adf3e9..e23ef5d 100644 --- a/README.md +++ b/README.md @@ -58,12 +58,12 @@ just run user list # Tests just test -just test-cov +just test-coverage # Individual quality checks just lint -just fmt -just typecheck +just format +just type-check just security # Full quality gate: lint, formatting, types, security, tests diff --git a/src/core/src/core/clients/http_client.py b/src/core/src/core/clients/http_client.py index d2231c7..12d03d9 100644 --- a/src/core/src/core/clients/http_client.py +++ b/src/core/src/core/clients/http_client.py @@ -19,10 +19,10 @@ def get(self, endpoint: str, params: dict[str, Any] | None = None) -> dict[str, response = self.session.get(url, params=params) response.raise_for_status() return response.json() - except requests.exceptions.RequestException as e: - raise HttpError(f"HTTP request failed: {e}") from e - except ValueError as e: - raise HttpError(f"Invalid JSON response: {e}") from e + except requests.exceptions.RequestException as error: + raise HttpError(f"HTTP request failed: {error}") from error + except ValueError as error: + raise HttpError(f"Invalid JSON response: {error}") from error def close(self): self.session.close() diff --git a/src/core/src/core/commands/user_commands.py b/src/core/src/core/commands/user_commands.py index 1e160e8..de1dec4 100644 --- a/src/core/src/core/commands/user_commands.py +++ b/src/core/src/core/commands/user_commands.py @@ -32,9 +32,9 @@ def get_user( self.logger.info(f"User: {user.name} ({user.email})") self.logger.info(f"Company: {user.company.name}") self.logger.info(f"Address: {user.address.street}, {user.address.city}") - except (CoreError, ValidationError) as e: - self.logger.error(f"Error fetching user: {e}") - raise typer.Exit(1) from e + except (CoreError, ValidationError) as error: + self.logger.error(f"Error fetching user: {error}") + raise typer.Exit(1) from error def list_users(self) -> None: try: @@ -42,9 +42,9 @@ def list_users(self) -> None: self.logger.info(f"Found {len(users)} users:") for user in users: self.logger.info(f" {user.id}: {user.name} ({user.email})") - except (CoreError, ValidationError) as e: - self.logger.error(f"Error fetching users: {e}") - raise typer.Exit(1) from e + except (CoreError, ValidationError) as error: + self.logger.error(f"Error fetching users: {error}") + raise typer.Exit(1) from error def get_user_posts( self, user_id: Annotated[int, typer.Option("--id", help="User ID")] = 1 @@ -55,6 +55,6 @@ def get_user_posts( self.logger.info(f"Posts by {user.name}:") for post in posts: self.logger.info(f" - {post['title']}") - except (CoreError, ValidationError) as e: - self.logger.error(f"Error fetching posts: {e}") - raise typer.Exit(1) from e + except (CoreError, ValidationError) as error: + self.logger.error(f"Error fetching posts: {error}") + raise typer.Exit(1) from error diff --git a/src/core/src/core/config/registry.py b/src/core/src/core/config/registry.py index c4035c5..a3d1592 100644 --- a/src/core/src/core/config/registry.py +++ b/src/core/src/core/config/registry.py @@ -2,10 +2,10 @@ def command_group(name: str): - def decorator(cls): - cls._command_name = name - _command_registry.append(cls) - return cls + def decorator(command_class): + command_class._command_name = name + _command_registry.append(command_class) + return command_class return decorator diff --git a/src/core/src/core/models/config.py b/src/core/src/core/models/config.py index cfe3ec6..79432d3 100644 --- a/src/core/src/core/models/config.py +++ b/src/core/src/core/models/config.py @@ -36,8 +36,8 @@ def __init__(self): if not config_path.exists(): raise FileNotFoundError(f"Config file not found: {config_path}") - with open(config_path, "r") as f: - config_data = yaml.load(f, Loader=SafeLoader) + with open(config_path, "r") as config_file: + config_data = yaml.load(config_file, Loader=SafeLoader) super().__init__(**config_data)