From 3c4a8308eb082713377b435bf7f30f09ada667bd Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Tue, 17 Oct 2023 16:08:24 -0500 Subject: [PATCH] Second minor bugfix to alphabetize-codeowners Trailing "\n" was picked up on whitespace splitting and created "" as an "owner" string. --- README.md | 1 + src/texthooks/alphabetize_codeowners.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 858b074..038360e 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,7 @@ following sample config: ### Unreleased +- Minor whitespace bugfix for `alphabetize-codeowners` ### 0.6.1 diff --git a/src/texthooks/alphabetize_codeowners.py b/src/texthooks/alphabetize_codeowners.py index 442342a..b3cf9d8 100644 --- a/src/texthooks/alphabetize_codeowners.py +++ b/src/texthooks/alphabetize_codeowners.py @@ -48,7 +48,7 @@ def sort_line(line: str) -> str: if line == "" or line.strip().startswith("#"): return line # also normalizes whitespace - dedented = line.lstrip() + dedented = line.lstrip().rstrip() elements = WS_PAT.split(dedented) if len(elements) < 2: return line