Skip to content

Commit

Permalink
Merge pull request #18252 from bernt-matthias/revert/17656
Browse files Browse the repository at this point in the history
[24.1] Remove linter for unstripped text content for tool xml leaves
  • Loading branch information
mvdbeek authored May 31, 2024
2 parents fb7d10b + c201daa commit fd1cb27
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 45 deletions.
17 changes: 0 additions & 17 deletions lib/galaxy/tool_util/linters/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,6 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
)


class TextSpaces(Linter):
@classmethod
def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
_, tool_node = _tool_xml_and_root(tool_source)
if not tool_node:
return
for node in tool_node.iter():
if len(node) > 0:
continue
if node.text and node.text != node.text.strip():
lint_ctx.warn(
f"XML node '{node.tag}' has text with leading or trailing spaces ('{node.text}'!='{node.text.strip()}').",
linter=cls.name(),
node=node,
)


class BioToolsValid(Linter):
@classmethod
def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"):
Expand Down
17 changes: 13 additions & 4 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -7861,7 +7861,7 @@ A tool can have any number of EDAM topic references.
<xs:sequence>
<xs:element name="edam_topic" minOccurs="0" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:restriction base="singleLineString">
<xs:pattern value="topic_[0-9]{4}"></xs:pattern>
</xs:restriction>
</xs:simpleType>
Expand All @@ -7886,7 +7886,7 @@ A tool can have any number of EDAM operation references.
<xs:sequence>
<xs:element name="edam_operation" minOccurs="0" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:restriction base="singleLineString">
<xs:pattern value="operation_[0-9]{4}"></xs:pattern>
</xs:restriction>
</xs:simpleType>
Expand Down Expand Up @@ -7921,7 +7921,7 @@ A tool can refer multiple reference IDs.
information according to a catalog.</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:extension base="singleLineString">
<xs:attribute name="type" type="xrefType" use="required">
<xs:annotation>
<xs:documentation xml:lang="en">Type of reference - currently ``bio.tools``, ``bioconductor``, and ``biii`` are
Expand All @@ -7944,11 +7944,20 @@ the only supported options.</xs:documentation>
</xs:simpleType>

<xs:simpleType name="MacroImportType">
<xs:restriction base="xs:string">
<xs:restriction base="singleLineString">
<xs:pattern value="[a-zA-Z0-9_\-\.]+.xml"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="singleLineString">
<xs:annotation>
<xs:documentation xml:lang="en">A string without newline characters.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="DetectErrorType">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
Expand Down
25 changes: 1 addition & 24 deletions test/unit/tool_util/test_tool_linters.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,6 @@
</tool>
"""

GENERAL_TEXT_SPACES = """
<tool name="valid name" id="valid_id" version="1.0+galaxy1" profile="21.09">
<xrefs>
<xref type="bio.tools">
bwa
</xref>
</xrefs>
</tool>
"""

GENERAL_VALID_BIOTOOLS = """
<tool name="valid name" id="valid_id" version="1.0+galaxy1" profile="23.0">
<xrefs>
Expand Down Expand Up @@ -1108,19 +1098,6 @@ def test_general_valid_new_profile_fmt(lint_ctx):
assert not lint_ctx.error_messages


def test_general_text_spaces(lint_ctx):
tool_source = get_xml_tool_source(GENERAL_TEXT_SPACES)
run_lint_module(lint_ctx, general, tool_source)
assert (
"XML node 'xref' has text with leading or trailing spaces ('\n bwa\n '!='bwa')"
in lint_ctx.warn_messages
)
assert not lint_ctx.info_messages
assert len(lint_ctx.valid_messages) == 4
assert len(lint_ctx.warn_messages) == 1
assert not lint_ctx.error_messages


@skip_if_site_down("https://bio.tools/")
def test_general_valid_biotools(lint_ctx):
tool_source = get_xml_tool_source(GENERAL_VALID_BIOTOOLS)
Expand Down Expand Up @@ -2168,7 +2145,7 @@ def test_skip_by_module(lint_ctx):
def test_list_linters():
linter_names = Linter.list_listers()
# make sure to add/remove a test for new/removed linters if this number changes
assert len(linter_names) == 133
assert len(linter_names) == 132
assert "Linter" not in linter_names
# make sure that linters from all modules are available
for prefix in [
Expand Down

0 comments on commit fd1cb27

Please sign in to comment.