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
a73da8c3
Commit
a73da8c3
authored
6 years ago
by
Alan Nelson
Browse files
Options
Downloads
Patches
Plain Diff
Add parenthesis to print statements for python3
parent
6be64418
No related branches found
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
+10
-10
10 additions, 10 deletions
magento2-xml-lint/latest/xml-lint
with
10 additions
and
10 deletions
magento2-xml-lint/latest/xml-lint
+
10
−
10
View file @
a73da8c3
...
...
@@ -20,7 +20,7 @@ def get_xml_files(search_dir):
try
:
return
check_output
([
'
find
'
,
search_dir
,
'
-name
'
,
'
*.xml
'
]).
splitlines
()
except
CalledProcessError
:
print
"
WARNING: No XML files found
"
print
(
"
WARNING: No XML files found
"
)
return
[]
def
lint_only
(
file
):
...
...
@@ -46,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
]
...
...
@@ -67,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