Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Use Black to format Python code #6447

Merged
merged 7 commits into from Feb 10, 2020
Merged

Use Black to format Python code #6447

merged 7 commits into from Feb 10, 2020

Conversation

callahad
Copy link
Contributor

My verification of #6440, following @peterbe's instructions

I ran poetry run black kuma docs tests, as per our .travis.yml file.

I then checked with poetry run flake8 kuma docs tests and saw a lot of errors. Black recommends ignoring the following:

  • E203 (whitespace before ':')
  • E501 (line length)
  • W503 (line break before binary operator)

I manually resolved or added local exceptions for:

  • E231 (missing whitespace after ',')
  • E731 (do not assign a lambda expression)
  • F401 (name imported by unused)
  • F405 (name may be undefined or defined from star imports)
  • I202 (additional newline in a group of imports)

E231 is due to a bug in Black when collapsing multi-line dicts: psf/black#1202

@codecov-io
Copy link

codecov-io commented Feb 10, 2020

Codecov Report

Merging #6447 into master will increase coverage by 4.33%.
The diff coverage is 93.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6447      +/-   ##
==========================================
+ Coverage   48.07%   52.41%   +4.33%     
==========================================
  Files         300      300              
  Lines       33827    32898     -929     
  Branches     1764     1860      +96     
==========================================
+ Hits        16264    17242     +978     
+ Misses      17017    15099    -1918     
- Partials      546      557      +11
Impacted Files Coverage Δ
kuma/users/forms.py 22.36% <ø> (-1.39%) ⬇️
kuma/settings/local.py 18.51% <ø> (+1.85%) ⬆️
kuma/wiki/constants.py 3.11% <ø> (-1.39%) ⬇️
kuma/scrape/tests/test_source_document_redirect.py 65.85% <ø> (+4.49%) ⬆️
kuma/users/tasks.py 53.33% <ø> (+4.35%) ⬆️
kuma/wiki/exceptions.py 88.88% <ø> (ø) ⬆️
kuma/search/views.py 80% <ø> (+6.31%) ⬆️
kuma/core/tests/taggit_extras/models.py 100% <ø> (ø) ⬆️
kuma/dashboards/urls.py 54.54% <ø> (+34.54%) ⬆️
kuma/search/tests/test_tasks.py 100% <ø> (ø) ⬆️
... and 467 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c5646f...7fca29c. Read the comment docs.

Copy link
Contributor

@peterbe peterbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this better because it's explicit about the lambda overrides within the code rather than a global exception in the .flake8.

@peterbe peterbe merged commit 345c541 into mdn:master Feb 10, 2020
@callahad callahad deleted the my-black branch February 10, 2020 18:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants