Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docker-ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UNL ITS
docker-ci
Commits
2e3ac11e
Commit
2e3ac11e
authored
6 years ago
by
Jose Raul Barreras
Browse files
Options
Downloads
Plain Diff
Merge branch 'magento2-xml-fix' into 'develop'
Magento2 xml fix See merge request
!9
parents
90efdb08
a73da8c3
Branches
Branches containing commit
No related tags found
2 merge requests
!15
Merge Develop into Master
,
!9
Magento2 xml fix
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
magento2-xml-lint/latest/xml-lint
+14
-10
14 additions, 10 deletions
magento2-xml-lint/latest/xml-lint
with
14 additions
and
10 deletions
magento2-xml-lint/latest/xml-lint
+
14
−
10
View file @
2e3ac11e
...
...
@@ -17,7 +17,11 @@ def get_mappings(misc_file, base_dir):
return
mapping
def
get_xml_files
(
search_dir
):
return
check_output
([
'
find
'
,
search_dir
,
'
-name
'
,
'
*.xml
'
]).
splitlines
()
try
:
return
check_output
([
'
find
'
,
search_dir
,
'
-name
'
,
'
*.xml
'
]).
splitlines
()
except
CalledProcessError
:
print
(
"
WARNING: No XML files found
"
)
return
[]
def
lint_only
(
file
):
try
:
...
...
@@ -42,20 +46,20 @@ def search_file_for_xsd(file):
return
None
def
validate_file
(
file
,
mapping
):
print
"
validating file {}
"
.
format
(
file
)
print
(
"
validating file {}
"
.
format
(
file
)
)
xsd
=
search_file_for_xsd
(
file
)
if
xsd
is
not
None
:
if
xsd
in
mapping
:
lint_with_xsd
(
file
,
mapping
[
xsd
])
else
:
print
'
WARNING: Unable to map XSD to path: {}
'
.
format
(
xsd
)
print
(
'
WARNING: Unable to map XSD to path: {}
'
.
format
(
xsd
)
)
else
:
print
'
WARNING: Unable to find XSD for file: {}
'
.
format
(
file
)
print
(
'
WARNING: Unable to find XSD for file: {}
'
.
format
(
file
)
)
lint_only
(
file
)
def
main
():
if
len
(
sys
.
argv
)
<
4
:
print
"
Usage: xml-lint <misc.xml> <app_base_dir> <search_dir>
"
print
(
"
Usage: xml-lint <misc.xml> <app_base_dir> <search_dir>
"
)
exit
(
1
)
misc_file
=
sys
.
argv
[
1
]
...
...
@@ -63,19 +67,19 @@ def main():
search_dir
=
os
.
path
.
abspath
(
sys
.
argv
[
3
])
if
not
os
.
path
.
isfile
(
misc_file
):
print
"
{} is not a file
"
.
format
(
misc_file
)
print
(
"
{} is not a file
"
.
format
(
misc_file
)
)
exit
(
1
)
mapping
=
get_mappings
(
misc_file
,
base_dir
)
print
"
loaded {} XSD mapping(s)
"
.
format
(
len
(
mapping
))
print
(
"
loaded {} XSD mapping(s)
"
.
format
(
len
(
mapping
))
)
xml_files
=
get_xml_files
(
search_dir
)
print
"
found {} XML file(s)
"
.
format
(
len
(
xml_files
))
print
(
"
found {} XML file(s)
"
.
format
(
len
(
xml_files
))
)
print
""
print
(
""
)
for
file
in
xml_files
:
validate_file
(
file
,
mapping
)
print
""
print
(
""
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment