Skip to main content

A flake8 plugin to enforce object calisthenics rule "one level of nesting"

Project description

flake8-deep-calls

flake8-deep-calls is a Flake8 plugin aimed at reducing complexity in Python code by enforcing the Object Calisthenics rule to "Limit Nesting to One Level." This plugin identifies functions that call other functions in a nested manner, going beyond one level deep, which may indicate overly complex code structures.

Installation

To install flake8-deep-calls, you can use pip:

pip install flake8-deep-calls

Usage

Once installed, the plugin will automatically be included when you run Flake8. To analyze your project, simply use:

flake8 your_project_directory

The plugin will flag functions with excessive call depth, helping you recognize areas where the code could be refactored to reduce complexity.

Configuration

flake8-deep-calls works out-of-the-box with the default settings of Flake8. There are no additional configuration options needed specifically for this plugin as it leverages existing Flake8 configurations.

Rules Enforced

  • FDC100: Indicates functions that call other local functions more than one level deep.

Each violation specifies the function name and the depth of calls, guiding developers to consider flattening their function interactions or refactoring into simpler, more decoupled functions.

Motivation

The motivation behind this plugin is to help developers adhere to clean code principles that facilitate easier maintenance, testing, and understanding of the code. By limiting the depth of nested function calls, the code remains straightforward and more aligned with the Single Responsibility Principle.

Contributing

Contributions to improve flake8-deep-calls are welcome! If you have suggestions for improvements, bug reports, or new features, please feel free to contribute to the project by opening issues or submitting pull requests on our GitHub repository.

License

flake8-deep-calls is open-sourced software licensed under the MIT License. See the LICENSE file for more details.

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_deep_calls-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

flake8_deep_calls-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file flake8_deep_calls-0.1.0.tar.gz.

File metadata

  • Download URL: flake8_deep_calls-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for flake8_deep_calls-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fbb1b2eff8e7850ea23cb833d5c42b850ea8c3bb9eddc25bdfcb9900e80ccf60
MD5 3b2953ce868bf0dd508e5ec2595d8f84
BLAKE2b-256 695d1c22f14b3146d1e7b3d2ab022cf80475e54b38bbd8c369f762c13e7251a9

See more details on using hashes here.

File details

Details for the file flake8_deep_calls-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_deep_calls-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ab1f9be82cfd2eb3bb2a9bc06010dc99a7538efe0bd5cb371b17813d0b6f2c
MD5 edb1b6c70ac020f5d209798939881450
BLAKE2b-256 5d9535e1a1b56576844ecea12d92a7ce1412b77e2587cad9f5945f0ce3958b24

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