Title: [261415] trunk/Tools
- Revision
- 261415
- Author
- [email protected]
- Date
- 2020-05-08 14:14:24 -0700 (Fri, 08 May 2020)
Log Message
check-webkit-style false positive for [readability/naming/protected] with method declaration
<https://webkit.org/b/210682>
Reviewed by Darin Adler.
* Scripts/webkitpy/style/checkers/cpp.py:
(check_identifier_name_in_declaration):
- Don't check for invalid protector name if the capitalized
protected name is the same as the original protected name,
indicating it's a type name.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(WebKitStyleTest.test_names):
- Add test cases.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (261414 => 261415)
--- trunk/Tools/ChangeLog 2020-05-08 20:57:57 UTC (rev 261414)
+++ trunk/Tools/ChangeLog 2020-05-08 21:14:24 UTC (rev 261415)
@@ -1,3 +1,19 @@
+2020-05-08 David Kilzer <[email protected]>
+
+ check-webkit-style false positive for [readability/naming/protected] with method declaration
+ <https://webkit.org/b/210682>
+
+ Reviewed by Darin Adler.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_identifier_name_in_declaration):
+ - Don't check for invalid protector name if the capitalized
+ protected name is the same as the original protected name,
+ indicating it's a type name.
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (WebKitStyleTest.test_names):
+ - Add test cases.
+
2020-05-08 Alex Christensen <[email protected]>
Fix build on platforms without network framework.
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (261414 => 261415)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2020-05-08 20:57:57 UTC (rev 261414)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2020-05-08 21:14:24 UTC (rev 261415)
@@ -3725,13 +3725,15 @@
protector_name = ref_check.group('protector_name')
protected_name = ref_check.group('protected_name')
cap_protected_name = protected_name[0].upper() + protected_name[1:]
- expected_protector_name = 'protected' + cap_protected_name
- if protected_name == 'this' and protector_name != 'protectedThis':
- error(line_number, 'readability/naming/protected', 4, "\'" + protector_name + "\' is incorrectly named. It should be named \'protectedThis\'.")
- elif protector_name == expected_protector_name or protector_name == 'protector':
- return
- else:
- error(line_number, 'readability/naming/protected', 4, "\'" + protector_name + "\' is incorrectly named. It should be named \'protector\' or \'" + expected_protector_name + "\'.")
+ # Ignore function declarations where cap_protected_name == protected_name indicates a type name.
+ if cap_protected_name != protected_name:
+ expected_protector_name = 'protected' + cap_protected_name
+ if protected_name == 'this' and protector_name != 'protectedThis':
+ error(line_number, 'readability/naming/protected', 4, "\'" + protector_name + "\' is incorrectly named. It should be named \'protectedThis\'.")
+ elif protector_name == expected_protector_name or protector_name == 'protector':
+ return
+ else:
+ error(line_number, 'readability/naming/protected', 4, "\'" + protector_name + "\' is incorrectly named. It should be named \'protector\' or \'" + expected_protector_name + "\'.")
# Basically, a declaration is a type name followed by whitespaces
# followed by an identifier. The type name can be complicated
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (261414 => 261415)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2020-05-08 20:57:57 UTC (rev 261414)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2020-05-08 21:14:24 UTC (rev 261415)
@@ -5894,6 +5894,8 @@
# Lines that look like a protector variable declaration but aren't.
self.assert_lint('static RefPtr<Widget> doSomethingWith(widget);', '')
self.assert_lint('RefPtr<Widget> create();', '')
+ self.assert_lint('Ref<GeolocationPermissionRequestProxy> createRequest(GeolocationIdentifier);', '')
+ self.assert_lint('Ref<TypeName> createSomething(OtherTypeName);', '')
def test_parameter_names(self):
# Leave meaningless variable names out of function declarations.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes