Skip to content

Code Style

Youssef Youssef edited this page Oct 19, 2026 · 1 revision

Code Style

PULSE enforces one code style automatically, so reviews focus on logic rather than formatting. Linters catch mistakes, formatters fix layout, and pre-commit hooks run both on every commit.

Style guides

Area Style guide
Python (backend, Discord bot, scripts) PEP 8, enforced by Ruff
TypeScript / React (frontend) ESLint recommended rules (@eslint/js, typescript-eslint, React Hooks) and Prettier's default style
All files .editorconfig: UTF-8, LF line endings, final newline, 2-space indent (4 for Python), 100-character lines

Tools

Area Linter Formatter Config files
Backend Ruff Ruff backend/pyproject.toml
Discord bot Ruff Ruff discord-bots/team-bot/pyproject.toml
Other Python (scripts/) Ruff Ruff ruff.toml
Frontend ESLint Prettier frontend/eslint.config.js, frontend/.prettierrc.json
Pre-commit hooks .pre-commit-config.yaml
Editor settings .editorconfig, .vscode/extensions.json

Main rules

  • Lines are at most 100 characters (Python and frontend).
  • Ruff rule groups: E, W (PEP 8 style), F (real errors such as undefined names), I (sorted imports), B (common bugs), UP (modern Python syntax), SIM (simpler code), RUF (Ruff's own checks).
  • ESLint fails on any warning (--max-warnings=0).
  • ESLint handles code quality; Prettier handles formatting. eslint-config-prettier turns off ESLint's formatting rules so the two never conflict.
  • .gitattributes stores every file with LF line endings, so the checks behave the same on Windows, macOS and Linux.

One-time setup

pip install pre-commit uv
pre-commit install
cd backend && uv sync
cd ../frontend && npm ci

Clone this wiki locally