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

Side by Side Diff: third_party/polymer/v1_0/find_unused_elements.py

Issue 2020963002: MD History: Add responsive layout which hides the sidebar in thin windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and closure Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python2 1 #!/usr/bin/python2
2 2
3 # Copyright 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Identifies Polymer elements that downloaded but not used by Chrome. 7 """Identifies Polymer elements that downloaded but not used by Chrome.
8 8
9 Only finds "first-order" unused elements; re-run after removing unused elements 9 Only finds "first-order" unused elements; re-run after removing unused elements
10 to check if other elements have become unused. 10 to check if other elements have become unused.
11 """ 11 """
12 12
13 import os 13 import os
14 import re 14 import re
15 import subprocess 15 import subprocess
16 16
17 17
18 class UnusedElementsDetector(object): 18 class UnusedElementsDetector(object):
19 """Finds unused Polymer elements.""" 19 """Finds unused Polymer elements."""
20 20
21 # Unused elements to ignore because we plan to use them soon. 21 # Unused elements to ignore because we plan to use them soon.
22 __WHITELIST = ( 22 __WHITELIST = (
23 # TODO(tsergeant): Use element or remove from whitelist.
24 'app-layout',
25 # TODO(dschuyler): Use element or remove from whitelist. 23 # TODO(dschuyler): Use element or remove from whitelist.
26 'app-route', 24 'app-route',
27 # Necessary for closure. 25 # Necessary for closure.
28 'polymer-externs', 26 'polymer-externs',
29 ) 27 )
30 28
31 def __init__(self): 29 def __init__(self):
32 polymer_dir = os.path.dirname(os.path.realpath(__file__)) 30 polymer_dir = os.path.dirname(os.path.realpath(__file__))
33 self.__COMPONENTS_DIR = os.path.join(polymer_dir, 'components-chromium') 31 self.__COMPONENTS_DIR = os.path.join(polymer_dir, 'components-chromium')
34 32
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 # scripts). 150 # scripts).
153 if re.search('/%s' % element_dir, 151 if re.search('/%s' % element_dir,
154 self.__StripComments( 152 self.__StripComments(
155 os.path.join(dirpath, filename))): 153 os.path.join(dirpath, filename))):
156 return True 154 return True
157 return False 155 return False
158 156
159 157
160 if __name__ == '__main__': 158 if __name__ == '__main__':
161 UnusedElementsDetector().Run() 159 UnusedElementsDetector().Run()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698