jsfehler / flake8-multiline-containers

A Flake8 plugin to ensure a consistent format for multiline containers.
MIT License
14 stars 3 forks source link

Support calls #9

Open sobolevn opened 5 years ago

sobolevn commented 5 years ago

Awesome plugin! We have almost the same on in https://wemake-python-stylegui.de/en/latest/pages/usage/violations/consistency.html#wemake_python_styleguide.violations.consistency.WrongBracketPositionViolation

But, we also check calls. Like this one:

print(1,
2, 3,
4)

We force it to be the same as lists, tuples, etc:

print(1, 2, 3, 4)
print(
    1, 2, 3, 4,
)
print(
    1,
    2, 
    3,
    4,
)

Do you plan to implement this feature? In this case we will switch.

sobolevn commented 5 years ago

Also:

class Test(zero,
    first, second):
def test(one,
              two):
jsfehler commented 5 years ago

Checking Tuples in 101 and 102 makes sense to me. Checking function calls should be a separate check, (eg: 103) since it's not a container.

Same goes for class and function definitions.

jsfehler commented 5 years ago

@sobolevn I've merged in support for validating tuples to the master branch. I'll do a release this weekend if nothing explodes.

I'm tempted not to check function calls, function definitions, or class definitions with this plugin, since they're not containers. Note that a container inside a function call or definition will still be validated.

sshishov commented 3 years ago

I would vote to have a check for function calls, Object creations, etc. As the clause is the same, follow the multiline style. If not in this plugin, then in which? There is no other plugin to check these multiline rules.

sobolevn commented 3 years ago

@sshishov wemake-python-styleguide does this as well.

ghost commented 2 years ago

To anyone else who wants to use wemake-python-styleguide just for this, the specific violation code is WPS317. Also, you'll want to disable darglint as it has a massive performance hit:

.darglint

[darglint]
ignore = *
MichaelKim0407 commented 1 year ago

I'm in support of adding a check on function calls. It seems most logical to me that it's implemented in this plugin, since it already checks very similar things.

@jsfehler If you don't want to have this check by default, you can make it so. Anyone who wants to enable this check can explicitly turn it on. Flake8 plugin supports having certain error codes ignored by default.