From 7ff15038d64bd0ca3621a7f741b2b067b6b8a351 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 22 Nov 2021 01:36:32 +0100 Subject: [PATCH] fix: lint Objective-C header files (#31923) --- script/lint.js | 8 ++------ shell/browser/mac/electron_application.h | 5 +++++ shell/browser/mac/electron_application_delegate.h | 5 +++++ .../ui/cocoa/electron_inspectable_web_contents_view.h | 6 +++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/script/lint.js b/script/lint.js index a2a6a7565c7a..b6bb2bd15722 100755 --- a/script/lint.js +++ b/script/lint.js @@ -14,10 +14,6 @@ const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, '..', 'third_party', 'depot_tools' const IGNORELIST = new Set([ ['shell', 'browser', 'resources', 'win', 'resource.h'], - ['shell', 'browser', 'notifications', 'mac', 'notification_center_delegate.h'], - ['shell', 'browser', 'ui', 'cocoa', 'event_dispatching_window.h'], - ['shell', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'], - ['shell', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'], ['shell', 'common', 'node_includes.h'], ['spec', 'static', 'jquery-2.0.3.min.js'], ['spec', 'ts-smoke', 'electron', 'main.ts'], @@ -82,7 +78,7 @@ const LINTERS = [{ }, { key: 'objc', roots: ['shell'], - test: filename => filename.endsWith('.mm'), + test: filename => filename.endsWith('.mm') || (filename.endsWith('.h') && isObjCHeader(filename)), run: (opts, filenames) => { if (opts.fix) { spawnAndCheckExitCode('python', ['script/run-clang-format.py', '--fix', ...filenames]); @@ -96,7 +92,7 @@ const LINTERS = [{ '-whitespace/indent', '-whitespace/parens' ]; - cpplint(['--extensions=mm', `--filter=${filter.join(',')}`, ...filenames]); + cpplint(['--extensions=mm,h', `--filter=${filter.join(',')}`, ...filenames]); } }, { key: 'python', diff --git a/shell/browser/mac/electron_application.h b/shell/browser/mac/electron_application.h index 70d312236a43..24cac2564364 100644 --- a/shell/browser/mac/electron_application.h +++ b/shell/browser/mac/electron_application.h @@ -2,6 +2,9 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. +#ifndef SHELL_BROWSER_MAC_ELECTRON_APPLICATION_H_ +#define SHELL_BROWSER_MAC_ELECTRON_APPLICATION_H_ + #include "base/callback.h" #include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_sending_event.h" @@ -45,3 +48,5 @@ withUserInfo:(NSDictionary*)userInfo; @end + +#endif // SHELL_BROWSER_MAC_ELECTRON_APPLICATION_H_ diff --git a/shell/browser/mac/electron_application_delegate.h b/shell/browser/mac/electron_application_delegate.h index 43063ae2d874..d1697d2a885e 100644 --- a/shell/browser/mac/electron_application_delegate.h +++ b/shell/browser/mac/electron_application_delegate.h @@ -2,6 +2,9 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. +#ifndef SHELL_BROWSER_MAC_ELECTRON_APPLICATION_DELEGATE_H_ +#define SHELL_BROWSER_MAC_ELECTRON_APPLICATION_DELEGATE_H_ + #import #import "shell/browser/ui/cocoa/electron_menu_controller.h" @@ -15,3 +18,5 @@ - (void)setApplicationDockMenu:(electron::ElectronMenuModel*)model; @end + +#endif // SHELL_BROWSER_MAC_ELECTRON_APPLICATION_DELEGATE_H_ diff --git a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h index e82d2e3df8c3..2bedbf22f5f8 100644 --- a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h +++ b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef SHELL_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ -#define SHELL_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#define SHELL_BROWSER_UI_COCOA_ELECTRON_INSPECTABLE_WEB_CONTENTS_VIEW_H_ #import @@ -52,4 +52,4 @@ using electron::InspectableWebContentsViewMac; @end -#endif // SHELL_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_INSPECTABLE_WEB_CONTENTS_VIEW_H_