From 679302c25a2036f7e1405fd8d194e6d3e4d0e7a8 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:39:21 +0200 Subject: [PATCH] feat: add mdx style comments --- main.py | 2 +- syntax.json | 15 +++++++++++---- tests/test_closed.diff | 12 ++++++++++++ tests/test_new.diff | 12 ++++++++++++ tests/test_todo_parser.py | 6 ++++++ 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index b1ec73e..8573d1c 100644 --- a/main.py +++ b/main.py @@ -308,7 +308,7 @@ class TodoParser(object): raise Exception('Cannot retrieve languages data. Operation will abort.') # Load the comment syntax data for identifying comments. - syntax_url = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/master/syntax.json' + syntax_url = 'https://raw.githubusercontent.com/thomasfkjorna/todo-to-issue-action/master/syntax.json' syntax_request = requests.get(url=syntax_url) if syntax_request.status_code == 200: self.syntax_dict = syntax_request.json() diff --git a/syntax.json b/syntax.json index 374112e..24f27e0 100644 --- a/syntax.json +++ b/syntax.json @@ -365,6 +365,13 @@ "start": "" } + }, + { + "type": "block", + "pattern": { + "start": "{/\\*", + "end": "\\*/}" + } } ] }, @@ -546,7 +553,7 @@ }, { "language": "HCL", - "markers" : [ + "markers": [ { "type": "line", "pattern": "#" @@ -566,7 +573,7 @@ }, { "language": "SCSS", - "markers" : [ + "markers": [ { "type": "line", "pattern": "//" @@ -578,11 +585,11 @@ "end": "\\*/" } } - ] + ] }, { "language": "Twig", - "markers" : [ + "markers": [ { "type": "block", "pattern": { diff --git a/tests/test_closed.diff b/tests/test_closed.diff index d7190f1..9f41f9a 100644 --- a/tests/test_closed.diff +++ b/tests/test_closed.diff @@ -222,3 +222,15 @@ index 525e25d..ba4e68d 100644 - also need to be turned into todos, and hopefully - kept together as one todo - #} +diff --git a/tests/example_file.md b/src/tests/example_file.md +index 525e25d..ba4e68d 100644 +--- a/src/tests/example_file.md ++++ b/src/tests/example_file.md +@@ -1,6 +0,0 @@ +- {/* TODO: Hopefully this comment turns into a todo issue */} +- {/* +- TODO:Multiline comments +- also need to be turned into todos, and hopefully +- kept together as one todo +- */} + diff --git a/tests/test_new.diff b/tests/test_new.diff index 690698e..6e747cb 100644 --- a/tests/test_new.diff +++ b/tests/test_new.diff @@ -232,3 +232,15 @@ index 0000000..7cccc5b + also need to be turned into todos, and hopefully + kept together as one todo + #} +diff --git a/tests/example_file.md b/src/tests/example_file.md +new file mode 100644 +index 0000000..7cccc5b +--- /dev/null ++++ b/src/tests/example_file.md +@@ -0,0 +1,6 @@ ++ {/* TODO: Hopefully this comment turns into a todo issue */} ++ {/* ++ TODO:Multiline comments ++ also need to be turned into todos, and hopefully ++ kept together as one todo ++ */} diff --git a/tests/test_todo_parser.py b/tests/test_todo_parser.py index 2c1e671..c3c0c09 100644 --- a/tests/test_todo_parser.py +++ b/tests/test_todo_parser.py @@ -64,6 +64,9 @@ class NewIssueTests(unittest.TestCase): def test_twig_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'twig'), 2) + def test_md_issues(self): + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'md'), 2) + class ClosedIssueTests(unittest.TestCase): # Check for removed TODOs across the files specified. @@ -117,6 +120,9 @@ class ClosedIssueTests(unittest.TestCase): def test_twig_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'twig'), 2) + def test_md_issues(self): + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'md'), 2) + class IgnorePatternTests(unittest.TestCase):