Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: PRESUBMIT.py

Issue 2532563002: Revert of Presubmit: Warn about useless forward declarations (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 33d75410d653d3d2a9879cb4339b432783752e47..d78629a6d802bea59f45596784536cb99aeb33a9 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1582,34 +1582,6 @@
'false. The mode is deprecated and will be removed soon.',
files)]
return []
-
-
-def _CheckUselessForwardDeclarations(input_api, output_api):
- """Checks that affected header files do not contain useless class
- or struct forward declaration.
- """
- results = []
- class_pattern = input_api.re.compile(r'^class\s+(\w+);$',
- input_api.re.MULTILINE)
- struct_pattern = input_api.re.compile(r'^struct\s+(\w+);$',
- input_api.re.MULTILINE)
- for f in input_api.AffectedFiles():
- if not f.LocalPath().endswith('.h'):
- continue
-
- contents = input_api.ReadFile(f)
- fwd_decls = input_api.re.findall(class_pattern, contents)
- fwd_decls.extend(input_api.re.findall(struct_pattern, contents))
-
- for decl in fwd_decls:
- count = sum(1 for _ in input_api.re.finditer(
- r'\b%s\b' % input_api.re.escape(decl), contents))
- if count == 1:
- results.append(output_api.PresubmitPromptWarning(
- '%s: %s forward declaration seems to be useless' %
- (f.LocalPath(), decl)))
-
- return results
def _CheckAndroidToastUsage(input_api, output_api):
@@ -2061,7 +2033,6 @@
results.extend(_CheckJavaStyle(input_api, output_api))
results.extend(_CheckIpcOwners(input_api, output_api))
results.extend(_CheckMojoUsesNewWrapperTypes(input_api, output_api))
- results.extend(_CheckUselessForwardDeclarations(input_api, output_api))
if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698