Browse Source

make IGNORE_FILES more readable

Charles Kerr 7 years ago
parent
commit
d36e451301
1 changed files with 28 additions and 33 deletions
  1. 28 33
      script/cpplint.py

+ 28 - 33
script/cpplint.py

@@ -7,36 +7,31 @@ import sys
 from lib.config import enable_verbose_mode
 from lib.util import execute
 
-IGNORE_FILES = [
-  os.path.join('atom', 'browser', 'mac', 'atom_application.h'),
-  os.path.join('atom', 'browser', 'mac', 'atom_application_delegate.h'),
-  os.path.join('atom', 'browser', 'resources', 'win', 'resource.h'),
-  os.path.join('atom', 'browser', 'ui', 'cocoa', 'atom_menu_controller.h'),
-  os.path.join('atom', 'browser', 'ui', 'cocoa', 'atom_touch_bar.h'),
-  os.path.join('atom', 'browser', 'ui', 'cocoa',
-               'touch_bar_forward_declarations.h'),
-  os.path.join('atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'),
-  os.path.join('atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'),
-  os.path.join('atom', 'common', 'api', 'api_messages.h'),
-  os.path.join('atom', 'common', 'common_message_generator.cc'),
-  os.path.join('atom', 'common', 'common_message_generator.h'),
-  os.path.join('atom', 'node', 'osfhandle.cc'),
-  os.path.join('brightray', 'browser', 'mac',
-               'bry_inspectable_web_contents_view.h'),
-  os.path.join('brightray', 'browser', 'mac', 'event_dispatching_window.h'),
-  os.path.join('brightray', 'browser', 'mac',
-               'notification_center_delegate.h'),
-  os.path.join('brightray', 'browser', 'win', 'notification_presenter_win7.h'),
-  os.path.join('brightray', 'browser', 'win', 'win32_desktop_notifications',
-               'common.h'),
-  os.path.join('brightray', 'browser', 'win', 'win32_desktop_notifications',
-               'desktop_notification_controller.cc'),
-  os.path.join('brightray', 'browser', 'win', 'win32_desktop_notifications',
-               'desktop_notification_controller.h'),
-  os.path.join('brightray', 'browser', 'win', 'win32_desktop_notifications',
-               'toast.h'),
-  os.path.join('brightray', 'browser', 'win', 'win32_notification.h')
-]
+IGNORE_FILES = set(os.path.join(*components) for components in [
+  ['atom', 'browser', 'mac', 'atom_application.h'],
+  ['atom', 'browser', 'mac', 'atom_application_delegate.h'],
+  ['atom', 'browser', 'resources', 'win', 'resource.h'],
+  ['atom', 'browser', 'ui', 'cocoa', 'atom_menu_controller.h'],
+  ['atom', 'browser', 'ui', 'cocoa', 'atom_touch_bar.h'],
+  ['atom', 'browser', 'ui', 'cocoa', 'touch_bar_forward_declarations.h'],
+  ['atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'],
+  ['atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'],
+  ['atom', 'common', 'api', 'api_messages.h'],
+  ['atom', 'common', 'common_message_generator.cc'],
+  ['atom', 'common', 'common_message_generator.h'],
+  ['atom', 'node', 'osfhandle.cc'],
+  ['brightray', 'browser', 'mac', 'bry_inspectable_web_contents_view.h'],
+  ['brightray', 'browser', 'mac', 'event_dispatching_window.h'],
+  ['brightray', 'browser', 'mac', 'notification_center_delegate.h'],
+  ['brightray', 'browser', 'win', 'notification_presenter_win7.h'],
+  ['brightray', 'browser', 'win', 'win32_desktop_notifications', 'common.h'],
+  ['brightray', 'browser', 'win', 'win32_desktop_notifications',
+   'desktop_notification_controller.cc'],
+  ['brightray', 'browser', 'win', 'win32_desktop_notifications',
+   'desktop_notification_controller.h'],
+  ['brightray', 'browser', 'win', 'win32_desktop_notifications', 'toast.h'],
+  ['brightray', 'browser', 'win', 'win32_notification.h']
+])
 
 SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 
@@ -72,10 +67,10 @@ def main():
 
   os.chdir(SOURCE_ROOT)
   files = find_files(['atom', 'brightray'], is_cpp_file)
-  files -= set(IGNORE_FILES)
+  files -= IGNORE_FILES
   if args.only_changed:
     files &= find_changed_files()
-  call_cpplint(list(files))
+  call_cpplint(files)
 
 
 def find_files(roots, test):
@@ -100,7 +95,7 @@ def find_changed_files():
 def call_cpplint(files):
   if files:
     cpplint = cpplint_path()
-    execute([sys.executable, cpplint] + files)
+    execute([sys.executable, cpplint] + list(files))
 
 
 def cpplint_path():