Fix year comparison

Change crrev.com/c/3967210 compared a regex result (str) to current_year
(int), which will never match. This fixes the comparison by converting
current_year to str. Unit tests to validate the behavior will be added
in a follow-up.

Bug: 1098010
Change-Id: I79d0adc6d6566df71425bfb448091445f57ad2c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3968797
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
changes/97/3968797/2
Bruce Dawson 3 years ago committed by LUCI CQ
parent cfa504ecb9
commit 3b9552584d

@ -697,7 +697,7 @@ def CheckLicense(input_api, output_api, license_re=None, project_name=None,
if not match:
# License is totally wrong.
bad_new_files.append(f.LocalPath())
elif match.groups()[0] != current_year:
elif match.groups()[0] != str(current_year):
# License does not list this year.
wrong_year_new_files.append(f.LocalPath())
elif not license_re.search(contents):

Loading…
Cancel
Save