fix: lint Objective-C header files (#31923)

This commit is contained in:
Milan Burda 2021-11-22 01:36:32 +01:00 committed by GitHub
parent 98a5996b30
commit 7ff15038d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

View file

@ -14,10 +14,6 @@ const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, '..', 'third_party', 'depot_tools'
const IGNORELIST = new Set([ const IGNORELIST = new Set([
['shell', 'browser', 'resources', 'win', 'resource.h'], ['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'], ['shell', 'common', 'node_includes.h'],
['spec', 'static', 'jquery-2.0.3.min.js'], ['spec', 'static', 'jquery-2.0.3.min.js'],
['spec', 'ts-smoke', 'electron', 'main.ts'], ['spec', 'ts-smoke', 'electron', 'main.ts'],
@ -82,7 +78,7 @@ const LINTERS = [{
}, { }, {
key: 'objc', key: 'objc',
roots: ['shell'], roots: ['shell'],
test: filename => filename.endsWith('.mm'), test: filename => filename.endsWith('.mm') || (filename.endsWith('.h') && isObjCHeader(filename)),
run: (opts, filenames) => { run: (opts, filenames) => {
if (opts.fix) { if (opts.fix) {
spawnAndCheckExitCode('python', ['script/run-clang-format.py', '--fix', ...filenames]); spawnAndCheckExitCode('python', ['script/run-clang-format.py', '--fix', ...filenames]);
@ -96,7 +92,7 @@ const LINTERS = [{
'-whitespace/indent', '-whitespace/indent',
'-whitespace/parens' '-whitespace/parens'
]; ];
cpplint(['--extensions=mm', `--filter=${filter.join(',')}`, ...filenames]); cpplint(['--extensions=mm,h', `--filter=${filter.join(',')}`, ...filenames]);
} }
}, { }, {
key: 'python', key: 'python',

View file

@ -2,6 +2,9 @@
// Use of this source code is governed by the MIT license that can be // Use of this source code is governed by the MIT license that can be
// found in the LICENSE file. // 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/callback.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/mac/scoped_sending_event.h" #include "base/mac/scoped_sending_event.h"
@ -45,3 +48,5 @@
withUserInfo:(NSDictionary*)userInfo; withUserInfo:(NSDictionary*)userInfo;
@end @end
#endif // SHELL_BROWSER_MAC_ELECTRON_APPLICATION_H_

View file

@ -2,6 +2,9 @@
// Use of this source code is governed by the MIT license that can be // Use of this source code is governed by the MIT license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef SHELL_BROWSER_MAC_ELECTRON_APPLICATION_DELEGATE_H_
#define SHELL_BROWSER_MAC_ELECTRON_APPLICATION_DELEGATE_H_
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "shell/browser/ui/cocoa/electron_menu_controller.h" #import "shell/browser/ui/cocoa/electron_menu_controller.h"
@ -15,3 +18,5 @@
- (void)setApplicationDockMenu:(electron::ElectronMenuModel*)model; - (void)setApplicationDockMenu:(electron::ElectronMenuModel*)model;
@end @end
#endif // SHELL_BROWSER_MAC_ELECTRON_APPLICATION_DELEGATE_H_

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#ifndef 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_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ #define SHELL_BROWSER_UI_COCOA_ELECTRON_INSPECTABLE_WEB_CONTENTS_VIEW_H_
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
@ -52,4 +52,4 @@ using electron::InspectableWebContentsViewMac;
@end @end
#endif // SHELL_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ #endif // SHELL_BROWSER_UI_COCOA_ELECTRON_INSPECTABLE_WEB_CONTENTS_VIEW_H_