Wemake-python-styleguide: Forbid too long call chains

Created on 5 Oct 2019  路  4Comments  路  Source: wemake-services/wemake-python-styleguide

Rule request

Thesis

In case you work with a really strange API that uses a lot of nested decorator functions (or with lots of partial application and curing) you can end up with something like this in your code base:

some(a)(b)(c)(d)

Well, that's not pythonic. This is a complexity rule to limit this kind of situations.

What do we need?

  1. Option to regulate the complexity threshold, let's name it max_call_level
  2. Default value should be 2, where 3 calls will result in a violation
  3. A new complexity violation and a visitor

Related: https://github.com/wemake-services/wemake-python-styleguide/blob/8e759c1e80370234ac7bb30cf5f97fc953841688/wemake_python_styleguide/violations/complexity.py#L576
Related: #737 (where almost the same feature is implemented)

Hacktoberfest help wanted starter rule request

All 4 comments

Hi, can I be assigned to this issue?

@lucaionescu sure! Thanks a lot for your help!

Hi, @lucaionescu! How's it going? Do you need any help?

Hey, thanks for checking in, it's all good for now! I was diving into the documentation and the contribution guide for the past days, just wanted to make sure I understand everything before I start to code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sobolevn picture sobolevn  路  3Comments

sobolevn picture sobolevn  路  5Comments

Dreamsorcerer picture Dreamsorcerer  路  3Comments

Dreamsorcerer picture Dreamsorcerer  路  4Comments

sobolevn picture sobolevn  路  4Comments