test_new.diff had some issues which would cause
errors if trying to actually use the diff file
with 'patch' to create the files it references.
1) had some line numbers which were invalid
2) had path specifications and, unfortunately,
'patch' does not support creating absent directories
The file has been cleaned up to have the create
line numbers and to assume that all files are at
the root.
Additionally, for the few cases where the diff
file referred to an edit rather than creation of a
whole new file, those diff hunks were moved into a
new, separate, file.
There is no functional change with this commit,
but it sets up future test features.
Fix bug where if there were multiple issue URLs
to insert into a file, after the first insertion
all further insertions would copy a "random"
line (based on *original* line numbering) and
insert that copy rather than the issue URL.
Now processes files in order by file name
and then in reverse order by line number,
thereby ensuring that any line insertions/
deletions at bottom of file don't affect
line numbering above them.
Closes github.com/alstr/todo-to-issue-action#225
New unittest file consists of two tests. Both
run mypy, but one does so with arguments that are
expected to allow the test to pass. The other does
not provide those arguments and is expected to fail.
The expected failure is intentional, to serve as
an ongoing reminder to try to 1) move towards having
strict typing in the codebase and to 2) not
add any additional errors/warnings in the meantime.
Separated requirements into runtime (requirements.txt)
and additional development (requirements-dev.txt).
Modified devcontainer and workflow to reflect the
change.
Add additional, non-default, Dockerfile target
which installs app into an ubuntu image. This is
useful for local development and enables other
operations (such as committing back to the repo)
to occur within the container.
There's no reason to have main directly construct
the URL. A different VCS (such as GitLab) could
have a different URL construction. Further, in the
case of LocalClient, there is no URL.
CustomLanguageTest was modifying a few environment
variables and not restoring them when complete. This
led to problems for later tests that expected those
variables to be at their default values.
Add a new method, get_issue_url(), which returns
the VCS-specific web URL for viewing an issue.
This results in moving GitHub-specific code from
main into GitHubClient, but with no change in behavior.
This is just a safe fallback for local testing.
If environment variables which activate the
creation of the GitHub client aren't set, then
the Local client is created. It acts on the most
recent commit of the repo in the working directory.
Minor edit to GitHubClient so that it raises an
EnvironmentError exception if INPUT_GITHUB_URL
environment variable is not defined. This allows
main to detect the error and fall back to trying
to use the Local client
Split main.py into modules to (mostly) isolate the
GitHub-specific code from the general TODO
detection and program logic.
This is both for readability/maintainability and
to prepare for potentially supporting other
version control systems (e.g. GitLab, BitBucket).