Closed karlcow closed 4 years ago
This is related to #41 too.
Some references for deciding:
prettier python https://github.com/prettier/plugin-python
@laghee What you do think want?
My current install of flake8 is
Installed plugins: mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0
@karlcow I think I have a pretty vanilla version of flake8, and I've been using autopep8 to format (which I kind of hate because it won't automatically break long lines). I don't always love auto-formatting either, but I definitely like to have the option to clean up simple things that are a pain to go back and fix by hand.
I'll try out black for a while and see how that goes.
So, a few things about black
defaults as pertains to our current codebase:
(*These 2 defaults can be altered/eliminated with command line options.)
Are any (or all 😁 ) of these going to make you want to rip all your hair out, @karlcow?
My fondness for auto-formatting is mostly about line breaks -- constantly looking up how to correctly split an overly long line in various expressions drives me nuts. But I (or whoever) could always run black
locally for that sort of thing.
I think it's worth adding black
as a defined project tool if we're happy with their defaults as is. Or if we're only altering one requirement (line length OR double quotes, but not both). Otherwise it seems like it would add more burden than it removes.
Thoughts?
My fondness for auto-formatting is mostly about line breaks -- constantly looking up how to correctly split an overly long line in various expressions drives me nuts.
I think this is the important thing. We don't want you to go to the nuts hospital. 🃏 Specifically if it makes it easier for both people to write code and reviewer to do less nitpicking it would be a good thing.
And that would make a good testbed for the webcompat.com project.
Let's do it, and I'll let you choose the right amount of custom settings or defaults we should use.
I'm going with black
configured to leave line length at the library standard of 79 char, but letting it change all quotes to doubles. I'm drafting documentation for dev setup, so I don't want to move on adding it to requirements.txt
until I've worked out the configuration setup with python-dotenv
, etc.
I'm thinking we should keep flake8
for CircleCI testing for a while to avoid having current tests break (to avoid this we'd have to do a big overhaul for the single-to-double-quote change). As files are touched, we could gradually transition to double quotes.
This sounds like a very good plan.
@laghee do you still use black? What are your configurations?
I'm thinking of making it mandatory. And that would be a good test to see if we would adopt it on webcompat.com.
Let's make things green https://requires.io/github/webcompat/webcompat-metrics-server/requirements/?branch=42%2F1
@laghee do you still use black? What are your configurations?
The only configuration I customized beyond their defaults is to leave line length at the library standard of 79 characters (so everything is being slowly changed to double quotes).
Missed you, @karlcow 🐮! Glad you're back and healthy.
ok let's see if we can live with the new proposed settings. And thanks… super happy to be back.
There are many different linters for python. We should try to adopt one style and be using the same. Let's document that in the project.
flake8 is a wrapper around linters. so we can add whichever we think is interesting.
For example pylint would detect the non documented
class
(missing docstrings).