Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid too long call chains #842

Closed
sobolevn opened this issue Oct 5, 2019 · 4 comments
Closed

Forbid too long call chains #842

sobolevn opened this issue Oct 5, 2019 · 4 comments
Assignees
Labels
Hacktoberfest Hactoberfest fun! help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule
Milestone

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 5, 2019

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:

class TooDeepAccessViolation(ASTViolation):

Related: #737 (where almost the same feature is implemented)

@sobolevn sobolevn added help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule Hacktoberfest Hactoberfest fun! labels Oct 5, 2019
@sobolevn sobolevn added this to the Version 0.13 milestone Oct 5, 2019
@lucaionescu
Copy link
Contributor

Hi, can I be assigned to this issue?

@sobolevn
Copy link
Member Author

sobolevn commented Oct 6, 2019

@lucaionescu sure! Thanks a lot for your help!

@sobolevn
Copy link
Member Author

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

@lucaionescu
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest Hactoberfest fun! help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule
Projects
None yet
Development

No branches or pull requests

2 participants