mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
Fixed typo
This commit is contained in:
parent
f95e764cfd
commit
493e0c4993
@ -81,7 +81,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
LANGUAGES:
|
LANGUAGES:
|
||||||
description: 'A collection of comma-delimited URLs or local paths starting from the current working directory of the action for costume languages'
|
description: 'A collection of comma-delimited URLs or local paths starting from the current working directory of the action for custom languages'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
NO_STANDARD:
|
NO_STANDARD:
|
||||||
|
|||||||
12
main.py
12
main.py
@ -337,22 +337,22 @@ class TodoParser(object):
|
|||||||
self.syntax_dict = []
|
self.syntax_dict = []
|
||||||
self.languages_dict = {}
|
self.languages_dict = {}
|
||||||
|
|
||||||
costume_languages = os.getenv('INPUT_LANGUAGES', '')
|
custom_languages = os.getenv('INPUT_LANGUAGES', '')
|
||||||
if costume_languages != '':
|
if custom_languages != '':
|
||||||
# Load all costume languages
|
# Load all custom languages
|
||||||
for path in costume_languages.split(','):
|
for path in custom_languages.split(','):
|
||||||
try:
|
try:
|
||||||
# Decide if the path is a url or local file
|
# Decide if the path is a url or local file
|
||||||
if path.startswith('http'):
|
if path.startswith('http'):
|
||||||
languages_request = requests.get(path)
|
languages_request = requests.get(path)
|
||||||
if languages_request.status_code != 200:
|
if languages_request.status_code != 200:
|
||||||
print('Cannot retrieve costume language file. (\''+path+'\')')
|
print('Cannot retrieve custom language file. (\''+path+'\')')
|
||||||
continue
|
continue
|
||||||
data = languages_request.json()
|
data = languages_request.json()
|
||||||
else:
|
else:
|
||||||
path = os.path.join(os.getcwd(), path)
|
path = os.path.join(os.getcwd(), path)
|
||||||
if not os.path.exists(path) or not os.path.isfile(path):
|
if not os.path.exists(path) or not os.path.isfile(path):
|
||||||
print('Cannot retrieve costume language file. (\''+path+'\')')
|
print('Cannot retrieve custom language file. (\''+path+'\')')
|
||||||
continue
|
continue
|
||||||
f = open(path)
|
f = open(path)
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|||||||
@ -231,19 +231,19 @@ class EscapeMarkdownTest(unittest.TestCase):
|
|||||||
self.assertEqual(issue.body[1], '\\<AnotherTag\\>')
|
self.assertEqual(issue.body[1], '\\<AnotherTag\\>')
|
||||||
|
|
||||||
|
|
||||||
class CostumeLanguageTest(unittest.TestCase):
|
class customLanguageTest(unittest.TestCase):
|
||||||
def test_costume_lang_load(self):
|
def test_custom_lang_load(self):
|
||||||
os.environ['INPUT_LANGUAGES'] = 'tests/costume_languages.json'
|
os.environ['INPUT_LANGUAGES'] = 'tests/custom_languages.json'
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
# Test if the costume language ILS is actually loaded into the system
|
# Test if the custom language ILS is actually loaded into the system
|
||||||
self.assertIsNotNone(parser.languages_dict['ILS'])
|
self.assertIsNotNone(parser.languages_dict['ILS'])
|
||||||
self.assertEqual(self.count_syntax(parser, 'ILS'), 1)
|
self.assertEqual(self.count_syntax(parser, 'ILS'), 1)
|
||||||
|
|
||||||
def test_costume_lang_not_dupplicate(self):
|
def test_custom_lang_not_dupplicate(self):
|
||||||
os.environ['INPUT_LANGUAGES'] = 'tests/costume_languages.json'
|
os.environ['INPUT_LANGUAGES'] = 'tests/custom_languages.json'
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
|
|
||||||
# Test if a costume language can overwrite the rules of an existing one
|
# Test if a custom language can overwrite the rules of an existing one
|
||||||
self.assertEqual(self.count_syntax(parser, 'Java'), 1)
|
self.assertEqual(self.count_syntax(parser, 'Java'), 1)
|
||||||
for syntax in parser.syntax_dict:
|
for syntax in parser.syntax_dict:
|
||||||
if syntax['language'] == 'Java':
|
if syntax['language'] == 'Java':
|
||||||
@ -258,7 +258,7 @@ class CostumeLanguageTest(unittest.TestCase):
|
|||||||
self.assertEqual(parser.languages_dict['Java']['extensions'][0], ".java2")
|
self.assertEqual(parser.languages_dict['Java']['extensions'][0], ".java2")
|
||||||
|
|
||||||
def test_url_load(self):
|
def test_url_load(self):
|
||||||
os.environ['INPUT_LANGUAGES'] = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/blob/master/tests/costume_languages.json'
|
os.environ['INPUT_LANGUAGES'] = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/blob/master/tests/custom_languages.json'
|
||||||
os.environ['INPUT_NO_STANDARD'] = 'true'
|
os.environ['INPUT_NO_STANDARD'] = 'true'
|
||||||
parser = TodoParser()
|
parser = TodoParser()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user