From ce32db481d56d88cec3d910d6b97c1e8a5ff2411 Mon Sep 17 00:00:00 2001 From: TommyE123 Date: Sun, 16 Jun 2024 15:58:15 +0100 Subject: [PATCH 1/3] XSD Support xmllint_XSD_added --- .automation/test/xml/bad/xsd_bad_1.xsd | 17 +++++++++++++++++ .automation/test/xml/fix/xsd_fix_1.xsd | 16 ++++++++++++++++ .automation/test/xml/good/xsd_good_1.xsd | 15 +++++++++++++++ CHANGELOG.md | 1 + .../descriptors/xml.megalinter-descriptor.yml | 7 ++++--- 5 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 .automation/test/xml/bad/xsd_bad_1.xsd create mode 100644 .automation/test/xml/fix/xsd_fix_1.xsd create mode 100644 .automation/test/xml/good/xsd_good_1.xsd diff --git a/.automation/test/xml/bad/xsd_bad_1.xsd b/.automation/test/xml/bad/xsd_bad_1.xsd new file mode 100644 index 00000000000..f3420d1ccd4 --- /dev/null +++ b/.automation/test/xml/bad/xsd_bad_1.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.automation/test/xml/fix/xsd_fix_1.xsd b/.automation/test/xml/fix/xsd_fix_1.xsd new file mode 100644 index 00000000000..cf6f234bbee --- /dev/null +++ b/.automation/test/xml/fix/xsd_fix_1.xsd @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/.automation/test/xml/good/xsd_good_1.xsd b/.automation/test/xml/good/xsd_good_1.xsd new file mode 100644 index 00000000000..1ee01fc8b62 --- /dev/null +++ b/.automation/test/xml/good/xsd_good_1.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d347927fc01..5f855f4d45c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - Linters - Add python package Pygments to rst-lint venv + - [xmllint](https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html) added support for `xsd` files - Reporters diff --git a/megalinter/descriptors/xml.megalinter-descriptor.yml b/megalinter/descriptors/xml.megalinter-descriptor.yml index cc9fee863d7..74b769929aa 100644 --- a/megalinter/descriptors/xml.megalinter-descriptor.yml +++ b/megalinter/descriptors/xml.megalinter-descriptor.yml @@ -6,6 +6,7 @@ descriptor_flavors: - cupcake file_extensions: - ".xml" + - ".xsd" linters: # XML LINT - class: XmlLintLinter @@ -20,15 +21,15 @@ linters: default_value: " " description: The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` linter_url: https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home - linter_rules_url: https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home#diagnostics + linter_rules_configuration_url: https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html version_extract_regex: "(?<=libxml version )\\d+(\\d+)+" cli_lint_mode: list_of_files cli_lint_fix_arg_name: "--format" cli_help_arg_name: "--help" help_command_return_code: 1 examples: - - "xmllint myfile.xml" - - "xmllint --format myfile.xml --output myfile.xml" + - "xmllint myXMLfile.xml" + - "xmllint --format myXMLfile.xml --output myXSDfile.xsd" install: apk: - libc-dev From b64527a595922ceb253b2065ed02521256ed5624 Mon Sep 17 00:00:00 2001 From: TommyE123 Date: Sun, 16 Jun 2024 16:35:30 +0100 Subject: [PATCH 2/3] fixed xsd file --- .automation/test/xml/fix/xsd_fix_1.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/test/xml/fix/xsd_fix_1.xsd b/.automation/test/xml/fix/xsd_fix_1.xsd index cf6f234bbee..dba66b79e38 100644 --- a/.automation/test/xml/fix/xsd_fix_1.xsd +++ b/.automation/test/xml/fix/xsd_fix_1.xsd @@ -1,4 +1,4 @@ - Date: Sun, 16 Jun 2024 19:20:47 +0100 Subject: [PATCH 3/3] updated examples --- megalinter/descriptors/xml.megalinter-descriptor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/megalinter/descriptors/xml.megalinter-descriptor.yml b/megalinter/descriptors/xml.megalinter-descriptor.yml index 74b769929aa..317da038d76 100644 --- a/megalinter/descriptors/xml.megalinter-descriptor.yml +++ b/megalinter/descriptors/xml.megalinter-descriptor.yml @@ -29,7 +29,8 @@ linters: help_command_return_code: 1 examples: - "xmllint myXMLfile.xml" - - "xmllint --format myXMLfile.xml --output myXSDfile.xsd" + - "xmllint myXSDfile.xsd" + - "xmllint --format myXMLfile.xml --output myXMLfile.xml" install: apk: - libc-dev