You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When formatting typeshed (cargo run --bin ruff_dev -- format-dev --write typeshed), there is still a big diff with black wrt to empty lines.
E.g. given
classFeature:
defgetMandatoryRelease(self) ->None: ...
compiler_flag: intdefgetMandatoryRelease(self) ->None: ...
compiler_flag: intifsys.platform!="win32":
defcan_change_color() ->bool: ...
# Changed in Python 3.8.8 and 3.9.2ifsys.version_info>= (3, 8):
passifsys.platform=="win32":
classDummy:
__new__: None__init__: None# Actual typename SummaryInformation, not exposed by the implementationclass_SummaryInformation:
defGetProperty(self, field: int) ->int|bytes|None: ...
black will format this as
classFeature:
defgetMandatoryRelease(self) ->None: ...
compiler_flag: intdefgetMandatoryRelease(self) ->None: ...
compiler_flag: intifsys.platform!="win32":
defcan_change_color() ->bool: ...
# Changed in Python 3.8.8 and 3.9.2ifsys.version_info>= (3, 8):
passifsys.platform=="win32":
classDummy:
__new__: None__init__: None# Actual typename SummaryInformation, not exposed by the implementationclass_SummaryInformation:
defGetProperty(self, field: int) ->int|bytes|None: ...
while we format this as
classFeature:
defgetMandatoryRelease(self) ->None: ...
compiler_flag: intdefgetMandatoryRelease(self) ->None: ...
compiler_flag: intifsys.platform!="win32":
defcan_change_color() ->bool: ...
# Changed in Python 3.8.8 and 3.9.2ifsys.version_info>= (3, 8):
passifsys.platform=="win32":
classDummy:
__new__: None__init__: None# Actual typename SummaryInformation, not exposed by the implementationclass_SummaryInformation:
defGetProperty(self, field: int) ->int|bytes|None: ...
The task is to go through the typeshed diff and figure out each empty line rule we're still missing. If you implement this you don't need to (and probably shouldn't) fix everything at once but you can implement any part of it (as long as it doesn't decrease the similarity index).
The text was updated successfully, but these errors were encountered:
## Summary
Fix all but one empty line differences with the black preview style in
typeshed. The remaining differences are breaking with type comments and
trailing commas in function definitions.
I compared the empty line differences with the preview mode of black
since stable has some oddities that would have been hard to replicate
(psf/black#3861). Additionally, it assumes the
style proposed in psf/black#3862.
An edge case that also surfaced with typeshed are newline before
trailing module comments.
**main**
| project | similarity index | total files | changed files |
|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1632 |
| django | 0.99966 | 2760 | 58 |
| transformers | 0.99930 | 2587 | 447 |
| twine | 1.00000 | 33 | 0 |
| **typeshed** | 0.99978 | 3496 | **2173** |
| warehouse | 0.99825 | 648 | 22 |
| zulip | 0.99950 | 1437 | 27 |
**PR**
| project | similarity index | total files | changed files |
|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1632 |
| django | 0.99966 | 2760 | 58 |
| transformers | 0.99930 | 2587 | 447 |
| twine | 1.00000 | 33 | 0 |
| **typeshed** | 0.99983 | 3496 | **18** |
| warehouse | 0.99825 | 648 | 22 |
| zulip | 0.99950 | 1437 | 27 |
Closes#6723
## Test Plan
The main driver was the typeshed diff. I added new test cases for all
kinds of possible empty line combinations in stub files, test cases for
newlines before trailing module comments.
---------
Co-authored-by: Micha Reiser <micha@reiser.io>
When formatting typeshed (
cargo run --bin ruff_dev -- format-dev --write typeshed
), there is still a big diff with black wrt to empty lines.E.g. given
black will format this as
while we format this as
The task is to go through the typeshed diff and figure out each empty line rule we're still missing. If you implement this you don't need to (and probably shouldn't) fix everything at once but you can implement any part of it (as long as it doesn't decrease the similarity index).
The text was updated successfully, but these errors were encountered: