Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: xmllint xsd support added #3665

Merged
merged 7 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .automation/test/xml/bad/xsd_bad_1.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace= "https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="specification">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="xs:string"/>
<xs:element name="model" type="xs:string"/>
<xs:element
name="screenSizeInch" type="xs:string"/>

</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
16 changes: 16 additions & 0 deletions .automation/test/xml/fix/xsd_fix_1.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace= "https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="specification">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="xs:string"/>
<xs:element name="model" type="xs:string"/>
<xs:element
name="screenSizeInch" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
15 changes: 15 additions & 0 deletions .automation/test/xml/good/xsd_good_1.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="specification">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="xs:string" />
<xs:element name="model" type="xs:string" />
<xs:element name="screenSizeInch" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Linters
- Add python package Pygments to rst-lint venv
- [CSharpier](https://csharpier.com) added ability to override config filename and path
- [xmllint](https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html) added support for `xsd` files

- Reporters

Expand Down
8 changes: 5 additions & 3 deletions megalinter/descriptors/xml.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ descriptor_flavors:
- cupcake
file_extensions:
- ".xml"
- ".xsd"
linters:
# XML LINT
- class: XmlLintLinter
Expand All @@ -20,15 +21,16 @@ 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 myXSDfile.xsd"
- "xmllint --format myXMLfile.xml --output myXMLfile.xml"
install:
apk:
- libc-dev
Expand Down