Fix license checks
In crrev.com/c/3955701 the license checks were made stricter on new files. Unfortunately moved and new files are indistinguishable in the presubmit system, and moved files are not supposed to update their copyright year. So, CheckLicense() now emits three different types of presubmit results: 1) If a file is new/moved and the license is malformed then an error is reported. 2) If a file is new/moved and the year is not current then a warning is issued, with advice to ignore the warning if the file was moved. 3) If a file is not new/moved and it has a bad license then a warning is issued. This will ensure that new files do not have bad licenses, and will usually get the year correct. The new output looks like this (for one moved file with an old date, one file with a bad license, and one new file with a bad license): ** Presubmit Warnings: 2 ** License doesn't list the current year. If this is a new file, use the current year. If this is a moved file then ignore this warning. base\win\moved.cc License must match: .*? Copyright (\(c\) )?(2022|2021|2020|2019|2018|2017|2016|2015|2014|2013|2012|2011|2010|2009|2008|2007|2006|2006-2008|2006-2009|2006-2010) The Chromium Authors(\. All rights reserved\.)?\n.*? Use of this source code is governed by a BSD-style license that can be\n.*? found in the LICENSE file\.(?: \*/)?\n Found a bad license header in these files: base\win\bad_license.cc ** Presubmit ERRORS: 1 ** License on new files must match: .*? Copyright (2022|2021|2020|2019|2018|2017|2016|2015|2014|2013|2012|2011|2010|2009|2008|2007|2006|2006-2008|2006-2009|2006-2010) The Chromium Authors\n.*? Use of this source code is governed by a BSD-style license that can be\n.*? found in the LICENSE file\.\n Found a bad license header in these new files: base\win\new_file.cc Bug: 1098010 Change-Id: Ia62b0591ee416c55566427bba9fdd91d74a26349 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3967210 Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: Mike Dougherty <michaeldo@chromium.org>changes/10/3967210/3
parent
bd0cea6acd
commit
a7949c2545
Loading…
Reference in New Issue