Code Style
CleverThis enforces consistent code style via automated tools. All style checks run in CI — don't rely on reviewers to catch formatting issues.
Python
Python code is formatted and linted with ruff. Configuration lives in pyproject.toml at the repo root.
# Check for lint errors
ruff check .
# Format code
ruff format .
# Fix auto-fixable lint errors
ruff check --fix .
Key ruff rules in use: E and W (pycodestyle), F (pyflakes), I (isort), B (flake8-bugbear), UP (pyupgrade). The full rule set is in pyproject.toml.
Type annotations are required for all public functions and methods. mypy is run in strict mode on cleveractors-core and in standard mode on the server. Use nox -s typecheck to check.
TypeScript / JavaScript
TypeScript is checked with the TypeScript compiler (tsc --noEmit). ESLint is configured via eslint.config.mjs. Prettier formats TypeScript, JSON, and CSS.
pnpm lint # ESLint
pnpm typecheck # tsc
pnpm format # Prettier
pre-commit
Install pre-commit hooks to catch issues before pushing:
pip install pre-commit
pre-commit install
The hooks run ruff, mypy (on changed files), and Prettier on every commit. This catches most style issues locally before CI.
Naming conventions
- Python: snake_case for variables, functions, modules; PascalCase for classes.
- TypeScript: camelCase for variables and functions; PascalCase for types, interfaces, and React components.
- Database columns: snake_case.
- Environment variables: SCREAMING_SNAKE_CASE.
The full pyproject.toml and eslint.config.mjs configuration reference is being added to this page.