pre-upload: Add missing r prefixes for regular expression strings
As per the linter:
[FAILED] chromiumos/repohooks: cros lint
Hook script "cros lint ${PRESUBMIT_FILES}" failed with code 1:
************* Module pre-upload
pre-upload.py:572:3: W1401: Anomalous backslash in string: '\.'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
pre-upload.py:637:3: W1401: Anomalous backslash in string: '\.'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
14:23:51: ERROR: Found lint errors in 1 files.
BUG=none
TEST=repo upload a long chain of kernel commits
Change-Id: Ic64e9c82766589f6d5480c38e0824ba6e7765414
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/2424265
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 2b7567d..56413c0 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -569,7 +569,7 @@
"""Checks that there is no stray whitespace at source lines end."""
included, excluded = _parse_common_inclusion_options(options)
files = _filter_files(_get_affected_files(commit),
- included + COMMON_INCLUDED_PATHS + ['^.*\.md$'],
+ included + COMMON_INCLUDED_PATHS + [r'^.*\.md$'],
excluded + COMMON_EXCLUDED_PATHS)
return _check_lines_in_diff(commit, files,
lambda line: line.rstrip() != line,
@@ -634,7 +634,7 @@
keywords = sorted(keywords - unblocked_words)
files = _filter_files(
_get_affected_files(commit),
- opts.include_regex + COMMON_INCLUDED_PATHS + ['^.*\.md$'],
+ opts.include_regex + COMMON_INCLUDED_PATHS + [r'^.*\.md$'],
opts.exclude_regex + COMMON_EXCLUDED_PATHS)
errors = []