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.
This commit is contained in:
Robert Alonso 2024-11-08 21:59:19 +00:00
parent 246bf5d5bf
commit d57788aa0b
4 changed files with 39 additions and 36 deletions

View File

@ -347,37 +347,6 @@ index 0000000..525e25d
+++ b/example_file.qmd
@@ -0,0 +0,1 @@
+<!-- TODO: Check RMarkdown comments work -->
diff --git a/config.jsonc b/config.jsonc
new file mode 100644
index 0000000..525e25d
--- /dev/null
+++ b/config.jsonc
@@ -0,0 +0,11 @@
+{
+ "myConfig": [
+ /*
+ GitRepository where 'Git release/tag'
+ matches 'Helm' version
+ */
+ "itIsWonderful",
+ // TODO: Delete this line from the codebase
+ "butItHasSomePendingActivities"
+ ]
+}
diff --git a/config.json5 b/config.json5
new file mode 100644
index 0000000..525e25d
--- /dev/null
+++ b/config.json5
@@ -0,0 +0,8 @@
+{
+ "myConfig": [
+ // GitRepository where 'Git release/tag' matches 'Helm' version
+ "itIsWonderful",
+ // TODO: Delete this line from the codebase
+ "butItHasSomePendingActivities"
+ ]
+}
diff --git a/example.clj b/example.clj
new file mode 100644
index 0000000..525e25d

31
tests/test_new2.diff Normal file
View File

@ -0,0 +1,31 @@
diff --git a/config.jsonc b/config.jsonc
new file mode 100644
index 0000000..525e25d
--- /dev/null
+++ b/config.jsonc
@@ -0,0 +0,11 @@
+{
+ "myConfig": [
+ /*
+ GitRepository where 'Git release/tag'
+ matches 'Helm' version
+ */
+ "itIsWonderful",
+ // TODO: Delete this line from the codebase
+ "butItHasSomePendingActivities"
+ ]
+}
diff --git a/config.json5 b/config.json5
new file mode 100644
index 0000000..525e25d
--- /dev/null
+++ b/config.json5
@@ -0,0 +0,8 @@
+{
+ "myConfig": [
+ // GitRepository where 'Git release/tag' matches 'Helm' version
+ "itIsWonderful",
+ // TODO: Delete this line from the codebase
+ "butItHasSomePendingActivities"
+ ]
+}

View File

@ -48,7 +48,7 @@ class IssueUrlInsertionTest(unittest.TestCase):
# process the diffs
process_diff(diff=self.diff_file, insert_issue_urls=True, parser=self.parser, output=output)
# make sure the number of issue URL comments inserted is as expected
self.assertEqual(output.getvalue().count('Issue URL successfully inserted'), 82)
self.assertEqual(output.getvalue().count('Issue URL successfully inserted'), 80)
def tearDown(self):
# return to original working directory to ensure we don't mess up other tests

View File

@ -16,13 +16,16 @@ def count_issues_for_file_type(raw_issues, file_type):
class NewIssueTest(unittest.TestCase):
# Check for newly added TODOs across the files specified.
def setUp(self):
diff_file = open('tests/test_new.diff', 'r')
diff_file2 = open('tests/test_edit.diff', 'r')
parser = TodoParser()
self.raw_issues = []
with open('syntax.json', 'r') as syntax_json:
parser.syntax_dict = json.load(syntax_json)
self.raw_issues = parser.parse(diff_file)
self.raw_issues.extend(parser.parse(diff_file2))
with open('tests/test_new.diff', 'r') as diff_file:
self.raw_issues.extend(parser.parse(diff_file))
with open('tests/test_new2.diff', 'r') as diff_file:
self.raw_issues.extend(parser.parse(diff_file))
with open('tests/test_edit.diff', 'r') as diff_file:
self.raw_issues.extend(parser.parse(diff_file))
def test_python_issues(self):
# Includes 4 tests for Starlark.