Add OuterTypeFilename rule to Checkstyle

This also requires modifying the logic to create temporary files so that
the filename is the same as that in source tree.

Bug: 27109166
Change-Id: I73f2406d5c85d45b0b259f0fd7dd081e44df029c
This commit is contained in:
Mitchell Wills
2016-02-11 16:56:17 -08:00
parent 51cc7ee42e
commit e524e6070b
2 changed files with 12 additions and 5 deletions

View File

@@ -244,12 +244,16 @@ def _GetTempFilesForCommit(file_names, commit):
tmp_dir_name = tempfile.mkdtemp()
tmp_file_names = {}
for file_name in file_names:
rel_path = os.path.relpath(file_name)
content = subprocess.check_output(
['git', 'show', commit + ':' + os.path.relpath(file_name)])
(fd, tmp_file_name) = tempfile.mkstemp(suffix='.java',
dir=tmp_dir_name,
text=True)
tmp_file = os.fdopen(fd, 'w')
['git', 'show', commit + ':' + rel_path])
tmp_file_name = os.path.join(tmp_dir_name, rel_path)
# create directory for the file if it doesn't exist
if not os.path.exists(os.path.dirname(tmp_file_name)):
os.makedirs(os.path.dirname(tmp_file_name))
tmp_file = open(tmp_file_name, 'w')
tmp_file.write(content)
tmp_file.close()
tmp_file_names[tmp_file_name] = file_name