Skip to content

Commit

Permalink
Fix bad regex in CheckForSuperfluousStlIncludesInHeaders presubmit.
Browse files Browse the repository at this point in the history
It is currently matching more than it should.

Bug: 1200833
Change-Id: I99f7e2cb73cabbc8ed6e862b352abfacc647d4e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2892529
Auto-Submit: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#882158}
  • Loading branch information
leizleiz authored and Chromium LUCI CQ committed May 12, 2021
1 parent 83e214b commit 0643e34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -4345,7 +4345,7 @@ def CheckBuildConfigMacrosWithoutInclude(input_api, output_api):

def CheckForSuperfluousStlIncludesInHeaders(input_api, output_api):
stl_include_re = input_api.re.compile(
r'^#include\s+<'
r'^#include\s+<('
r'algorithm|'
r'array|'
r'limits|'
Expand All @@ -4358,7 +4358,7 @@ def CheckForSuperfluousStlIncludesInHeaders(input_api, output_api):
r'unordered_map|'
r'unordered_set|'
r'utility|'
r'vector>')
r'vector)>')
std_namespace_re = input_api.re.compile(r'std::')
errors = []
for f in input_api.AffectedFiles():
Expand Down
3 changes: 3 additions & 0 deletions PRESUBMIT_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def testGoodFiles(self):
MockFile('other/path/qux.h',
['#include "base/stl_util.h"',
'foobar']),
MockFile('other/path/baz.h',
['#include "set/vector.h"',
'bazzab']),
# The check is only for header files.
MockFile('other/path/not_checked.cc',
['#include <vector>',
Expand Down

0 comments on commit 0643e34

Please sign in to comment.