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

Issue 1918333005: Add script to find unused Polymer elements (Closed)

Created:
4 years, 7 months ago by michaelpg
Modified:
4 years, 7 months ago
Reviewers:
stevenjb, Dan Beam
CC:
chromium-reviews, dbeam+watch-polymer_chromium.org, michaelpg+watch-polymer_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add script to find unused Polymer elements Detected three elements (removed in crrev.com/1930603003) as well as the whitelisted elements. Committed: https://crrev.com/d32a44f0b42dd5705d6dff278ee41b19c528829c Cr-Commit-Position: refs/heads/master@{#391282} BUG=605823

Patch Set 1 #

Patch Set 2 : pylint #

Total comments: 20

Patch Set 3 : stevenjb #

Patch Set 4 : simplify #

Patch Set 5 : with #

Total comments: 4

Patch Set 6 : dbeam #

Patch Set 7 : self #

Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -26 lines) Patch
M third_party/polymer/v1_0/find_unused_elements.py View 1 2 3 4 5 6 8 chunks +22 lines, -26 lines 0 comments Download

Messages

Total messages: 14 (5 generated)
michaelpg
dbeam, PTAL. I'm not used to our Python style guide but this passes pylint. The ...
4 years, 7 months ago (2016-04-28 02:34:30 UTC) #2
stevenjb
Thanks, this seems much more maintainable to me, even if my python style fu is ...
4 years, 7 months ago (2016-04-29 20:34:56 UTC) #4
michaelpg
PTAL. I also ran flake8 which is kinda like closure + pylint. Re the indentation ...
4 years, 7 months ago (2016-05-02 19:31:45 UTC) #5
stevenjb
lgtm
4 years, 7 months ago (2016-05-02 23:35:58 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1918333005/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1918333005/80001
4 years, 7 months ago (2016-05-03 16:51:02 UTC) #8
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 7 months ago (2016-05-03 17:33:17 UTC) #9
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/d32a44f0b42dd5705d6dff278ee41b19c528829c Cr-Commit-Position: refs/heads/master@{#391282}
4 years, 7 months ago (2016-05-03 17:35:34 UTC) #11
Dan Beam
post-submit drive-by also, i think you're overusing @staticmethod here https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_0/find_unused_elements.py File third_party/polymer/v1_0/find_unused_elements.py (right): https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_0/find_unused_elements.py#newcode24 third_party/polymer/v1_0/find_unused_elements.py:24: ...
4 years, 7 months ago (2016-05-03 19:22:08 UTC) #12
michaelpg
4 years, 7 months ago (2016-05-03 21:29:19 UTC) #14
Message was sent while issue was closed.
I addressed your comments and made some functions instance methods.

Exact same patch is uploaded at https://codereview.chromium.org/1944133002 for
CQ.

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
File third_party/polymer/v1_0/find_unused_elements.py (right):

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:24: class
UnusedElementsDetector:
On 2016/05/03 19:22:08, Dan Beam wrote:
> this should probably inherit from (object)

Done.

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:28: __whitelist = (
On 2016/05/03 19:22:08, Dan Beam wrote:
> nit: __WHITELIST (Class contant
> https://google.github.io/styleguide/pyguide.html#Naming)

Done.

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:28: __whitelist = (
On 2016/05/03 19:22:08, Dan Beam wrote:
> nit: I think it's more common to use 4\s indent in tuple literals

the examples in PEP-8 use 4 spaces (as with other indents), the style guide says
to use 2 spaces instead of 4 spaces, so that sounds "incorrect"

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:50: return re.sub('<!--.*?-->',
'', text, flags=re.MULTILINE|re.DOTALL)
On 2016/05/03 19:22:08, Dan Beam wrote:
> nit: flags=re.MULTILINE | re.DOTALL)
>                        ^ ^

Done. Looked weird to me inside a param=value expression with no spaces.

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:65: text = re.sub('<if .*?>',
'', text)
On 2016/05/03 19:22:07, Dan Beam wrote:
> nit: case-insensitive maybe?

Done.

https://codereview.chromium.org/1918333005/diff/20001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:156:
UnusedElementsDetector.Run()
On 2016/05/03 19:22:07, Dan Beam wrote:
> if __name__ == '__main__':
>   UnusedElementDetector().run()

Done.

https://codereview.chromium.org/1918333005/diff/80001/third_party/polymer/v1_...
File third_party/polymer/v1_0/find_unused_elements.py (right):

https://codereview.chromium.org/1918333005/diff/80001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:110: continue
On 2016/05/03 19:22:08, Dan Beam wrote:
> what does this do?

removed

https://codereview.chromium.org/1918333005/diff/80001/third_party/polymer/v1_...
third_party/polymer/v1_0/find_unused_elements.py:118: if len(unused_elements):
On 2016/05/03 19:22:08, Dan Beam wrote:
> i think this can be just
> 
>   if unused_elements:

Done.

Powered by Google App Engine
This is Rietveld 408576698