• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hugovk / black / 151
95%

Build:
DEFAULT BRANCH: master
Ran 11 Sep 2020 07:43AM UTC
Jobs 5
Files 8
Run time 30s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
151

push

travis-ci

web-flow
Fix empty line handling when formatting typing stubs (#1646)

Black used to erroneously remove all empty lines between non-function
code and decorators when formatting typing stubs. Now a single empty
line is enforced.

I chose for putting empty lines around decorated classes that have empty
bodies since removing empty lines around such classes would cause a
formatting issue that seems to be impossible to fix.

For example:

```
class A: ...
@some_decorator
class B: ...
class C: ...
class D: ...

@some_other_decorator
def foo(): -> None: ...
```

It is easy to enforce no empty lines between class A, B, and C.
Just return 0, 0 for a line that is a decorator and precedes an stub
class. Fortunately before this commit, empty lines after that class
would be removed already.

Now let's look at the empty line between class D and function foo. In
this case, there should be an empty line there since it's class code next
to function code. The problem is that when deciding to add X empty lines
before a decorator, you can't tell whether it's before a class or a
function. If the decorator is before a function, then an empty line
is needed, while no empty lines are needed when the decorator is
before a class.

So even though I personally prefer no empty lines around decorated
classes, I had to go the other way surrounding decorated classes with
empty lines.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

7 of 7 new or added lines in 2 files covered. (100.0%)

4794 of 5020 relevant lines covered (95.5%)

3.81 hits per line

Jobs
ID Job ID Ran Files Coverage
1 151.1 (TEST_CMD="pre-commit run --all-files --show-diff-on-failure") 11 Sep 2020 07:43AM UTC 0
0.0
Travis Job 151.1
2 151.2 (TEST_CMD="coverage run -m unittest") 11 Sep 2020 07:43AM UTC 0
95.24
Travis Job 151.2
3 151.3 (TEST_CMD="coverage run -m unittest") 11 Sep 2020 07:43AM UTC 0
95.24
Travis Job 151.3
4 151.4 (TEST_CMD="coverage run -m unittest") 11 Sep 2020 07:43AM UTC 0
95.33
Travis Job 151.4
5 151.5 (TEST_CMD="coverage run -m unittest") 11 Sep 2020 07:43AM UTC 0
95.29
Travis Job 151.5
Source Files on build 151
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #151
  • c0a8e422 on github
  • Prev Build on master (#149)
  • Next Build on master (#152)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc