mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
fix: check filename if no extensions match
This commit is contained in:
parent
165cd5e4f7
commit
1ff063b19e
4
main.py
4
main.py
@ -564,11 +564,13 @@ class TodoParser(object):
|
||||
"""Try and get the Markdown language and comment syntax data for the given file."""
|
||||
file_name, extension = os.path.splitext(os.path.basename(file))
|
||||
for language_name in self.languages_dict:
|
||||
# Check if the file extension matches the language's extensions.
|
||||
if extension != "" and 'extensions' in self.languages_dict[language_name]:
|
||||
syntax_details, ace_mode = self._get_language_details(language_name, 'extensions', extension)
|
||||
if syntax_details is not None and ace_mode is not None:
|
||||
return syntax_details, ace_mode
|
||||
elif 'filenames' in self.languages_dict[language_name]:
|
||||
# Check if the file name matches the language's filenames.
|
||||
if 'filenames' in self.languages_dict[language_name]:
|
||||
syntax_details, ace_mode = self._get_language_details(language_name, 'filenames', file_name)
|
||||
if syntax_details is not None and ace_mode is not None:
|
||||
return syntax_details, ace_mode
|
||||
|
||||
@ -201,6 +201,20 @@ index 0000000..525e25d
|
||||
+ # This function should probably do something more interesting
|
||||
+ # labels: help wanted
|
||||
+ pass
|
||||
diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel
|
||||
new file mode 100644
|
||||
index 0000000..525e25d
|
||||
--- /dev/null
|
||||
+++ b/tests/BUILD.bazel
|
||||
@@ -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
|
||||
|
||||
@ -24,7 +24,7 @@ class NewIssueTests(unittest.TestCase):
|
||||
|
||||
def test_python_issues(self):
|
||||
# Includes 2 tests for Starlark.
|
||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 6)
|
||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 8)
|
||||
|
||||
def test_yaml_issues(self):
|
||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
|
||||
@ -56,7 +56,7 @@ class NewIssueTests(unittest.TestCase):
|
||||
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)
|
||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 8)
|
||||
|
||||
def test_autohotkey_issues(self):
|
||||
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user