mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
feat: add support for JSON5
This commit is contained in:
parent
9e57f4e103
commit
7032c76bc5
@ -84,6 +84,7 @@ There are additional inputs if you want to be able to assign issues to projects.
|
|||||||
* HTML
|
* HTML
|
||||||
* Java
|
* Java
|
||||||
* JavaScript
|
* JavaScript
|
||||||
|
* JSON5
|
||||||
* Julia
|
* Julia
|
||||||
* Kotlin
|
* Kotlin
|
||||||
* Less
|
* Less
|
||||||
@ -109,7 +110,7 @@ There are additional inputs if you want to be able to assign issues to projects.
|
|||||||
* Vue
|
* Vue
|
||||||
* YAML
|
* YAML
|
||||||
|
|
||||||
New languages can easily be added to the `syntax.json` file used by the action to identify TODO comments. When adding languages, follow the structure of existing entries, and use the language name defined by GitHub in [`languages.yml`](https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml). PRs adding new languages are welcome and appreciated. Please add a test for your language in order for your PR to be accepted.
|
New languages can easily be added to the `syntax.json` file used by the action to identify TODO comments. When adding languages, follow the structure of existing entries, and use the language name defined by GitHub in [`languages.yml`](https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml). PRs adding new languages are welcome and appreciated. Please add a test for your language in order for your PR to be accepted.
|
||||||
|
|
||||||
## TODO Options
|
## TODO Options
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ Issues are created whenever the action runs and finds a newly added TODO in the
|
|||||||
|
|
||||||
If you do encounter any problems, please file an issue or submit a PR. Everyone is welcome and encouraged to contribute.
|
If you do encounter any problems, please file an issue or submit a PR. Everyone is welcome and encouraged to contribute.
|
||||||
|
|
||||||
## Running tests locally
|
## Running tests locally
|
||||||
|
|
||||||
To run the tests locally, simply run the following in the main repo:
|
To run the tests locally, simply run the following in the main repo:
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@ -650,4 +650,4 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -63,7 +63,7 @@ index 525e25d..ba4e68d 100644
|
|||||||
-def my_method(arg):
|
-def my_method(arg):
|
||||||
- """
|
- """
|
||||||
- TODO: Second multiline comment
|
- TODO: Second multiline comment
|
||||||
- also need to be turned into task, and hopefully
|
- also need to be turned into task, and hopefully
|
||||||
- kept together as one.
|
- kept together as one.
|
||||||
- """
|
- """
|
||||||
- pass
|
- pass
|
||||||
@ -71,7 +71,7 @@ index 525e25d..ba4e68d 100644
|
|||||||
-def MyClass:
|
-def MyClass:
|
||||||
- '''
|
- '''
|
||||||
- TODO: Third multiline comment
|
- TODO: Third multiline comment
|
||||||
- also need to be turned into task, and hopefully
|
- also need to be turned into task, and hopefully
|
||||||
- kept together as one.
|
- kept together as one.
|
||||||
- '''
|
- '''
|
||||||
- pass
|
- pass
|
||||||
@ -156,7 +156,7 @@ index 0000000..7cccc5b
|
|||||||
- # TODO: Hopefully this comment turns into an issue
|
- # TODO: Hopefully this comment turns into an issue
|
||||||
- print("Hello World")
|
- print("Hello World")
|
||||||
- #= TODO: Multiline comments
|
- #= TODO: Multiline comments
|
||||||
- also need to be turned into task, and hopefully
|
- also need to be turned into task, and hopefully
|
||||||
- kept together as one.
|
- kept together as one.
|
||||||
- =#
|
- =#
|
||||||
diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk
|
diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk
|
||||||
@ -168,7 +168,7 @@ index 0000000..7cccc5b
|
|||||||
- ; TODO: Find a better way to manage hotkeys
|
- ; TODO: Find a better way to manage hotkeys
|
||||||
- ; Maybe just switch to vim??
|
- ; Maybe just switch to vim??
|
||||||
- #h::
|
- #h::
|
||||||
- RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
|
- RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
|
||||||
diff --git a/tests/example_file.hbs b/src/tests/example_file.hbs
|
diff --git a/tests/example_file.hbs b/src/tests/example_file.hbs
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..7cccc5b
|
index 0000000..7cccc5b
|
||||||
@ -176,7 +176,7 @@ index 0000000..7cccc5b
|
|||||||
+++ b/src/tests/example_file.hbs
|
+++ b/src/tests/example_file.hbs
|
||||||
@@ -0,0 +1,2 @@
|
@@ -0,0 +1,2 @@
|
||||||
- <!-- TODO: Hopefully this comment turns into a todo issue -->
|
- <!-- TODO: Hopefully this comment turns into a todo issue -->
|
||||||
- {{!
|
- {{!
|
||||||
- TODO: Make a handlebar templtate
|
- TODO: Make a handlebar templtate
|
||||||
- This is really just a test, but hopefully this works~!
|
- This is really just a test, but hopefully this works~!
|
||||||
- }}
|
- }}
|
||||||
@ -192,7 +192,7 @@ index 0000000..7cccc5b
|
|||||||
- #+end_src
|
- #+end_src
|
||||||
- #+begin_comment
|
- #+begin_comment
|
||||||
- TODO: Multiline comments
|
- TODO: Multiline comments
|
||||||
- also need to be turned into todos, and hopefully
|
- also need to be turned into todos, and hopefully
|
||||||
- kept together as one todo
|
- kept together as one todo
|
||||||
- #+end_comment
|
- #+end_comment
|
||||||
diff --git a/tests/example_file.scss b/tests/example_file.scss
|
diff --git a/tests/example_file.scss b/tests/example_file.scss
|
||||||
@ -205,9 +205,9 @@ index 525e25d..ba4e68d 100644
|
|||||||
- font-weight: bold;
|
- font-weight: bold;
|
||||||
- .my-second-class {
|
- .my-second-class {
|
||||||
- /* TODO: Multiline comments
|
- /* TODO: Multiline comments
|
||||||
- * also need to be turned into todos, and hopefully
|
- * also need to be turned into todos, and hopefully
|
||||||
- * kept together as one todo
|
- * kept together as one todo
|
||||||
- */
|
- */
|
||||||
- text-align: center;
|
- text-align: center;
|
||||||
- }
|
- }
|
||||||
-}
|
-}
|
||||||
@ -277,4 +277,11 @@ index 525e25d..ba4e68d 100644
|
|||||||
-
|
-
|
||||||
-TODO: Create an issue for TODO
|
-TODO: Create an issue for TODO
|
||||||
--}
|
--}
|
||||||
-sum a b = a + b
|
-sum a b = a + b
|
||||||
|
|
||||||
|
diff --git a/tests/config.json5 b/tests/config.json5
|
||||||
|
index 0000000..525e25d 100644
|
||||||
|
--- a/tests/config.json5
|
||||||
|
+++ b/tests/config.json5
|
||||||
|
@@ -0,0 +0,1 @@
|
||||||
|
- // TODO: Delete this line from the codebase
|
||||||
|
|||||||
@ -85,7 +85,7 @@ index 0000000..0ce9b1a
|
|||||||
+++ b/src/Swarm/Game/example.hs
|
+++ b/src/Swarm/Game/example.hs
|
||||||
@@ -0,0 +1,14 @@
|
@@ -0,0 +1,14 @@
|
||||||
+-- | Standard devices that are always installed.
|
+-- | Standard devices that are always installed.
|
||||||
+--
|
+--
|
||||||
+-- TODO: Remove standard devices
|
+-- TODO: Remove standard devices
|
||||||
+-- In the future, make a way to build these and just start the base
|
+-- In the future, make a way to build these and just start the base
|
||||||
+-- out with a large supply of each?
|
+-- out with a large supply of each?
|
||||||
@ -184,7 +184,7 @@ index 0000000..7cccc5b
|
|||||||
+ # TODO: Hopefully this comment turns into an issue
|
+ # TODO: Hopefully this comment turns into an issue
|
||||||
+ print("Hello World")
|
+ print("Hello World")
|
||||||
+ #= TODO: Multiline comments
|
+ #= TODO: Multiline comments
|
||||||
+ also need to be turned into task, and hopefully
|
+ also need to be turned into task, and hopefully
|
||||||
+ kept together as one.
|
+ kept together as one.
|
||||||
+ =#
|
+ =#
|
||||||
diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk
|
diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk
|
||||||
@ -196,7 +196,7 @@ index 0000000..7cccc5b
|
|||||||
+ ; TODO: Find a better way to manage hotkeys
|
+ ; TODO: Find a better way to manage hotkeys
|
||||||
+ ; Maybe just switch to vim??
|
+ ; Maybe just switch to vim??
|
||||||
+ #h::
|
+ #h::
|
||||||
+ RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
|
+ RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
|
||||||
diff --git a/tests/example_file.hbs b/src/tests/example_file.hbs
|
diff --git a/tests/example_file.hbs b/src/tests/example_file.hbs
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..7cccc5b
|
index 0000000..7cccc5b
|
||||||
@ -204,7 +204,7 @@ index 0000000..7cccc5b
|
|||||||
+++ b/src/tests/example_file.hbs
|
+++ b/src/tests/example_file.hbs
|
||||||
@@ -0,0 +1,2 @@
|
@@ -0,0 +1,2 @@
|
||||||
+ <!-- TODO: Hopefully this comment turns into a todo issue -->
|
+ <!-- TODO: Hopefully this comment turns into a todo issue -->
|
||||||
+ {{!
|
+ {{!
|
||||||
+ TODO: Make a handlebar templtate
|
+ TODO: Make a handlebar templtate
|
||||||
+ This is really just a test, but hopefully this works~!
|
+ This is really just a test, but hopefully this works~!
|
||||||
+ }}
|
+ }}
|
||||||
@ -220,7 +220,7 @@ index 0000000..7cccc5b
|
|||||||
+ #+end_src
|
+ #+end_src
|
||||||
+ #+begin_comment
|
+ #+begin_comment
|
||||||
+ TODO: Multiline comments
|
+ TODO: Multiline comments
|
||||||
+ also need to be turned into todos, and hopefully
|
+ also need to be turned into todos, and hopefully
|
||||||
+ kept together as one todo
|
+ kept together as one todo
|
||||||
+ #+end_comment
|
+ #+end_comment
|
||||||
diff --git a/tests/example_file.scss b/src/tests/example_file.scss
|
diff --git a/tests/example_file.scss b/src/tests/example_file.scss
|
||||||
@ -234,9 +234,9 @@ index 0000000..7cccc5b
|
|||||||
+ font-weight: bold;
|
+ font-weight: bold;
|
||||||
+ .my-second-class {
|
+ .my-second-class {
|
||||||
+ /* TODO: Multiline comments
|
+ /* TODO: Multiline comments
|
||||||
+ * also need to be turned into todos, and hopefully
|
+ * also need to be turned into todos, and hopefully
|
||||||
+ * kept together as one todo
|
+ * kept together as one todo
|
||||||
+ */
|
+ */
|
||||||
+ text-align: center;
|
+ text-align: center;
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
@ -259,7 +259,7 @@ index 0000000..7cccc5b
|
|||||||
+++ b/src/tests/example_file.md
|
+++ b/src/tests/example_file.md
|
||||||
@@ -0,0 +1,7 @@
|
@@ -0,0 +1,7 @@
|
||||||
+ {/* TODO: Hopefully this comment turns into a todo issue */}
|
+ {/* TODO: Hopefully this comment turns into a todo issue */}
|
||||||
+ {/*
|
+ {/*
|
||||||
+ TODO:Multiline comments
|
+ TODO:Multiline comments
|
||||||
+ also need to be turned into todos, and hopefully
|
+ also need to be turned into todos, and hopefully
|
||||||
+ kept together as one todo
|
+ kept together as one todo
|
||||||
@ -272,7 +272,7 @@ index 0000000..7cccc5b
|
|||||||
+++ b/src/tests/example_file.mdx
|
+++ b/src/tests/example_file.mdx
|
||||||
@@ -0,0 +1,7 @@
|
@@ -0,0 +1,7 @@
|
||||||
+ {/* TODO: Hopefully this comment turns into a todo issue */}
|
+ {/* TODO: Hopefully this comment turns into a todo issue */}
|
||||||
+ {/*
|
+ {/*
|
||||||
+ TODO:Multiline comments
|
+ TODO:Multiline comments
|
||||||
+ also need to be turned into todos, and hopefully
|
+ also need to be turned into todos, and hopefully
|
||||||
+ kept together as one todo
|
+ kept together as one todo
|
||||||
@ -292,17 +292,17 @@ index 0000000..525e25d
|
|||||||
+ # This function should probably do something more interesting
|
+ # This function should probably do something more interesting
|
||||||
+ # labels: help wanted
|
+ # labels: help wanted
|
||||||
+}
|
+}
|
||||||
diff --git a/tests/example_file.r b/tests/config.json5
|
diff --git a/tests/config.json5 b/tests/config.json5
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..525f56e
|
index 0000000..525e25d
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/tests/example_file.json5
|
+++ b/tests/config.json5
|
||||||
@@ -0,0 +1,7 @@
|
@@ -0,0 +0,8 @@
|
||||||
+{
|
+{
|
||||||
+ "myConfig": [
|
+ "myConfig": [
|
||||||
+ // GitRepository where 'Git release/tag' matches 'Helm' version
|
+ // GitRepository where 'Git release/tag' matches 'Helm' version
|
||||||
+ "itIsWonderful",
|
+ "itIsWonderful",
|
||||||
+ // TODO: Delete this line from the codebase
|
+ // TODO: Delete this line from the codebase
|
||||||
+ "butItHasSomePendingActivities"
|
+ "butItHasSomePendingActivities"
|
||||||
+ ]
|
+ ]
|
||||||
+}
|
+}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class NewIssueTests(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
diff_file = open('tests/test_new.diff', 'r')
|
diff_file = open('tests/test_new.diff', 'r')
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
with open('syntax.json', 'r') as syntax_json:
|
with open('syntax.json', 'r') as syntax_json:
|
||||||
parser.syntax_dict = json.load(syntax_json)
|
parser.syntax_dict = json.load(syntax_json)
|
||||||
self.raw_issues = parser.parse(diff_file)
|
self.raw_issues = parser.parse(diff_file)
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class NewIssueTests(unittest.TestCase):
|
|||||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
|
||||||
|
|
||||||
def test_json5_issues(self):
|
def test_json5_issues(self):
|
||||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'json5'), 1)
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)
|
||||||
|
|
||||||
def test_ruby_issues(self):
|
def test_ruby_issues(self):
|
||||||
# Includes 2 tests for Crystal.
|
# Includes 2 tests for Crystal.
|
||||||
@ -69,7 +69,7 @@ class NewIssueTests(unittest.TestCase):
|
|||||||
|
|
||||||
def test_md_issues(self):
|
def test_md_issues(self):
|
||||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 6)
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 6)
|
||||||
|
|
||||||
def test_r_issues(self):
|
def test_r_issues(self):
|
||||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'r'), 2)
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'r'), 2)
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class ClosedIssueTests(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
diff_file = open('tests/test_closed.diff', 'r')
|
diff_file = open('tests/test_closed.diff', 'r')
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
with open('syntax.json', 'r') as syntax_json:
|
with open('syntax.json', 'r') as syntax_json:
|
||||||
parser.syntax_dict = json.load(syntax_json)
|
parser.syntax_dict = json.load(syntax_json)
|
||||||
self.raw_issues = parser.parse(diff_file)
|
self.raw_issues = parser.parse(diff_file)
|
||||||
|
|
||||||
@ -114,6 +114,9 @@ class ClosedIssueTests(unittest.TestCase):
|
|||||||
def test_julia_issues(self):
|
def test_julia_issues(self):
|
||||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'julia'), 2)
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'julia'), 2)
|
||||||
|
|
||||||
|
def test_json5_issues(self):
|
||||||
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)
|
||||||
|
|
||||||
def test_autohotkey_issues(self):
|
def test_autohotkey_issues(self):
|
||||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)
|
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)
|
||||||
|
|
||||||
@ -144,7 +147,7 @@ class IgnorePatternTests(unittest.TestCase):
|
|||||||
def test_single_ignore(self):
|
def test_single_ignore(self):
|
||||||
os.environ['INPUT_IGNORE'] = '.*\\.java'
|
os.environ['INPUT_IGNORE'] = '.*\\.java'
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
with open('syntax.json', 'r') as syntax_json:
|
with open('syntax.json', 'r') as syntax_json:
|
||||||
parser.syntax_dict = json.load(syntax_json)
|
parser.syntax_dict = json.load(syntax_json)
|
||||||
diff_file = open('tests/test_closed.diff', 'r')
|
diff_file = open('tests/test_closed.diff', 'r')
|
||||||
self.raw_issues = parser.parse(diff_file)
|
self.raw_issues = parser.parse(diff_file)
|
||||||
@ -159,7 +162,7 @@ class IgnorePatternTests(unittest.TestCase):
|
|||||||
def test_multiple_ignores(self):
|
def test_multiple_ignores(self):
|
||||||
os.environ['INPUT_IGNORE'] = '.*\\.java, tests/example-file\\.php'
|
os.environ['INPUT_IGNORE'] = '.*\\.java, tests/example-file\\.php'
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
with open('syntax.json', 'r') as syntax_json:
|
with open('syntax.json', 'r') as syntax_json:
|
||||||
parser.syntax_dict = json.load(syntax_json)
|
parser.syntax_dict = json.load(syntax_json)
|
||||||
diff_file = open('tests/test_closed.diff', 'r')
|
diff_file = open('tests/test_closed.diff', 'r')
|
||||||
self.raw_issues = parser.parse(diff_file)
|
self.raw_issues = parser.parse(diff_file)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user