4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
---
|
|
description: Code style and conventions
|
|
alwaysApply: true
|
|
---
|
|
|
|
# Code Style
|
|
|
|
## Formatting
|
|
|
|
- 100-character line length (enforced by ruff and `.editorconfig`)
|
|
- 4-space indentation for Python
|
|
- 2-space indentation for YAML, JSON, TOML
|
|
- Tabs for Makefiles
|
|
|
|
## Python Conventions
|
|
|
|
- Use `from __future__ import annotations` for forward references
|
|
- Absolute imports only: `from tools.base import BaseTool`
|
|
- Type hints on all function parameters and return types
|
|
- `TypedDict` for graph state, Pydantic `StrictConfigModel` for configs
|
|
- One clear purpose per file (separation of concerns)
|
|
|
|
## Tooling
|
|
|
|
- **Linter:** ruff (rules: E, W, F, I, B, C4, UP, ARG, SIM)
|
|
- **Type checker:** mypy (Python 3.13 target, `warn_return_any`)
|
|
- **Formatter:** ruff format (Black-compatible)
|
|
- **Python version:** >=3.12 (tooling targets 3.13)
|
|
|
|
## Quality Commands
|
|
|
|
Ruff and mypy run over the source packages (`config core gateway integrations
|
|
platform surfaces tools`) plus `tests/`; the Makefile keeps the canonical path
|
|
list in `PYTHON_SOURCE_PATHS`.
|
|
|
|
```bash
|
|
make lint # ruff check
|
|
make format-check # ruff format --check (read-only; CI enforces this)
|
|
make format # ruff format (write fixes locally)
|
|
make typecheck # mypy
|
|
make test-cov # pytest with coverage
|
|
make check # lint + format-check + typecheck + test-full
|
|
```
|
|
|
|
Before opening a PR, run `make format-check` (or `make check`) in addition to `make lint`.
|