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

line numbers are mis-calculated when additions and deletions are in same diff #236

Closed
rgalonso opened this issue Nov 11, 2024 · 2 comments
Closed

Comments

@rgalonso
Copy link
Contributor

If a file's diff contains both additions and deletions, line numbers aren't calculated correctly. This prevents the issue URL comment from being inserted at the correct line. It also causes the generated issue to reference the wrong line number.

@rgalonso
Copy link
Contributor Author

Solution implemented in upcoming PR

rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 12, 2024
Several related bugs that stem from a diff that
contains both deletions and additions. Specifically,
the line numbers aren't counted correctly, leading
to
- issue URL can't be inserted because it can't find
  the right line in the latest file
- generated issue references the wrong line number
- closed issue references the wrong line number

See GitHub issue alstr#236

The last item might not have any actual impact as
(I think) it's just informational. But it'd still
be better if it reported the correct line number
of the deletion, which necessarily has to be
relative to the _old_ file's line number, not the
updated file's.

As there is no solution in place yet for these
bugs, the unittest is marked as an expected failure
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 12, 2024
Several related bugs that stem from a diff that
contains both deletions and additions. Specifically,
the line numbers aren't counted correctly, leading
to
- issue URL can't be inserted because it can't find
  the right line in the latest file
- generated issue references the wrong line number
- closed issue references the wrong line number

See GitHub issue alstr#236

The last item might not have any actual impact as
(I think) it's just informational. But it'd still
be better if it reported the correct line number
of the deletion, which necessarily has to be
relative to the _old_ file's line number, not the
updated file's.

As there is no solution in place yet for these
bugs, the unittest is marked as an expected failure
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 12, 2024
track context of old and new lines separately to
get proper line numbers relative to old and
new version of a file

Closes GitHub alstr#236
rgalonso added a commit to rgalonso/todo-to-issue-action that referenced this issue Nov 12, 2024
track context of old and new lines separately to
get proper line numbers relative to old and
new version of a file

Closes GitHub alstr#236
@alstr
Copy link
Owner

alstr commented Nov 22, 2024

I think this is fixed now so I'll close.

@alstr alstr closed this as completed Nov 22, 2024
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

No branches or pull requests

2 participants