Skip to main content
FootyCollect maintains high code quality standards using modern Python tooling. All code is automatically checked for formatting, linting, and type errors.

Quick Reference

Tools

Ruff

Ruff is an extremely fast Python linter and formatter, replacing Black, isort, flake8, and more.
Ruff formats code to a consistent style:
Configuration in pyproject.toml:
Ruff checks for code quality issues:
Enabled rule sets:
  • F - Pyflakes
  • E, W - pycodestyle
  • I - isort (import sorting)
  • N - pep8-naming
  • UP - pyupgrade
  • S - flake8-bandit (security)
  • B - flake8-bugbear
  • DJ - flake8-django
  • PT - flake8-pytest-style
  • PL - Pylint
  • RUF - Ruff-specific rules
And many more! See pyproject.toml for the full list.
Some rules are disabled for specific files:
pyproject.toml

mypy

Static type checker for Python:

Configuration

pyproject.toml
mypy uses Django-specific plugins (mypy_django_plugin and mypy_drf_plugin) to understand Django models and DRF serializers.

Pre-commit Hooks

Pre-commit hooks automatically run checks before each commit:

Setup

1

Install pre-commit

2

Install hooks

3

Run manually (optional)

Configured Hooks

From .pre-commit-config.yaml:
Automatically upgrade Django code to target version:
Formats and lints Django templates:

Code Quality Standards

Line Length

Maximum line length is 119 characters for code and comments.

Import Sorting

Ruff automatically sorts imports (replaces isort):

Naming Conventions

  • Classes: PascalCase
  • Functions/methods: snake_case
  • Constants: UPPER_SNAKE_CASE
  • Private methods: _leading_underscore

Django Best Practices

Ruff includes Django-specific rules (DJ rules):
  • DJ001 - Avoid using null=True on string-based fields
  • DJ006 - Do not use exclude in ModelForm
  • DJ008 - Model does not define __str__ method
  • And more!

Security

Ruff includes security checks from Bandit (S rules):
  • S105 - Hardcoded password string
  • S106 - Hardcoded password function argument
  • S108 - Hardcoded /tmp directory
  • S301 - Pickle usage
Security warnings should be carefully reviewed, not blindly ignored.

CI/CD Integration

Code quality checks run automatically on GitHub Actions:
.github/workflows/ci.yml (example)
All checks must pass before code can be merged.

IDE Integration

VS Code

Install the Ruff extension:
settings.json

PyCharm

Configure external tools for Ruff and mypy:
1

Add Ruff as External Tool

Settings → Tools → External Tools → Add
  • Program: ruff
  • Arguments: check . --fix
2

Configure mypy

Settings → Tools → Python Integrated Tools
  • Type checker: mypy

Running All Quality Checks

Before committing, run all checks:
Or use pre-commit:

Next Steps

Running Tests

Test suite and coverage

Project Structure

Understanding the codebase

Contributing

Contribution guidelines