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 to have too many compares in one expression #639

Closed
sobolevn opened this issue Jul 9, 2019 · 4 comments
Closed

Forbid to have too many compares in one expression #639

sobolevn opened this issue Jul 9, 2019 · 4 comments
Assignees
Labels
help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule

Comments

@sobolevn
Copy link
Member

sobolevn commented Jul 9, 2019

Rule request

Thesis

We need to forbid expressions with too many ast.Compare parts:

x > y > z > a > b > c

I would say, that we need to allow 3 or 4 elements max.
It is also possible to keep == with 4 elements. And other compare elements can have only 3 parts: z > x > y.

Reasoning

It is hard to read elements with multiple compare cases.

@sobolevn sobolevn added help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule labels Jul 9, 2019
@sobolevn sobolevn added this to the Version 0.10.0 milestone Jul 9, 2019
@sobolevn sobolevn self-assigned this Jul 9, 2019
@kxepal
Copy link

kxepal commented Jul 9, 2019

Does 0 < x <= 1 and 0 < y <= 1 violates this rule idea?

@sobolevn
Copy link
Member Author

sobolevn commented Jul 9, 2019

Nope, < can be used with <= and > with >=

@sobolevn sobolevn reopened this Jul 9, 2019
@kxepal
Copy link

kxepal commented Jul 9, 2019

So it's just about > / < comparison chain length?

@sobolevn
Copy link
Member Author

sobolevn commented Jul 9, 2019

Yep, that's exactly it.

P.S. I have meant to close #614 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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