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

various whitespace issues #245

Closed
rgalonso opened this issue Nov 14, 2024 · 1 comment · Fixed by #246
Closed

various whitespace issues #245

rgalonso opened this issue Nov 14, 2024 · 1 comment · Fixed by #246

Comments

@rgalonso
Copy link
Contributor

rgalonso commented Nov 14, 2024

There are a number of issues regarding whitespace that affect issue URL insertion.

  • a CRLF (Windows-style line endings) is completely rewritten using LF (Unix-style) line endings
  • a mixed file (both CRLF- and LF-terminated lines) is completely rewritten using LF line endings
  • a CRLF-terminated line will fail to have the issue URL inserted due to being unable to match the line to the issue title
    • this is actually a regression introduced by v5.1.2. Earlier versions would have still inserted the line, albeit with the problems noted above

Goal should be to respect the line endings of the original file as much as possible, regardless of the platform on which the application is running. Most of the above is stemming from the fact that Python's readlines() and writelines() tries to be helpful by, respectively, stripping off line endings when reading and inserting the platform-specific default line endings when writing. A more nuanced approach would be to leave existing lines as-is and only insert the issue URL line (using whatever line ending is appropriate).

(This could/should be multiple issues, but I'm feeling a little lazy and as they'll all be resolved with the same PR, I'm clumping them all together.)


EDIT

Also forgot to mention another issue:

@rgalonso
Copy link
Contributor Author

PR is forthcoming

rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 14, 2024
Fix a regression that was accidentally introduced
with v5.1.2 which could cause an issue URL to not
be successfully added to the source file when
dealing with a CRLF (Windows-style line endings)
file on Linux.

Partially addresses GitHub issue alstr#245
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 14, 2024
Regardless of the OS on which the app is running,
respect the original line endings of the file
when writing back the issue URL. In the case of
a mixed line-ending file (e.g. both Windows-style
CRLF and Unix-style LF), the issue URL comment
line will use the line ending style of the TODO
comment line above it.

Partially addresses GitHub issue alstr#245
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 14, 2024
Ensure alignment of issue URL line is correct even
when the TODO line had any number of tab
characters prior to the issue title

Addresses remaining sub-issues of and
closes GitHub issue alstr#245
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 15, 2024
Fix a regression that was accidentally introduced
with v5.1.2 which could cause an issue URL to not
be successfully added to the source file when
dealing with a CRLF (Windows-style line endings)
file on Linux.

Partially addresses GitHub issue alstr#245
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 15, 2024
Regardless of the OS on which the app is running,
respect the original line endings of the file
when writing back the issue URL. In the case of
a mixed line-ending file (e.g. both Windows-style
CRLF and Unix-style LF), the issue URL comment
line will use the line ending style of the TODO
comment line above it.

Partially addresses GitHub issue alstr#245
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 15, 2024
Ensure alignment of issue URL line is correct even
when the TODO line had any number of tab
characters prior to the issue title

Addresses remaining sub-issues of and
closes GitHub issue alstr#245
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 a pull request may close this issue.

1 participant