Skip to main content

Detect duplicate function names in Python source files using AST parsing

Project description

check-duplicate-functions

Detect duplicate function names in Python files using AST parsing.

Features

  • Detects duplicate function names (module-level and in classes)
  • AST-based; handles async functions and type annotations
  • Excludes special methods (__init__, __str__, etc.)
  • No external dependencies

Requirements

  • Python 3.8+
  • Standard library only

Installation

pip install check-duplicate-functions

Usage

check-duplicate-functions <python_file_path>

Examples

check-duplicate-functions my_script.py
check-duplicate-functions src/utils.py

Output

  • No duplicates: Exits with code 0 (no output)
  • Duplicates found: Prints each duplicate name and line numbers, e.g.
    [DUPLICATE] 'my_function' appears on lines: 10, 25, 42
  • Errors: Prints message and exits with code 1

Exit codes

  • 0 — Success
  • 1 — Error (bad args, file not found, syntax error, etc.)

Author

Pandiyaraj Karuppasamy

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

check_duplicate_functions-1.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

check_duplicate_functions-1.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file check_duplicate_functions-1.0.1.tar.gz.

File metadata

File hashes

Hashes for check_duplicate_functions-1.0.1.tar.gz
Algorithm Hash digest
SHA256 49089a0e9e356b52d30e744c653ac82a77395889c5762ab5f94dc71820b86f3d
MD5 862df58c343ecab03a26aa680f8314d3
BLAKE2b-256 b33f3128ac223841c685bd30f3c7259213c356d0fdcb3a318f763912cb8e3e72

See more details on using hashes here.

File details

Details for the file check_duplicate_functions-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for check_duplicate_functions-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8ae2a6c190d18d642e7ea1ef7aaef2cb7aeaaa0e0721f42f41941a8f79bcdbd
MD5 0432c405e9b01237705e5d2a9c21cc68
BLAKE2b-256 936e21be378cb078bfdaff7727d93cc6a70af7072b7ca8d345e8ae0233763205

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