WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
105832
[style] WebIDL-reflecting upper-case enums reported as style violation
https://bugs.webkit.org/show_bug.cgi?id=105832
Summary
[style] WebIDL-reflecting upper-case enums reported as style violation
Zan Dobersek
Reported
2012-12-28 07:47:53 PST
[style] WebIDL-reflecting upper-case enums reported as style violation
Attachments
Patch
(4.90 KB, patch)
2012-12-28 07:55 PST
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(4.86 KB, patch)
2013-01-03 01:31 PST
,
Zan Dobersek
tony
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2012-12-28 07:55:06 PST
Created
attachment 180875
[details]
Patch
Adam Barth
Comment 2
2013-01-02 11:19:35 PST
Interesting idea. Who is the best person to review this change?
Tony Chang
Comment 3
2013-01-02 11:33:49 PST
Comment on
attachment 180875
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=180875&action=review
When are you seeing this? I thought the generated files weren't checked in so the style checker doesn't run on them.
> Tools/Scripts/webkitpy/style/checkers/cpp.py:1219 > + self.webidl_enum = False
Nit: I think is_webidl_enum would be clearer.
> Tools/Scripts/webkitpy/style/checkers/cpp.py:2098 > + if match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number]): > + enum_state.webidl_enum = True
I would probably do: enum_state.is_webidl_enum = True if match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number]) else False Also, it seems more common to compile regular expressions and store them as globals.
Zan Dobersek
Comment 4
2013-01-03 00:58:10 PST
(In reply to
comment #3
)
> (From update of
attachment 180875
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=180875&action=review
> > When are you seeing this? I thought the generated files weren't checked in so the style checker doesn't run on them.
This is the case with enums in WebCore, for instance in Source/WebCore/Modules/webaudio/PannerNode.h:
http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/webaudio/PannerNode.h#L49
These still get checked, but are reported as violations while they're basically only reflecting IDL and are required to be upper-cased (while C++ enums are expected to be InterCaps).
Zan Dobersek
Comment 5
2013-01-03 01:12:01 PST
Comment on
attachment 180875
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=180875&action=review
>> Tools/Scripts/webkitpy/style/checkers/cpp.py:2098 >> + enum_state.webidl_enum = True > > I would probably do: > enum_state.is_webidl_enum = True if match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number]) else False > > Also, it seems more common to compile regular expressions and store them as globals.
Addressing the last line, many one-time expressions are written in-line and are then compiled and cached by match, sub, search and other similar methods. Simply justifying the current approach, I can still change it if you have a strong opinion about it.
Zan Dobersek
Comment 6
2013-01-03 01:31:07 PST
Created
attachment 181157
[details]
Patch
Tony Chang
Comment 7
2013-01-03 10:01:39 PST
Comment on
attachment 181157
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=181157&action=review
> Tools/Scripts/webkitpy/style/checkers/cpp.py:2097 > + enum_state.is_webidl_enum = bool(match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number])) if not enum_state.is_webidl_enum else True
Nit: I would probably do: enum_state.is_webidl_enum |= bool(match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number]))
Zan Dobersek
Comment 8
2013-01-03 10:45:28 PST
(In reply to
comment #7
)
> (From update of
attachment 181157
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=181157&action=review
> > > Tools/Scripts/webkitpy/style/checkers/cpp.py:2097 > > + enum_state.is_webidl_enum = bool(match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number])) if not enum_state.is_webidl_enum else True > > Nit: I would probably do: > enum_state.is_webidl_enum |= bool(match(r'\s*// Web(?:Kit)?IDL enum\s*$', clean_lines.raw_lines[line_number]))
Looks better. Adjusted and committed as
r138719
.
http://trac.webkit.org/changeset/138719
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug