Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Commit a6935b9

Browse files
committed
Support passing a name through to the lint context so that error messages can be more useful
1 parent 11c46b7 commit a6935b9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

galaxy/tools/lint.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
LEVEL_ERROR = "error"
1313

1414

15-
def lint_tool_source(tool_source, level=LEVEL_ALL, fail_level=LEVEL_WARN, extra_modules=[], skip_types=[]):
16-
lint_context = LintContext(level=level, skip_types=skip_types)
15+
def lint_tool_source(tool_source, level=LEVEL_ALL, fail_level=LEVEL_WARN, extra_modules=[], skip_types=[], name=None):
16+
lint_context = LintContext(level=level, skip_types=skip_types, object_name=name)
1717
lint_tool_source_with(lint_context, tool_source, extra_modules)
1818

1919
return not lint_context.failed(fail_level)
2020

2121

22-
def lint_xml(tool_xml, level=LEVEL_ALL, fail_level=LEVEL_WARN, extra_modules=[], skip_types=[]):
23-
lint_context = LintContext(level=level, skip_types=skip_types)
22+
def lint_xml(tool_xml, level=LEVEL_ALL, fail_level=LEVEL_WARN, extra_modules=[], skip_types=[], name=None):
23+
lint_context = LintContext(level=level, skip_types=skip_types, object_name=name)
2424
lint_xml_with(lint_context, tool_xml, extra_modules)
2525

2626
return not lint_context.failed(fail_level)
@@ -63,9 +63,10 @@ def lint_xml_with(lint_context, tool_xml, extra_modules=[]):
6363
# be moved to galaxy.util.lint.
6464
class LintContext(object):
6565

66-
def __init__(self, level, skip_types=[]):
66+
def __init__(self, level, skip_types=[], object_name=None):
6767
self.skip_types = skip_types
6868
self.level = level
69+
self.object_name = object_name
6970
self.found_errors = False
7071
self.found_warns = False
7172

0 commit comments

Comments
 (0)