Fix ignoring files in PRESUBMIT on Windows

When comparing filenames, PRESUBMIT didn't exclude files listed in .eslintignore from formatting, because .eslintignore contains forward slashes, but all the files are using native OS-level slashes, so any comparisons failed.

This fixes it by normalising all paths found in .eslintignore.

Change-Id: I9f5cd3cbf15b4b27677968747cf349cde2aed1b3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1872596
Auto-Submit: Ingvar Stepanyan <rreverser@google.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
This commit is contained in:
Ingvar Stepanyan
2019-10-22 12:23:44 +00:00
committed by Commit Bot
parent 1473de827c
commit b532f3f71f
+1 -1
View File
@@ -58,7 +58,7 @@ def _CheckFormat(input_api, output_api):
eslint_ignore_path = input_api.os_path.join(input_api.PresubmitLocalPath(), '.eslintignore')
with open(eslint_ignore_path, 'r') as ignore_manifest:
for line in ignore_manifest:
ignore_files.append(line.strip())
ignore_files.append(input_api.os_path.normpath(line.strip()))
formattable_files = [
affected_file for affected_file in affected_files if all(ignore_file not in affected_file for ignore_file in ignore_files)
]