Commit 97a39414 authored by Stephen Martinis's avatar Stephen Martinis Committed by Commit Bot

Add presubmit check for long paths

Bug: 612667
Change-Id: I6bd52794bf6122813770338a93509d295bf4a7cb
Reviewed-on: https://chromium-review.googlesource.com/1060458Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565452}
parent dfa36b75
......@@ -585,6 +585,12 @@ _IPC_ENUM_TRAITS_DEPRECATED = (
'See http://www.chromium.org/Home/chromium-security/education/'
'security-tips-for-ipc')
_LONG_PATH_ERROR = (
'Some files included in this CL have file names that are too long (> 200'
' characters). If committed, these files will cause issues on Windows. See'
' https://crbug.com/612667 for more details.'
)
_JAVA_MULTIPLE_DEFINITION_EXCLUDED_PATHS = [
r".*[\\\/]BuildHooksAndroidImpl\.java",
r".*[\\\/]ClassRegisterImpl\.java",
......@@ -2827,6 +2833,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckNoDeprecatedJs(input_api, output_api))
results.extend(_CheckParseErrors(input_api, output_api))
results.extend(_CheckForIPCRules(input_api, output_api))
results.extend(_CheckForLongPathnames(input_api, output_api))
results.extend(_CheckForIncludeGuards(input_api, output_api))
results.extend(_CheckForWindowsLineEndings(input_api, output_api))
results.extend(_CheckSingletonInHeaders(input_api, output_api))
......@@ -3036,6 +3043,24 @@ def _CheckForIPCRules(input_api, output_api):
return []
def _CheckForLongPathnames(input_api, output_api):
"""Check to make sure no files being submitted have long paths.
This causes issues on Windows.
"""
problems = []
for f in input_api.AffectedSourceFiles(None):
local_path = f.LocalPath()
# Windows has a path limit of 260 characters. Limit path length to 200 so
# that we have some extra for the prefix on dev machines and the bots.
if len(local_path) > 200:
problems.append(local_path)
if problems:
return [output_api.PresubmitError(_LONG_PATH_ERROR, problems)]
else:
return []
def _CheckForIncludeGuards(input_api, output_api):
"""Check that header files have proper guards against multiple inclusion.
If a file should not have such guards (and it probably should) then it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment