The base_name should fully match the exclude_files pattern

Previously, a path in the same directory as the CPPLINT.cfg is excluded if one
of its prefixes matches the pattern, which leads some confusing cases like
"exclude_files=l" excluding "libs". Now we should change the pattern to
"exclude_files=l.*" to achieve the same result.
This commit is contained in:
kenkangxgwe 2023-06-01 01:22:39 -07:00
parent 2173b8d68c
commit 4ea770fdfd

2
cpplint/cpplint.py vendored
View File

@ -5989,7 +5989,7 @@ def ProcessConfigOverrides(filename):
# and not "baz" nor "bar/baz.cc". # and not "baz" nor "bar/baz.cc".
if base_name: if base_name:
pattern = re.compile(val) pattern = re.compile(val)
if pattern.match(base_name): if pattern.fullmatch(base_name):
if _cpplint_state.quiet: if _cpplint_state.quiet:
# Suppress "Ignoring file" warning when using --quiet. # Suppress "Ignoring file" warning when using --quiet.
return False return False