Repository: wemake-services/wemake-python-styleguide

Issue:
WSP318 conflict with isort I001 and E128
# Bug report

<!--
Hi, thanks for submitting a bug. We appreciate that.

But, we will need some information about what's wrong to help you.
-->

## What's wrong

There is no way of formatting a multi-line import without violating either WSP318 or I001 and E128.

```python
from flask import (Blueprint, current_app, flash, g, redirect, render_template,
                   request, url_for)
```

Does not yield I001 and also not E128, but it does violate WSP318. 

Fixing it so WSP318 is not violated creates violations against I001 and E128.
```python
from flask import (Blueprint, current_app, flash, g, redirect, render_template,
    request, url_for)
```

## How is that should be

WSP318 should respect visual indent (E128) and isort order (I001).


## System information

```
$ pip list
Package                       Version
----------------------------- -------
astor                         0.8.0
attrs                         19.3.0
bandit                        1.6.2
colorama                      0.3.9
cycler                        0.10.0
docutils                      0.15.2
entrypoints                   0.3
eradicate                     1.0
flake8                        3.7.8
flake8-annotations-complexity 0.0.2
flake8-bandit                 2.1.2
flake8-broken-line            0.1.1
flake8-bugbear                19.8.0
flake8-builtins               1.4.1
flake8-coding                 1.3.2
flake8-commas                 2.0.0
flake8-comprehensions         2.2.0
flake8-debugger               3.2.0
flake8-docstrings             1.5.0
flake8-eradicate              0.2.3
flake8-executable             2.0.3
flake8-isort                  2.7.0
flake8-logging-format         0.6.0
flake8-pep3101                1.2.1
flake8-polyfill               1.0.2
flake8-print                  3.1.1
flake8-quotes                 2.1.0
flake8-rst-docstrings         0.0.11
flake8-string-format          0.2.3
gitdb2                        2.0.6
GitPython                     3.0.4
isort                         4.3.21
kiwisolver                    1.1.0
mando                         0.6.4
matplotlib                    3.1.1
mccabe                        0.6.1
numpy                         1.17.2
pbr                           4.0.2
pep8-naming                   0.8.2
pip                           19.3.1
pycodestyle                   2.5.0
pydocstyle                    4.0.1
pyflakes                      2.1.1
Pygments                      2.4.2
pyparsing                     2.4.2
python-dateutil               2.8.0
PyYAML                        5.1.2
radon                         2.4.0
restructuredtext-lint         1.3.0
setuptools                    39.0.1
six                           1.11.0
smmap2                        2.0.5
snowballstemmer               2.0.0
stevedore                     1.28.0
testfixtures                  6.10.0
typing-extensions             3.7.4
virtualenv                    15.2.0
virtualenv-clone              0.3.0
virtualenvwrapper             4.8.2
wemake-python-styleguide      0.12.5
```


Love the opinionated linting though ❤️ Just found it [here](https://sobolevn.me/2019/10/complexity-waterfall)! Awesome project. Definitely takes some useless thinking away from me.




Discussion:
@tbrlpld thanks for raising this! 

I guess, we should update the docs of `WSP318` to link the `isort` multiline mode, so it would be clear for future users.

That's how it works. `isort` has multiple modes for multiline output. Our preferred mode is `3`: https://github.com/wemake-services/wemake-python-styleguide/blob/master/setup.cfg#L71

And it is 100% compatible. All our code is checked for it. Example: https://github.com/wemake-services/wemake-python-styleguide/blob/8488835f167bf17a614df583736ea5dd7778af1e/wemake_python_styleguide/visitors/ast/blocks.py#L5

Considering your exact situation:

```python
from flask import (
    Blueprint, 
    current_app, 
    flash, 
    g, 
    redirect, 
    render_template,
    request, url_for,
)
```

Would you like to update the docs with the link to the correct `multiline_output_mode`?

That's how it should be:

```python
"""
...

This rule is also compatible with ``isort`` multiline output. 
You should set ``multi_line_output = 3`` setting.

See also:
     https://github.com/timothycrosley/isort#multi-line-output-modes
"""
```
Great, thank you for the clarification. Is there a way to make this the standard configuration through `wemake_python_styleguide`? 

I am definitely happy to update the docs to make it clear for other users! 


> On Oct 22, 2019, at 22:34, Nikita Sobolev <notifications@github.com> wrote:
> 
> ﻿
> @tbrlpld thanks for raising this!
> 
> I guess, we should update the docs of WSP318 to link the isort multiline mode, so it would be clear for future users.
> 
> That's how it works. isort has multiple modes for multiline output. Our preferred mode is 3: https://github.com/wemake-services/wemake-python-styleguide/blob/master/setup.cfg#L71
> 
> And it is 100% compatible. All our code is checked for it. Example: https://github.com/wemake-services/wemake-python-styleguide/blob/8488835f167bf17a614df583736ea5dd7778af1e/wemake_python_styleguide/visitors/ast/blocks.py#L5
> 
> Considering your exact situation:
> 
> from flask import (
>     Blueprint, 
>     current_app, 
>     flash, 
>     g, 
>     redirect, 
>     render_template,
>     request, url_for,
> )
> Would you like to update the docs with the link to the correct multiline_output_mode?
> 
> That's how it should be:
> 
> """
> ...
> 
> This rule is also compatible with ``isort`` multiline output. 
> You should set ``multi_line_output = 3`` setting.
> 
> See also:
>      https://github.com/timothycrosley/isort#multi-line-output-modes
> """
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or unsubscribe.

Yes, we enforce the same configuration for everyone via `nitpick`: https://wemake-python-stylegui.de/en/latest/pages/usage/integrations/nitpick.html
Here's our `isort` config: https://raw.githubusercontent.com/wemake-services/wemake-python-styleguide/master/styles/isort.toml

Assigned you on this task, thanks a lot! 
Ok, i'll update the documentation. 

I also found a broken link, that is supposed to point to the `isort.toml`, but instead points to the `flake8.toml`. 
I will update that as well, since the topic is related. 

Resolving patch:
diff --git a/wemake_python_styleguide/violations/consistency.py b/wemake_python_styleguide/violations/consistency.py
--- a/wemake_python_styleguide/violations/consistency.py
+++ b/wemake_python_styleguide/violations/consistency.py
@@ -783,6 +783,14 @@ def test():
         def test():
                     print('test')
 
+    This rule is consistent with the "Vertical Hanging Indent" option for
+    ``multi_line_output`` setting of ``isort``. To avoid conflicting rules,
+    you should set ``multi_line_output = 3`` in the ``isort`` settings.
+
+    See also:
+        https://github.com/timothycrosley/isort#multi-line-output-modes
+        https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/isort.toml
+
     .. versionadded:: 0.6.0
 
     """


Test patch: