Wemake-python-styleguide: User should not configure anything other than the complexity options

Created on 30 Sep 2018  路  10Comments  路  Source: wemake-services/wemake-python-styleguide

We should provide default options for isort and flake8.

Related:

  1. https://github.com/gforcada/flake8-isort/issues/63
feature advanced

Most helpful comment

I guess we have found a solution: https://github.com/andreoliwa/nitpick

All 10 comments

See --append-config option that we can monkey-patch.

Closed by a misclick.

That's will force me to not use wps.

This linter is good, very good in comparison with naked flake8 or even with flake8 with plugins. But several rules are very opinionated. And it's good I can disable them, just a few.

This is not the point of this issue, I am only talking about configuration options like quotes, max-line-length, isort config and so on.

It is not related to ignore, per-file-ignores or complexity rules.
We also use these settings on literally every project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/setup.cfg#L31-L41

Ah, that's ok =)

For isort to work we can patch defaults: https://github.com/timothycrosley/isort/blob/develop/isort/settings.py#L76

It is safe, since any custom defined options will take priority over these values.
And since it is just a dict - it is really easy to do.

If they will change the format (I am quite sure that they won't), we can just fix the version of isort.

The only thing I care about is where should we patch it.
We need to do it before flake8-isort plugin starts to work.

I guess that we should do it in the import time. I hope that flake8 import plugins before they are actually executed.
And flake8 plugin API will help us with defining the right moment.

The obvious problem with patching isort config this way is that it won't work for autoformatter part. isort filename.py won't produce the same results.

I will look into plugin system of isort. Or ugly hacks 馃檪

I guess we have found a solution: https://github.com/andreoliwa/nitpick

I guess we have found a solution: https://github.com/andreoliwa/nitpick

I'm glad nitpick has a practical use outside my own projects. 馃檪
It's still beta and with rough edges though.
Let me know if you find more bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orsinium picture orsinium  路  3Comments

sobolevn picture sobolevn  路  4Comments

jtpavlock picture jtpavlock  路  4Comments

sobolevn picture sobolevn  路  3Comments

Dreamsorcerer picture Dreamsorcerer  路  3Comments