Commit 3b563091 authored by Bruce Dawson's avatar Bruce Dawson Committed by LUCI CQ

Ignore \r characters in CheckLicense

If you copy\paste a license header in such a way that \r\n line endings
are used (I have done this) then CheckLicense would fail. This is quite
confusing because the license looks perfect in most text editors. This
change tells CheckLicense to treat \r\n line endings as equivalent to \n
and let CheckForWindowsLineEndings do its job of warning about the \r\n
line endings. This avoids confusing presubmit messages.

Bug: 801033
Change-Id: I37fa4a6d9cd0f1a4dcce1267175f4b8fd298b906
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2951788Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
parent cdd52af7
......@@ -567,10 +567,10 @@ def CheckLicense(input_api, output_api, license_re=None, project_name=None,
# The (c) is deprecated, but tolerate it until it's removed from all files.
license_re = license_re or (
r'.*? Copyright (\(c\) )?%(year)s The %(project)s Authors\. '
r'All rights reserved\.\n'
r'All rights reserved\.\r?\n'
r'.*? Use of this source code is governed by a BSD-style license that '
r'can be\n'
r'.*? found in the LICENSE file\.(?: \*/)?\n'
r'can be\r?\n'
r'.*? found in the LICENSE file\.(?: \*/)?\r?\n'
) % {
'year': years_re,
'project': project_name,
......
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