This repository uses automated linters to enforce foundation agent instructions and code conventions.
Document the repository's lint suite — what each linter checks, how to install and run them, and how to fix or suppress findings.
Covers the repository's linters, their pre-commit / git-hook wiring, and the policy docs they cite
(docs/policies/). Not a prose style guide.
- Install pre-commit:
pip install pre-commit- Install the git hooks:
pre-commit install- (Optional) Run on all files to check current state:
pre-commit run --all-filesSingle command to run everything:
# Using pre-commit (recommended)
pre-commit run --all-files
# Or using the convenience script
./scripts/lint.sh
# Auto-fix issues where possible
./scripts/lint.sh --fixYou can also run individual linters manually:
# Python code style
ruff check .
ruff format .
# YAML files
yamllint .
# Shell scripts
shellcheck scripts/**/*.sh
# Custom linters
python scripts/linters/ast_parquet_linter.py path/to/file.py
python scripts/linters/check_file_naming.py path/to/file.py
python scripts/linters/check_documentation.py path/to/file.mdRuff - Python linting and formatting
- Enforces: snake_case functions/variables, PascalCase classes, UPPER_SNAKE_CASE constants
- Config:
pyproject.toml - Auto-fixes: Yes (with
--fix)
Black - Python code formatting
- Enforces: Consistent code formatting
- Config:
pyproject.toml - Auto-fixes: Yes
Yamllint - YAML file linting
- Enforces: 2-space indentation, snake_case keys, lowercase booleans
- Config:
.yamllint.yaml - Auto-fixes: Limited
ShellCheck - Shell script linting
- Enforces: Shell script best practices
- Config: None (uses defaults)
- Auto-fixes: No
Gitleaks - Secrets detection
- Detects: API keys, passwords, tokens, .env files
- Config:
.gitleaks.toml - Auto-fixes: No (prevents commit)
Protected Paths Checker - Prevents commits to protected directories
- Protects:
$DATA_DIR/imports/,$DATA_DIR/attachments/,docs/private/,.env* - Config:
scripts/linters/check_protected_paths.sh - Auto-fixes: No (prevents commit)
File Naming Checker - Enforces naming conventions
- Enforces:
- Python files:
snake_case.py - Shell scripts:
kebab-case.sh - Report files:
*-report-YYYY-MM-DD.md
- Python files:
- Config:
scripts/linters/check_file_naming.py - Auto-fixes: No (prevents commit)
Parquet Access Linter - Enforces MCP-only data access
- Detects: Direct
pd.read_parquet()ordf.to_parquet()calls - Exceptions: MCP server code, import scripts
- Config:
scripts/linters/ast_parquet_linter.py - Auto-fixes: No (prevents commit)
- See:
docs/policies/agent-mcp-access-policy.md
Documentation Checker - Validates documentation structure
- Checks: Required sections (Purpose, Scope), link validity
- Config:
scripts/linters/check_documentation.py - Auto-fixes: No (prevents commit)
Workflow Compliance Checker - Validates workflow file locations
- Checks: Report files in correct directories
- Config:
scripts/linters/check_workflow_compliance.py - Auto-fixes: No (prevents commit)
pyproject.toml- Ruff, Black, pytest configuration.yamllint.yaml- YAML linting rules.gitleaks.toml- Secrets detection patterns.pre-commit-config.yaml- Pre-commit hooks configuration
Will show in Problems tab:
- ✅ Ruff - Python linting errors (with Ruff extension)
- ✅ Yamllint - YAML errors (with YAML extension)
- ✅ ShellCheck - Shell script errors (with ShellCheck extension)
Won't show in Problems tab (pre-commit only):
- ❌ Gitleaks - Secrets detection (runs on commit)
- ❌ Protected paths checker - Runs on commit
- ❌ Custom linters - MCP access, file naming, documentation, workflow compliance (run on commit)
-
Install recommended VS Code extensions:
- Open Command Palette (Cmd+Shift+P)
- Run "Extensions: Show Recommended Extensions"
- Install: Ruff, YAML, ShellCheck
-
VS Code will automatically use:
pyproject.tomlfor Ruff configuration.yamllint.yamlfor YAML linting- ShellCheck settings from
.vscode/settings.json
-
Problems will appear in real-time as you type (for Ruff, YAML, ShellCheck)
To see custom linter problems in VS Code, you can:
-
Run manually in terminal:
python scripts/linters/ast_parquet_linter.py path/to/file.py
-
Create a VS Code task (optional):
- Add to
.vscode/tasks.jsonto run custom linters - Use "Run Task" to check files
- Add to
-
Pre-commit will catch everything - All linters run automatically on commit
Problem: Code is accessing parquet files directly instead of using MCP server.
Solution: Use MCP tools instead:
# ❌ Wrong
df = pd.read_parquet("$DATA_DIR/flows/flows.parquet")
# ✅ Correct
# Use MCP parquet server toolsException: If you're working on the MCP server itself (mcp-servers/parquet/) or import scripts, this is allowed.
Problem: File name doesn't match required pattern.
Solution: Rename file to match convention:
- Python:
my_script.py(snake_case) - Shell:
my-script.sh(kebab-case) - Reports:
btc-liquidity-regime-report-2026-01-07.md
Problem: Attempting to commit files in protected directories.
Solution: Remove from staging or add to .gitignore:
git reset HEAD path/to/protected/fileProtected paths:
$DATA_DIR/imports/- Read-only archive$DATA_DIR/attachments/- Large filesdocs/private/- Private submodule.env*- Environment files
Problem: Documentation file missing required sections.
Solution: Add required sections:
docs/files: Purpose, Scopestrategy/files: Purpose
If you need to skip hooks for a specific commit:
git commit --no-verify -m "message"Warning: Only use this for legitimate exceptions. Most violations can be fixed automatically or with minor changes.
To update pre-commit hooks:
pre-commit autoupdateTo update individual tools:
pip install --upgrade ruff black yamllint shellcheck-pyIf the Test Explorer shows "No tests found", check:
-
pytest not installed:
pip install pytest pytest-cov
-
Test files not in expected locations:
- Config expects:
tests/directory or*_test.py/test_*.pyfiles - Current test files are in
execution/scripts/test_*.py
- Config expects:
-
Test files not using pytest:
- Files need to use pytest (e.g.,
import pytest,def test_*():) - Current test files are scripts, not pytest tests
- Files need to use pytest (e.g.,
Option 1: Install pytest and configure VS Code
pip install pytest pytest-covThen reload VS Code - it should discover tests automatically.
Option 2: Convert scripts to pytest tests
- Add
import pytestat the top - Use pytest assertions (
assertinstead ofprint) - Remove
if __name__ == "__main__"blocks
Option 3: Create proper test structure
- Create
tests/directory at repo root - Add
tests/__init__.py - Move/convert test files to use pytest
The pyproject.toml is configured to discover tests in:
tests/directoryexecution/scripts/(existing test files)scripts/directory
/reports/foundation-agent-instructions-linter-analysis.md- Complete analysis/foundation-config.yaml- Foundation configurationdocs/policies/agent-mcp-access-policy.md- MCP access policydocs/policies/agent-workflow-requirements.md- Workflow requirements