Add support for JSON with Comments.

Support is similar to JSON5, except block comments are also supported.
This commit is contained in:
Rich Alimi 2023-02-25 06:22:46 +00:00
parent 9430173992
commit 53f6d2f8fe
4 changed files with 47 additions and 2 deletions

View File

@ -163,6 +163,22 @@
}
]
},
{
"language": "JSON with Comments",
"markers": [
{
"type": "line",
"pattern": "//"
},
{
"type": "block",
"pattern": {
"start": "/\\*",
"end": "\\*/"
}
}
]
},
{
"language": "JSON5",
"markers": [

View File

@ -278,6 +278,12 @@ index 525e25d..ba4e68d 100644
-TODO: Create an issue for TODO
--}
-sum a b = a + b
diff --git a/tests/config.jsonc b/tests/config.jsonc
index 0000000..525e25d 100644
--- a/tests/config.jsonc
+++ b/tests/config.jsonc
@@ -0,0 +0,1 @@
- // TODO: Delete this line from the codebase
diff --git a/tests/config.json5 b/tests/config.json5
index 0000000..525e25d 100644
--- a/tests/config.json5

View File

@ -292,6 +292,23 @@ index 0000000..525e25d
+ # This function should probably do something more interesting
+ # labels: help wanted
+}
diff --git a/tests/config.jsonc b/tests/config.jsonc
new file mode 100644
index 0000000..525e25d
--- /dev/null
+++ b/tests/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/tests/config.json5 b/tests/config.json5
new file mode 100644
index 0000000..525e25d

View File

@ -34,8 +34,11 @@ class NewIssueTests(unittest.TestCase):
def test_java_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
def test_json_with_comments_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
def test_json5_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
def test_ruby_issues(self):
# Includes 2 tests for Crystal.
@ -123,8 +126,11 @@ class ClosedIssueTests(unittest.TestCase):
def test_julia_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'julia'), 2)
def test_json_with_comments_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
def test_json5_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2)
def test_autohotkey_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)