Skip to main content

Flake8 plugin that checks top-level caller/callee definition order

Project description

flake8-caller-callee-order

This repo includes a flake8 plugin that enforces top-level caller/callee definition order:

uv run flake8 path/to/file.py

For example, with the default callee-before-caller order, this is reported:

def main():
    helper()


def helper():
    print("helper")
CCO001 `main` calls `helper`, but `helper` is defined later at line 5

By default, caller-callee-order = callee-before-caller, and CCO001 is emitted when a top-level function calls another top-level function that is defined later in the same file. For now it only checks simple function calls like helper(); method and attribute calls like self.helper() or module.helper() are ignored. It only orders top-level def and async def functions; variables, classes, and other declarations are not checked yet.

To require callers before their callees instead, configure Flake8 with:

[flake8]
caller-callee-order = caller-before-callee

Development

uv run flake8 .
uv run pytest
uv run ruff check
uv run ruff format
uv run mypy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_caller_callee_order-0.1.1.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_caller_callee_order-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file flake8_caller_callee_order-0.1.1.tar.gz.

File metadata

  • Download URL: flake8_caller_callee_order-0.1.1.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for flake8_caller_callee_order-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c34d011de85da95c120d0fd8aef18098cb4b74dd7a3a70c3beae14c0abafa802
MD5 5529f528eec95666c9cab7f9fba3b5b5
BLAKE2b-256 2abde2c333d19d76113624fd5c18f0ba2d5d7e1ee6289dd700cc3704adca8b45

See more details on using hashes here.

File details

Details for the file flake8_caller_callee_order-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flake8_caller_callee_order-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for flake8_caller_callee_order-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f1651897ffaf1ffcbe8f372f7549efd877a644691f76b660ed897f56a7dd333
MD5 58a18422237b66d10c08b866a6004af8
BLAKE2b-256 e1b739822b70d926385e0dcaa8b230d29fb426b255ee59455d92051fcbeb1640

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page