Bug 210682 - check-webkit-style false positive for [readability/naming/protected] with method declaration
Summary: check-webkit-style false positive for [readability/naming/protected] with met...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-17 20:19 PDT by David Kilzer (:ddkilzer)
Modified: 2020-05-08 14:15 PDT (History)
9 users (show)

See Also:


Attachments
Patch v1 (3.90 KB, patch)
2020-04-17 20:27 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (3.97 KB, patch)
2020-05-05 17:59 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-04-17 20:19:46 PDT
check-webkit-style false positive for [readability/naming/protected] with method declaration.

    Ref<GeolocationPermissionRequestProxy> createRequest(GeolocationIdentifier);

ERROR: Source/WebKit/UIProcess/GeolocationPermissionRequestManagerProxy.h:46:  'createRequest' is incorrectly named. It should be named 'protector' or 'protectedGeolocationIdentifier'.  [readability/naming/protected] [4]
Comment 1 David Kilzer (:ddkilzer) 2020-04-17 20:27:54 PDT
Created attachment 396829 [details]
Patch v1
Comment 2 David Kilzer (:ddkilzer) 2020-04-17 20:43:32 PDT
Comment on attachment 396829 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396829&action=review

> Tools/Scripts/webkitpy/style/checkers/cpp.py:3676
> +        # Ignore function declarations where cap_protected_name == protected_name indicates a type name.
> +        if not cap_protected_name == protected_name:

I considered checking whether `protector_name` started with 'create' instead, but I thought the capitalization check would likely result in better results based on our rules for starting variables with lowercase letters.
Comment 3 Jonathan Bedard 2020-04-20 07:42:41 PDT
Comment on attachment 396829 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396829&action=review

>> Tools/Scripts/webkitpy/style/checkers/cpp.py:3676
>> +        if not cap_protected_name == protected_name:
> 
> I considered checking whether `protector_name` started with 'create' instead, but I thought the capitalization check would likely result in better results based on our rules for starting variables with lowercase letters.

Feel like we would usually use != instead of not *** == ***.

> Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:5787
> +        self.assert_lint('Ref<GeolocationPermissionRequestProxy> createRequest(GeolocationIdentifier);', '')

Could we have a counter-example? Ie, a line where cap_protected_name == protected_name and we don't lint?
Comment 4 David Kilzer (:ddkilzer) 2020-05-05 16:51:13 PDT
Comment on attachment 396829 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396829&action=review

>>> Tools/Scripts/webkitpy/style/checkers/cpp.py:3676
>>> +        if not cap_protected_name == protected_name:
>> 
>> I considered checking whether `protector_name` started with 'create' instead, but I thought the capitalization check would likely result in better results based on our rules for starting variables with lowercase letters.
> 
> Feel like we would usually use != instead of not *** == ***.

Will fix.

>> Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:5787
>> +        self.assert_lint('Ref<GeolocationPermissionRequestProxy> createRequest(GeolocationIdentifier);', '')
> 
> Could we have a counter-example? Ie, a line where cap_protected_name == protected_name and we don't lint?

The counter-example should never exist because we wouldn't name a variable that started with a capital letter!
Comment 5 David Kilzer (:ddkilzer) 2020-05-05 17:57:36 PDT
Comment on attachment 396829 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396829&action=review

>>> Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:5787
>>> +        self.assert_lint('Ref<GeolocationPermissionRequestProxy> createRequest(GeolocationIdentifier);', '')
>> 
>> Could we have a counter-example? Ie, a line where cap_protected_name == protected_name and we don't lint?
> 
> The counter-example should never exist because we wouldn't name a variable that started with a capital letter!

Please disregard this comment.  I understand what you meant now.  Will add.
Comment 6 David Kilzer (:ddkilzer) 2020-05-05 17:59:38 PDT
Created attachment 398575 [details]
Patch v2
Comment 7 Darin Adler 2020-05-05 18:17:51 PDT
Comment on attachment 398575 [details]
Patch v2

I don’t understand the code, but I understand the test cases.
Comment 8 EWS 2020-05-08 14:14:29 PDT
Committed r261415: <https://trac.webkit.org/changeset/261415>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 398575 [details].
Comment 9 Radar WebKit Bug Importer 2020-05-08 14:15:20 PDT
<rdar://problem/63035760>