-
Notifications
You must be signed in to change notification settings - Fork 86
fix: resolve several empty line regressions #330
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
base: master
Are you sure you want to change the base?
Conversation
|
Thank you @finswimmer , with One issue remains in my project - when a class is preceded by a comment, Demonstration script: #!/usr/bin/env bash
set -euo pipefail
DOCFORMATTER_STABLE="docformatter==1.7.7"
DOCFORMATTER_FINSWIMMER_REF="git+https://github.com/finswimmer/docformatter@fea4116e01435bfcce31de936f8549b1b64ca025"
ORIGINAL_CONTENT=$'class A:\n """Hello."""\n\n\n# Some comment\nclass B:\n """Hello."""\n'
echo "Initial content:"
printf '%s' "$ORIGINAL_CONTENT"
echo "------"
echo
echo "docformatter stable (${DOCFORMATTER_STABLE}):"
printf '%s' "$ORIGINAL_CONTENT" | uvx --python=3.13 --from "${DOCFORMATTER_STABLE}" docformatter --black -
echo "------"
echo
echo "docformatter finswimmer (${DOCFORMATTER_FINSWIMMER_REF}):"
printf '%s' "$ORIGINAL_CONTENT" | uvx --python=3.13 --from "${DOCFORMATTER_FINSWIMMER_REF}" docformatter --black -
echo "------"Output: |
fea4116 to
948c28a
Compare
|
Thanks a lot for the feedback @adamtheturtle Can you try again please? |
|
Thank you @finswimmer . The next issues I've hit are demonstrated here. Failure with CRLFThis errors on this branch. #!/usr/bin/env bash
set -euo pipefail
DOCFORMATTER_STABLE="docformatter==1.7.7"
DOCFORMATTER_FINSWIMMER_REF="git+https://github.com/finswimmer/docformatter@948c28a5d43106bad3ec796fdf26f87cbdaee085"
ORIGINAL_CONTENT=$'"""\nA\n"""\n\npass\n\npass\n'
CRLF_CONTENT=$(printf '%s' "$ORIGINAL_CONTENT" | sed 's/$/\r/')
echo "Initial content (with CRLF):"
printf '%s' "$CRLF_CONTENT"
echo "------"
echo
echo "docformatter stable (${DOCFORMATTER_STABLE}):"
printf '%s' "$CRLF_CONTENT" | uvx --python=3.13 --from "${DOCFORMATTER_STABLE}" docformatter --black -
echo "------"
echo
echo "docformatter finswimmer (${DOCFORMATTER_FINSWIMMER_REF}):"
printf '%s' "$CRLF_CONTENT" | uvx --python=3.13 --from "${DOCFORMATTER_FINSWIMMER_REF}" docformatter --black -
echo "------"Incompatibility with
|
948c28a to
264cad5
Compare
|
The CRLF issue should be fixed. I'm not sure how to handle the conflict with black. The code clearly says, that it will ensure 2 empty line follow the module docstring. I couldn't find enough information what the current behavior of black should. There are some older issue that state that 2 lines are intended, e.g. psf/black#4027 So can you please open a separate issue for this and hopefully @weibullguy can clarify how they like to proceed with this? fin swimmer |
|
Thank you @finswimmer . I have created #331. |
This PR fixes a couple of regressions regarding handling line breaks and empty line.
...as code lines, so that empty line handling works correct\r\nare usedCloses: #328