diff options
author | miguelg@chromium.org <miguelg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 14:10:21 +0000 |
---|---|---|
committer | miguelg@chromium.org <miguelg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 14:10:21 +0000 |
commit | 5e4dbc79f83876116aa6fe0d521d18777834494f (patch) | |
tree | 0efc9a77636b21e264485d195cbe068da254e206 /PRESUBMIT_test.py | |
parent | 6131fe6d36d160340926091f4daf7d64bffdd5c5 (diff) | |
download | chromium_src-5e4dbc79f83876116aa6fe0d521d18777834494f.zip chromium_src-5e4dbc79f83876116aa6fe0d521d18777834494f.tar.gz chromium_src-5e4dbc79f83876116aa6fe0d521d18777834494f.tar.bz2 |
Revert of Add PRESUBMIT.py warning for contradictory NOTREACHED() use. (https://codereview.chromium.org/344563003/)
Reason for revert:
It seems to be checking code that is not part of the diff.
I also think there are some legitimate cases for not reached in the middle of a block but that is something that can be discussed on the bug.
Filed https://code.google.com/p/chromium/issues/detail?id=388731 to track.
Original issue's description:
> Add PRESUBMIT.py warning for contradictory NOTREACHED() use.
>
> As recently discussed on chromium-dev [1] and subsequently incorporated into the
> Chromium Coding Style [2], NOTREACHED() followed by code is an anti-pattern.
> This CL lets PRESUBMIT.py detect most of these cases and print a warning to the
> developer.
> [1] https://groups.google.com/a/chromium.org/d/msg/chromium-dev/c2X0D1Z6X2o/ddkFLqQP0P0J
> [2] http://www.chromium.org/developers/coding-style#TOC-CHECK-DCHECK-and-NOTREACHED-
>
> BUG=none
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=279681
TBR=maruel@chromium.org,tnagel@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=none
Review URL: https://codereview.chromium.org/357693004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT_test.py')
-rwxr-xr-x | PRESUBMIT_test.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py index 760d70b..f81b316 100755 --- a/PRESUBMIT_test.py +++ b/PRESUBMIT_test.py @@ -413,52 +413,6 @@ class InvalidOSMacroNamesTest(unittest.TestCase): self.assertEqual(0, len(errors)) -class CheckContradictoryNotreachedUseTest(unittest.TestCase): - def testValid(self): - lines = ['{', - ' // NOTREACHED();', - ' /* NOTREACHED(); */', - " char a = '\\\\', b = '\\0', c = '\\'';", - ' char d[] = "NOTREACHED();";', - ' NOTREACHED(); // blah', - ' /* comment */', - ' // line continuation \\', - ' still inside comment', - ' // comment followed by empty line', - '', - ' ;; ; ;;;', - '}', - 'switch (i) {', - ' case 7: NOTREACHED(); break;', - '}'] - output = PRESUBMIT._CheckContradictoryNotreachedUseInFile( - MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) - self.assertEqual(0, len(output)) - - def testInvalid(self): - lines = ['{', - ' NOTREACHED();', - ' return;', - '}', - '{', - ' NOTREACHED();', - ' /* */', - ' return;', - ' /* */', - '}', - '{', - ' NOTREACHED();', - ' // trailing space, not a line continuation \\ ', - ' return;', - '}', - 'switch (i) {', - ' case 7: NOTREACHED(); some_thing(); break;', - '}'] - output = PRESUBMIT._CheckContradictoryNotreachedUseInFile( - MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) - self.assertEqual(4, len(output)) - - class CheckAddedDepsHaveTetsApprovalsTest(unittest.TestCase): def testFilesToCheckForIncomingDeps(self): changed_lines = [ |