From 3b9552584dd763bc79a3cdae897a0cd624b2dcf5 Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Thu, 20 Oct 2022 20:16:53 +0000 Subject: [PATCH] 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 Commit-Queue: Mike Dougherty Reviewed-by: Mike Dougherty --- presubmit_canned_checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index f74f1ee62..8b23bb495 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -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):