Skip to content

Commit

Permalink
Merge pull request #148 from ralimi/support-starlark
Browse files Browse the repository at this point in the history
Add support for Starlark.
  • Loading branch information
alstr authored Feb 28, 2023
2 parents 9430173 + de2352f commit c1b7b83
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
9 changes: 9 additions & 0 deletions syntax.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@
}
]
},
{
"language": "Starlark",
"markers": [
{
"type": "line",
"pattern": "#"
}
]
},
{
"language": "TypeScript",
"markers": [
Expand Down
6 changes: 6 additions & 0 deletions tests/test_closed.diff
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ index 0000000..7cccc5b
- also need to be turned into task, and hopefully
- kept together as one.
- =#
diff --git a/tests/defs.bzl b/tests/defs.bzl
index 525e25d..ba4e68d 100644
--- a/tests/defs.bzl
+++ b/tests/defs.bzl
@@ -0,0 +0,1 @@
- # TODO: Come up with a more imaginative greeting
diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk
new file mode 100644
index 0000000..7cccc5b
Expand Down
14 changes: 14 additions & 0 deletions tests/test_new.diff
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ index 0000000..7cccc5b
+ also need to be turned into task, and hopefully
+ kept together as one.
+ =#
diff --git a/tests/defs.bzl b/tests/defs.bzl
new file mode 100644
index 0000000..525e25d
--- /dev/null
+++ b/tests/defs.bzl
@@ -0,0 +1,23 @@
+def hello_world():
+ # TODO: Come up with a more imaginative greeting
+ print('Hello world')
+
+ # TODO: Do more stuff
+ # This function should probably do something more interesting
+ # labels: help wanted
+ pass
diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk
new file mode 100644
index 0000000..7cccc5b
Expand Down
16 changes: 12 additions & 4 deletions tests/test_todo_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def setUp(self):
self.raw_issues = parser.parse(diff_file)

def test_python_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 4)
# Includes 2 tests for Starlark.
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 6)

def test_yaml_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
Expand Down Expand Up @@ -53,6 +54,9 @@ def test_tex_issues(self):
def test_julia_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'julia'), 2)

def test_starlark_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 6)

def test_autohotkey_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)

Expand Down Expand Up @@ -96,7 +100,8 @@ def setUp(self):
self.raw_issues = parser.parse(diff_file)

def test_python_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 4)
# Includes 1 test for Starlark.
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)

def test_yaml_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
Expand All @@ -123,6 +128,9 @@ def test_tex_issues(self):
def test_julia_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'julia'), 2)

def test_starlark_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)

def test_json5_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)

Expand Down Expand Up @@ -168,7 +176,7 @@ def test_single_ignore(self):
parser.syntax_dict = json.load(syntax_json)
diff_file = open('tests/test_closed.diff', 'r')
self.raw_issues = parser.parse(diff_file)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 4)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 4)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 0)
Expand All @@ -183,7 +191,7 @@ def test_multiple_ignores(self):
parser.syntax_dict = json.load(syntax_json)
diff_file = open('tests/test_closed.diff', 'r')
self.raw_issues = parser.parse(diff_file)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 4)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 0)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 0)
Expand Down

0 comments on commit c1b7b83

Please sign in to comment.