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

Strip trailing whitespace with pdm-show #680

Merged
merged 1 commit into from
Oct 18, 2021

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Oct 13, 2021

Pull Request Check List

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

pdm-show uses project.core.ui.display, which adds trailing spaces to all the
lines (based on the longest one), which results in them being displayed/wrapped
when the terminal is not wide enough for the longest line:

% pdm show coverage|cat -A
Name:                  coverage                                       …$
Latest version:        6.0.2                                          …$
…
Project URLs:          Documentation: https://coverage.readthedocs.io …$
                       Funding: https://example.com/?utm_source=foobar…$
…

This patch just adds rstrip(), which gets rid of it, while still
keeping the maybe too long underline for the header (not used with
pdm-show).

Maybe this could use $COLUMNS / the terminal width to limit the length
of the header underline, but that is not really needed / not trivial.

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2021

Codecov Report

Merging #680 (fe3a0c2) into main (a5ef1fa) will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #680      +/-   ##
==========================================
- Coverage   83.70%   83.66%   -0.05%     
==========================================
  Files          73       73              
  Lines        6111     6114       +3     
  Branches     1082     1083       +1     
==========================================
  Hits         5115     5115              
- Misses        704      707       +3     
  Partials      292      292              
Flag Coverage Δ
unittests 83.44% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pdm/termui.py 80.15% <ø> (ø)
pdm/models/environment.py 65.87% <0.00%> (-1.61%) ⬇️

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 a5ef1fa...fe3a0c2. Read the comment docs.

@frostming
Copy link
Collaborator

A news fragment is required, thanks

pdm-show uses `project.core.ui.display_columns`, which adds trailing spaces to
all the lines (based on the longest one), which results in them being
displayed/wrapped when the terminal is not wide enough for the longest
line:

```
% pdm show coverage|cat -A
Name:                  coverage                                       …$
Latest version:        6.0.2                                          …$
…
Project URLs:          Documentation: https://coverage.readthedocs.io …$
                       Funding: https://example.com/?utm_source=foobar…$
…
```

This patch just adds `rstrip()`, which gets rid of it, while still
keeping the maybe too long underline for the header (not used with
pdm-show).

Maybe this could use $COLUMNS / the terminal width to limit the length
of the header underline, but that is not really needed / not trivial.
@blueyed
Copy link
Contributor Author

blueyed commented Oct 15, 2021

A news fragment is required, thanks

Added/amended.

@frostming frostming merged commit 1e06fa0 into pdm-project:main Oct 18, 2021
@blueyed blueyed deleted the fix-show-rstrip branch October 25, 2021 22:20
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.

3 participants