Merge pull request #18252 from bernt-matthias/revert/17656

[24.1] Remove linter for unstripped text content for tool xml leaves
This commit is contained in:
Marius van den Beek
2024-05-31 10:03:52 +02:00
committed by GitHub
3 changed files with 14 additions and 45 deletions
-17
View File
@@ -231,23 +231,6 @@ class ResourceRequirementExpression(Linter):
)
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"):
+13 -4
View File
@@ -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>
@@ -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>
@@ -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
@@ -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"/>
+1 -24
View File
@@ -120,16 +120,6 @@ GENERAL_VALID_NEW_PROFILE_FMT = """
</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>
@@ -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)
@@ -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 [