Watson icon indicating copy to clipboard operation
Watson copied to clipboard

Flake8 linter configuration (especially line length)

Open benallan opened this issue 5 years ago • 3 comments

Are the options used for flake8 included in the repo anywhere? Since the project uses the flake8 default for line length it will work out of the box for default configs, but if someone has their environment set up differently then it might cause a bit of confusion (e.g. I use Black's limit of 88).

I couldn't see the line length set explicitly in setup.cfg or tox.ini, so perhaps it could be added there, e.g. for setup.cfg:

[flake8]
max_line_length=79

I first noticed this when a PR failed the Travis CI checks, so if there's an easier way I could have noticed this earlier please let me know.

benallan avatar Oct 28 '19 03:10 benallan

I think most editor plugins will use the defaults values if nothing is provided (therefore 79). Are you sure you don't have a black plugin messing it up?

Now I actually believe that we should move to black, but that's another matter :) .

k4nar avatar Oct 29 '19 18:10 k4nar

You're right about defaults, but I use a "system wide" value of 88 (or 100 at my workplace), so for any project that uses a different value (and to be fair, a lot of them use 79) I should add a per-project setting somewhere.

I'm not really sure what the ratio is of people using 79 vs other values, so maybe it's not a big deal.

And I'm obviously in favour of using black for watson too, when there's time :)

benallan avatar Oct 31 '19 15:10 benallan

I second that request. I have configured a maximal function complexity of 5 systemwide, so running flake8 locally fails for plenty of Watson's functions.

MaxG87 avatar Nov 14 '19 20:11 MaxG87