rename is_xml{,like}: is_testable{,_xml}_file

"is_xml_like" is a misnomer, because JSON files (or rather, files whose
names ends with .json) pass whereas pom.xml doesn't.

This patch renames is_xml to the more descriptive is_testable_xml_file
and is_xml_like to is_testable_file.

Change-Id: I4e2d1cbc0bec83e853c93823498bd356fe049748
This commit is contained in:
Roger Luethi 2014-06-05 17:21:26 +02:00
parent 953497f613
commit e151e6c565
1 changed files with 6 additions and 7 deletions

View File

@ -376,7 +376,7 @@ def check_deleted_files(rootdir, file_exceptions, verbose):
os.chdir(root)
for f in files:
if not is_xml(f) or f in file_exceptions:
if not is_testable_xml_file(f) or f in file_exceptions:
continue
path = os.path.abspath(os.path.join(root, f))
@ -475,14 +475,14 @@ def validate_one_file(schema, rootdir, path, verbose,
return any_failures
def is_xml(path):
def is_testable_xml_file(path):
"""Returns true if file ends with .xml and is not a pom.xml file."""
filename = os.path.basename(path)
return filename.endswith('.xml') and not filename == 'pom.xml'
def is_xml_like(path):
def is_testable_file(path):
"""Returns true if file is in some XML format we handle
Skips pom.xml files as well since those are not handled.
@ -581,7 +581,7 @@ def validate_modified_files(rootdir, exceptions, verbose,
# Do not select deleted files, just Added, Copied, Modified, Renamed,
# or Type changed
modified_files = get_modified_files(rootdir, "--diff-filter=ACMRT")
modified_files = [f for f in modified_files if is_xml_like(f)]
modified_files = [f for f in modified_files if is_testable_file(f)]
validate_individual_files(modified_files, rootdir, exceptions,
verbose,
@ -601,8 +601,7 @@ def validate_all_files(rootdir, exceptions, verbose,
for f in files:
# Ignore maven files, which are called pom.xml
if (is_xml_like(f) and
f not in exceptions):
if is_testable_file(f) and f not in exceptions:
path = os.path.abspath(os.path.join(root, f))
files_to_check.append(path)
@ -920,7 +919,7 @@ def find_affected_books(rootdir, book_exceptions, file_exceptions,
f_abs = os.path.abspath(os.path.join(root, f))
if is_book_master(f_base):
book_bk[f_abs] = book_root
if not is_xml(f) or f in file_exceptions:
if not is_testable_xml_file(f) or f in file_exceptions:
continue
try: