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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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