RESOLVED FIXED 240532
check-webkit-style: allow all upper case value in ResourceRequestBase::Requester
https://bugs.webkit.org/show_bug.cgi?id=240532
Summary check-webkit-style: allow all upper case value in ResourceRequestBase::Requester
Yury Semikhatsky
Reported 2022-05-17 12:36:24 PDT
The enum already contains XHR value which fails style checks when the code is touched.
Attachments
Yury Semikhatsky
Comment 1 2022-05-17 13:08:51 PDT
EWS
Comment 2 2022-05-17 15:12:06 PDT
Committed r294353 (250660@main): <https://commits.webkit.org/250660@main> Reviewed commits have been landed. Closing PR #685 and removing active labels.
Radar WebKit Bug Importer
Comment 3 2022-05-17 15:13:29 PDT
Darin Adler
Comment 4 2022-05-17 17:40:50 PDT
Seems like a special case for the value "XHR" would be better than a special case for an enumeration of a particular name.
Yury Semikhatsky
Comment 5 2022-05-17 23:21:53 PDT
(In reply to Darin Adler from comment #4) > Seems like a special case for the value "XHR" would be better than a special > case for an enumeration of a particular name. Yeah, I started with that but then decided to keep it in line with other enums, e.g. NSType has both all upper case and camel case values. Can change that to add exception for a bunch of common abbreviations instead (URL, XHR etc)if you have strong preference.
Darin Adler
Comment 6 2022-05-18 20:09:47 PDT
(In reply to Yury Semikhatsky from comment #5) > (In reply to Darin Adler from comment #4) > > Seems like a special case for the value "XHR" would be better than a special > > case for an enumeration of a particular name. > > Yeah, I started with that but then decided to keep it in line with other > enums, e.g. NSType has both all upper case and camel case values. Can change > that to add exception for a bunch of common abbreviations instead (URL, XHR > etc)if you have strong preference. I don’t think the way we are handling the other enumerations based on the names of the enumerations is good. I think a list of actual all capital values would be much better. Those would self-evidently be correct. Whereas names of enumerations could be reused in different namespaces, and it’s not at all clear why these enumerations are special. So I would have started doing exceptions by value for this one, "XHR", and also considered migrating the other exceptions too. Or maybe there’s an even better scheme. I don’t think the list of enumeration type names is a good scheme.
Yury Semikhatsky
Comment 7 2022-05-19 12:41:08 PDT
(In reply to Darin Adler from comment #6) > (In reply to Yury Semikhatsky from comment #5) > > (In reply to Darin Adler from comment #4) > > > Seems like a special case for the value "XHR" would be better than a special > > > case for an enumeration of a particular name. > > > > Yeah, I started with that but then decided to keep it in line with other > > enums, e.g. NSType has both all upper case and camel case values. Can change > > that to add exception for a bunch of common abbreviations instead (URL, XHR > > etc)if you have strong preference. > > I don’t think the way we are handling the other enumerations based on the > names of the enumerations is good. I think a list of actual all capital > values would be much better. Those would self-evidently be correct. Whereas > names of enumerations could be reused in different namespaces, and it’s not > at all clear why these enumerations are special. > > So I would have started doing exceptions by value for this one, "XHR", and > also considered migrating the other exceptions too. > I can easily add exceptions for the values of Meridiem, NSType and Requester from the current list, but it will not work for JSTokenType which has too many values and they look like plain violations of the style rule: https://github.com/WebKit/WebKit/blob/b1494de3e5ef6bda876a9d26e5b2f618ba620330/Source/JavaScriptCore/parser/ParserTokens.h#L63 In that case the most practical approach would be to keep enum name exception for JSTokenType and add exceptions for the values of the other enums and remove them from _ALLOW_ALL_UPPERCASE_ENUM. WDYT?
Darin Adler
Comment 8 2022-05-19 12:44:08 PDT
Yes, that’s a great next step. I think for JSTokenType we might just just consider actually changing them enumeration values at some point. I’m not sure these need to be all uppercase. Whereas "XHR" has to be!
Note You need to log in before you can comment on or make changes to this bug.