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

Unified Diff: Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

Issue 145033013: Update the static_cast style check to check for DEFINE_TYPE_CASTS patterns as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months 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
Index: Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
index 6df53dac3bcf6c6d87158bc9baf8dcefc37ee4c2..3252bfd60a9e579f3b4cbe55a4b0d3e71a41da57 100644
--- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
+++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -300,6 +300,7 @@ class CppStyleTestBase(unittest.TestCase):
def perform_avoid_static_cast_of_objects(self, code, filename='foo.cpp', fs=None):
basic_error_rules = ('-',
+ '+security/casting',
'+runtime/casting')
return self.perform_lint(code, filename, basic_error_rules, fs)
@@ -758,6 +759,7 @@ class CppStyleTest(CppStyleTestBase):
self.assert_language_rules_check('foo.h', statement, error_message)
# Tests for static_cast readability.
+ # TODO (kphanee): Add cases for testing the DEFINE_TYPE_CASTS usecases also.
Dirk Pranke 2014/01/27 19:38:51 NIt: s/TODO/FIXME, don't use a username.
r.kasibhatla 2014/02/03 15:29:15 Done.
def test_static_cast_on_objects_with_toFoo(self):
mock_header_contents = ['inline Foo* toFoo(Bar* bar)']
fs = FileSystem()
@@ -773,7 +775,7 @@ class CppStyleTest(CppStyleTestBase):
filename='casting.cpp',
fs=fs)
self.assertEqual(message, 'static_cast of class objects is not allowed. Use toFoo defined in Foo.h.'
aarya 2014/01/27 19:45:56 nit: do we want to add DEFINE_TYPE_CASTS in messag
r.kasibhatla 2014/02/03 15:29:15 This usecase is specifically for the error when we
inferno 2014/02/03 15:44:23 Yes, this new message is fine.
- ' [runtime/casting] [4]')
+ ' [security/casting] [4]')
finally:
fs.read_text_file = orig_read_text_file_fn
« Tools/Scripts/webkitpy/style/checkers/cpp.py ('K') | « Tools/Scripts/webkitpy/style/checkers/cpp.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698