Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto format using Black (20.8b1) Added black --check to build. #1546

Closed
wants to merge 1 commit into from

Conversation

cyberw
Copy link
Collaborator

@cyberw cyberw commented Aug 27, 2020

Fixes #1489 (kinda)

My second attempt at this (replacing #1494), now that magic trailing commas has been fixed in Black.

  • Black is very popular, so many will be familiar with it.
  • It is good at minimizing diffs
  • It is very opinionated (the only config I've added is the line length), so there should be minimal discussion about how to configure it
  • IMO it strikes a good balance between keeping the code nicely formatted (and PEP8 compliant) without making it unnecessarily long.

Here's a comparison of various formatters https://medium.com/3yourmind/auto-formatters-for-python-8925065f9505

As the next step, we could (should) increase the number of rules covered by flake8 (probably switching to ignoring the few rules that we dont like instead of enabling a few favourite ones. something like --ignore E501,W503,E701,E731,E741,E712,E402,F401).

@codecov
Copy link

codecov bot commented Aug 27, 2020

Codecov Report

Merging #1546 into master will decrease coverage by 0.15%.
The diff coverage is 73.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1546      +/-   ##
==========================================
- Coverage   82.50%   82.34%   -0.16%     
==========================================
  Files          28       28              
  Lines        2566     2566              
  Branches      391      391              
==========================================
- Hits         2117     2113       -4     
- Misses        353      364      +11     
+ Partials       96       89       -7     
Impacted Files Coverage Δ
locust/__init__.py 100.00% <ø> (ø)
locust/exception.py 100.00% <ø> (ø)
locust/rpc/protocol.py 100.00% <ø> (ø)
locust/user/sequential_taskset.py 85.18% <0.00%> (ø)
locust/main.py 21.05% <15.62%> (ø)
locust/argument_parser.py 77.19% <33.33%> (ø)
locust/user/inspectuser.py 72.72% <37.50%> (ø)
locust/event.py 87.50% <50.00%> (ø)
locust/util/deprecation.py 90.47% <66.66%> (ø)
locust/util/exception_handler.py 80.00% <66.66%> (ø)
... and 19 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 10351b6...62af765. Read the comment docs.

@cyberw
Copy link
Collaborator Author

cyberw commented Aug 27, 2020

doh, wrong branch...

@cyberw cyberw closed this Aug 27, 2020
@cyberw cyberw deleted the format-code-using-Black branch August 27, 2020 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Let's fix code to be PEP8 compliant?
1 participant