is_xml{,_like} handle paths, not filenames
The way is_xml and is_xml_like handle the pom.xml case, one seems to expect a filename while the other expects a path. This patch makes both functions more robust so they can handle both path and filename, but won't incorrectly filter filenames that only happen to end on "pom.xml" (say, fun-with-a-pompom.xml). Change-Id: Id2653152b2e46bfa9b892a8f656cccaa44a8185a
This commit is contained in:
parent
ae3d8aa0e7
commit
53b97a1f6f
|
@ -477,21 +477,23 @@ def validate_one_file(schema, rootdir, path, verbose,
|
|||
return any_failures
|
||||
|
||||
|
||||
def is_xml(filename):
|
||||
def is_xml(path):
|
||||
"""Returns true if file ends with .xml and is not a pom.xml file."""
|
||||
|
||||
return filename.endswith('.xml') and not filename.endswith('/pom.xml')
|
||||
filename = os.path.basename(path)
|
||||
return filename.endswith('.xml') and not filename == 'pom.xml'
|
||||
|
||||
|
||||
def is_xml_like(filename):
|
||||
def is_xml_like(path):
|
||||
"""Returns true if file is in some XML format we handle
|
||||
|
||||
Skips pom.xml files as well since those are not handled.
|
||||
"""
|
||||
|
||||
filename = os.path.basename(path)
|
||||
return (filename.endswith(('.xml', '.xsd', '.xsl', '.wadl',
|
||||
'.xjb', '.json')) and
|
||||
not filename.endswith('pom.xml'))
|
||||
not filename == 'pom.xml')
|
||||
|
||||
|
||||
def is_wadl(filename):
|
||||
|
|
Loading…
Reference in New Issue