Commit Graph

577 Commits

Author SHA1 Message Date
netpoe
c13ebee3c5 fix(test_todo_parser): tests for 'text', removes 'move' 2024-12-28 00:05:25 -06:00
netpoe
7cfb7c0bb3 chore: updates README with Move lang 2024-12-21 22:02:06 -06:00
netpoe
ef064d7382 test: test_closed.diff test_new.diff 2024-12-21 22:00:42 -06:00
netpoe
de37f375ca feat(syntax.json): Move language .move
As defined in https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml
2024-12-21 21:32:30 -06:00
Alastair Mooney
973393389c
Update action.yml 2024-12-16 19:21:01 +00:00
Alastair Mooney
8e25063c43
Merge pull request #254 from antoniogonzalezsuarez/feature/fix_f_string_diff_url
Add {} to fix f-string
2024-12-16 19:17:01 +00:00
antoniogonzalezsuarez
ad1d917043 Add {} to fix f-string 2024-12-16 18:42:20 +00:00
Alastair Mooney
c9ead1ec75
Update action.yml 2024-12-12 16:03:31 +00:00
alstr
84220a48d7 Add diff fallback URL 2024-12-12 16:01:19 +00:00
Alastair Mooney
b64689f916
Update README.md 2024-12-12 15:47:16 +00:00
Alastair Mooney
b5815c5c57
Update README.md
Add note about workflow triggers
2024-12-12 15:39:08 +00:00
Alastair Mooney
770db899ed
Update action.yml 2024-12-12 15:36:13 +00:00
alstr
454715719f Fix diff URL for PRs
Fixes #231
2024-12-12 15:14:28 +00:00
Alastair Mooney
f357c404fe
Update action.yml 2024-12-06 18:31:00 +00:00
alstr
b436b792bc Fix quote marks 2024-12-06 18:29:28 +00:00
Alastair Mooney
5d45b75ef4
Update action.yml 2024-12-06 18:25:48 +00:00
alstr
edf5d49a3c Improve diff error message 2024-12-06 18:22:26 +00:00
Alastair Mooney
3ac81cb165
Update action.yml 2024-11-26 15:25:55 +00:00
alstr
7b4aab7105 Add User-Agent header
Fixes #248
2024-11-22 15:02:37 +00:00
Alastair Mooney
6cf1955119
Merge pull request #246 from rgalonso/fix/handle-different-line-endings
fix: handle different line endings
2024-11-22 09:26:33 +00:00
Robert Alonso
6f69995374 fix: handle presence of tab characters on TODO line
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 #245
2024-11-15 15:07:42 +00:00
Robert Alonso
ad4d65c8b8 fix: handle CRLF and mixed line-ending files
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 #245
2024-11-15 15:07:42 +00:00
Robert Alonso
c10ca453d9 fix: handle issue title line with trailing whitespace
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 #245
2024-11-15 15:07:35 +00:00
Alastair Mooney
5157ba918f
Merge pull request #243 from rgalonso/fix/regex-characters-in-identifier
fix: handle identifier with regex characters
2024-11-12 19:13:01 +00:00
Robert Alonso
2d98b5c359 fix: handle identifier with regex characters
Provides a test for and the solution to GitHub
issue #242. Namely, an identifier which contains
regex characters (e.g. "[TODO]") is properly
handled by having the parser look for literal
"[" and "]" characters rather than treating those
characters as part of a regex pattern. The word
boundary regex pattern '\b' does NOT properly
handle this, so a slightly different pattern is
used to identify the boundary.
2024-11-12 16:34:09 +00:00
Alastair Mooney
59c6b5395c
Merge pull request #241 from rgalonso/fix/handle-todo-comment-suffix
fix: don't include source with issue URL comment
2024-11-12 15:46:38 +00:00
Robert Alonso
948c3e0507 fix: don't include source with issue URL comment
If TODO comment is a suffix to a line of
(executable) source, don't repeat the source
content when inserting the issue URL. But be sure
to still keep the same alignment.

Closes #229
2024-11-12 14:28:40 +00:00
Alastair Mooney
ff0c64d51e
Merge pull request #240 from rgalonso/fix/line-numbering-with-additions-and-deletions
fix: get correct line numbering of old and new lines
2024-11-12 12:54:16 +00:00
Robert Alonso
46218738c9 fix: get correct line numbering of old and new lines
track context of old and new lines separately to
get proper line numbers relative to old and
new version of a file

Closes GitHub #236
2024-11-12 12:18:43 +00:00
Alastair Mooney
f54fbebd3b
Merge pull request #237 from rgalonso/fix/identifier-case-sensitivity-bugs
fix identifier case sensitivity bugs
2024-11-12 10:13:00 +00:00
Robert Alonso
8c28d096ee test: allow test to be an expected success now that bug is fixed
Earlier commit resolved issue #234
2024-11-12 00:18:47 +00:00
Robert Alonso
7ce78256b6 test: allow test to be an expected success now that bug is fixed
Earlier commit resolved issues #216, #224, #225
2024-11-12 00:18:47 +00:00
Robert Alonso
57928cd01e fix: resolve numerous issue stemming from case-(in)sensitivity matching of TODOs
Some parts of the code were using case-insensitive
matches when searching for an identifier (i.e.
TODO and todo would both be acceptable) whereas
other parts of the code would search for a strict
case-sensitive match (only TODO, not todo). This
inconsistency led to many issues, among them
- #216
- #224
- #225

Further, the identifier match wasn't being done
using word breaks, meaning an identifier of "FIX"
would match (case-insensitively) with "suffix" or
"prefix" if those words happened to appear in a
comment. (See #234).

Issue #230 was also preventing issue labels from
being applied properly if the identifier case
did not match exactly the canonical version. i.e.
"todo" would generate an issue, but the associated
labels wouldn't be applied because the exact
identifier used wasn't "TODO".

This commit resolves all of these issues.
2024-11-12 00:18:47 +00:00
Robert Alonso
f0ed571547 test: add test to track additional bugs
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 #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
2024-11-12 00:18:38 +00:00
Robert Alonso
c643aecf02 refactor: optionally output log if _standardTest fails
Defaults True for backwards compatibility
2024-11-11 23:52:41 +00:00
Robert Alonso
69e2360329 test: allow multiple diff files to be consumed
This sets up the ability to have one diff file
create a simulated filesystem and a second to
simulate an edit of an existing file
2024-11-11 23:52:41 +00:00
Robert Alonso
872a997803 test: add tests to capture additional known issues
These tests capture the existing issues #234 and
issue #235. As no solution is in place yet, they're
marked as expected failures.
2024-11-11 23:52:36 +00:00
Robert Alonso
dd15f79ab8 feat: add ability to print Issue object
Facilitates debug and error handling
2024-11-11 17:53:48 +00:00
Robert Alonso
e42bca636e refactor: add optional argument to TodoParser to set configuration
Currently, this is just used to set identifiers
without needing to modify the environment, but this
could (should?) be extended to other options
2024-11-11 17:52:38 +00:00
Alastair Mooney
5aa95f6c12
Merge pull request #228 from rgalonso/bug-fixes
numerous bug fixes
2024-11-11 13:16:30 +00:00
Robert Alonso
2997380286 test: added tests for known bugs
Added tests for issues #224/#225 and #229. Since
these are known bugs, the tests are currently
marked as expected failures. Once the solution
is implemented, that designation can be removed
and we'll still keep the test to make sure there
aren't any regressions.
2024-11-10 04:28:37 +00:00
Robert Alonso
30b3d43dec refactor: consolidate test classes
I initially thought it a good idea to split these
up, but it led to a lot of unnnecessary code
redundancy. This is a better approach.
2024-11-09 19:56:03 +00:00
Robert Alonso
325fbaf03b test: add additional test demonstrating current bug
Added a test which demonstrates a current bug where
if multiple TODOs with the same title appear in
the diff of the same file, only one of those issues
will have its URL succesfully inserted.
(Specifically, the first from the top.) As such,
the test is configured as an expected failure until
such time as the bug can be fixed.
2024-11-09 19:28:09 +00:00
Robert Alonso
61cb584226 refactor: split unit test class to have a common base class 2024-11-09 19:28:09 +00:00
Robert Alonso
d57788aa0b fix: split diff file to allow process_diff unit test to pass
The diff file has a couple of hunks which for
some unknown reason have parsing issues which
result in the wrong line being detected for where
the TODO is. This causes the issue URL insertion
to fail. That's its own issue that should be
investigated, but in order to allow the process_diff
unit test to pass, the diff file is being split
into two to isolate the trouble-causing hunks.
2024-11-09 19:28:09 +00:00
Robert Alonso
246bf5d5bf fix: fix additional formatting issues with diff file
Wrong line numbering is causing issue URLs to not
be inserted when processing this diff file
2024-11-09 19:28:09 +00:00
Robert Alonso
b4b115f060 fix: escape title when searching for comment line
If regex characters are part of the title (for
example, parentheses), then this breaks the ability
to find the comment line when trying to insert
the issue URL. This commit escapes the title
to fix this problem.

Closes github.com/alstr/todo-to-issue-action#226
2024-11-09 19:28:09 +00:00
Robert Alonso
f752af8130 fix: perform case-insensitive search for identifier
When searching for the comment line after which
the issue URL will be inserted, use a case-insensitive
search for the identifier portion of the line.
This matches how TodoParser identifies TODOs using
a case-insensitive search.

Closes github.com/alstr/todo-to-issue-action#224
2024-11-09 19:28:09 +00:00
Robert Alonso
06c95362da fix: safety check before inserting new line
There are issues currently where the wrong text
may be inserted in place of the issue URL. (See
github.com/alstr/todo-to-issue-action issues #224
, #225, and #226, for example.) When such a
situation is detected, the offending line is now
NOT inserted and instead a warning message is
printed out. This doesn't completely resolve
those issues, but mitigates against them and
other similar issues which may arise in the future.
2024-11-09 19:28:09 +00:00
Robert Alonso
cd754de86c test: print message when issue URL has actually been inserted
Insertion of the URL is different from simply
creating/updating the issue, so we want to have
this level of output to ensure that as many
file updates as expected are actually occurring.

Note: The unit test is currently failing!
2024-11-09 19:28:08 +00:00