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
Compared to the result of modifying the file, the output with --stdout contains an additional newline at the end of the file. As I set up my editor to use the stdout to format the file, this would add a extra newline when I run the formatting.
The cause is the print statements here: __main__.py#L257-L270, as print adds a newline at the end. Have changed it to the way I prefer in my local copy by adding end="" to those print statements. Unless the extra newline is in fact wanted, I can make a PR with that change.
How to reproduce:
In an initialized, empty project, run:
$ echo"print('Some test code')"> test.py
$ cat test.py
print('Some test code')
$ darker --stdout test.py
print("Some test code")
$ darker test.py && cat test.py
print("Some test code")
Environment:
darker: commit c5d0f68
python: 3.10
shell: GNU bash
The text was updated successfully, but these errors were encountered:
Thanks @magnunm for the report! I vaguely remember some issue with final newlines when implementing --stdout, but can't of course remember any of the details now. Your example seems to clearly indicate wrong behavior, and a fix should definitely be introduced.
Compared to the result of modifying the file, the output with
--stdout
contains an additional newline at the end of the file. As I set up my editor to use the stdout to format the file, this would add a extra newline when I run the formatting.The cause is the
print
statements here: __main__.py#L257-L270, asprint
adds a newline at the end. Have changed it to the way I prefer in my local copy by addingend=""
to those print statements. Unless the extra newline is in fact wanted, I can make a PR with that change.How to reproduce:
In an initialized, empty project, run:
Environment:
darker: commit c5d0f68
python: 3.10
shell: GNU bash
The text was updated successfully, but these errors were encountered: