chore: add clang-format and limited linting for Objective-C sources (#18104)
This commit is contained in:
parent
8785e9007c
commit
9585818a90
35 changed files with 142 additions and 36 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
// Copyright (c) 2017 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/app/atom_main_delegate.h"
|
#include "atom/app/atom_main_delegate.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "atom/browser/mac/atom_application.h"
|
#include "atom/browser/mac/atom_application.h"
|
||||||
#include "atom/common/application_info.h"
|
#include "atom/common/application_info.h"
|
||||||
#include "atom/common/mac/main_application_bundle.h"
|
#include "atom/common/mac/main_application_bundle.h"
|
||||||
|
|
|
@ -33,6 +33,6 @@ void App::SetAppLogsPath(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/browser/api/atom_api_app.h"
|
#include "atom/browser/api/atom_api_app.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
@ -59,6 +61,6 @@ base::RepeatingCallback<void()> App::StartAccessingSecurityScopedResource(
|
||||||
bookmarkUrl);
|
bookmarkUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/browser/api/atom_api_browser_window.h"
|
#include "atom/browser/api/atom_api_browser_window.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "atom/browser/native_browser_view.h"
|
#include "atom/browser/native_browser_view.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#import "atom/browser/api/atom_api_menu_mac.h"
|
#import "atom/browser/api/atom_api_menu_mac.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "atom/browser/unresponsive_suppressor.h"
|
#include "atom/browser/unresponsive_suppressor.h"
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
#include "atom/browser/api/atom_api_power_monitor.h"
|
#include "atom/browser/api/atom_api_power_monitor.h"
|
||||||
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <vector>
|
||||||
|
|
||||||
|
#import <ApplicationServices/ApplicationServices.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@interface MacLockMonitor : NSObject {
|
@interface MacLockMonitor : NSObject {
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include "atom/browser/api/atom_api_system_preferences.h"
|
#include "atom/browser/api/atom_api_system_preferences.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/browser/auto_updater.h"
|
#include "atom/browser/auto_updater.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
|
#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
|
||||||
#import <ReactiveCocoa/RACCommand.h>
|
#import <ReactiveCocoa/RACCommand.h>
|
||||||
#import <ReactiveCocoa/RACSignal.h>
|
#import <ReactiveCocoa/RACSignal.h>
|
||||||
|
@ -29,7 +31,7 @@ SQRLUpdater* g_updater = nil;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool g_update_available = false;
|
bool g_update_available = false;
|
||||||
std::string update_url_ = "";
|
std::string update_url_ = ""; // NOLINT(runtime/string)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "atom/browser/mac/atom_application.h"
|
#include "atom/browser/mac/atom_application.h"
|
||||||
#include "atom/browser/mac/atom_application_delegate.h"
|
#include "atom/browser/mac/atom_application_delegate.h"
|
||||||
#include "atom/browser/mac/dict_util.h"
|
#include "atom/browser/mac/dict_util.h"
|
||||||
|
@ -282,9 +285,9 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
|
||||||
LOG(ERROR) << "Unable to set login item enabled on sandboxed app.";
|
LOG(ERROR) << "Unable to set login item enabled on sandboxed app.";
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (settings.open_at_login)
|
if (settings.open_at_login) {
|
||||||
base::mac::AddToLoginItems(settings.open_as_hidden);
|
base::mac::AddToLoginItems(settings.open_as_hidden);
|
||||||
else {
|
} else {
|
||||||
RemoveFromLoginItems();
|
RemoveFromLoginItems();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#import "atom/browser/mac/atom_application.h"
|
#import "atom/browser/mac/atom_application.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#import "atom/browser/mac/atom_application_delegate.h"
|
#import "atom/browser/mac/atom_application_delegate.h"
|
||||||
#include "atom/browser/mac/dict_util.h"
|
#include "atom/browser/mac/dict_util.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#import "atom/browser/mac/atom_application_delegate.h"
|
#import "atom/browser/mac/atom_application_delegate.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#import "atom/browser/mac/atom_application.h"
|
#import "atom/browser/mac/atom_application.h"
|
||||||
#include "atom/browser/mac/dict_util.h"
|
#include "atom/browser/mac/dict_util.h"
|
||||||
|
@ -24,7 +27,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
|
||||||
@end
|
@end
|
||||||
@implementation OOMDisabledIMKInputSession
|
@implementation OOMDisabledIMKInputSession
|
||||||
- (void)_coreAttributesFromRange:(NSRange)range
|
- (void)_coreAttributesFromRange:(NSRange)range
|
||||||
whichAttributes:(long long)attributes
|
whichAttributes:(long long)attributes // NOLINT(runtime/int)
|
||||||
completionHandler:(void (^)(void))block {
|
completionHandler:(void (^)(void))block {
|
||||||
// The allocator flag is per-process, so other threads may temporarily
|
// The allocator flag is per-process, so other threads may temporarily
|
||||||
// not have fatal OOM occur while this method executes, but it is better
|
// not have fatal OOM occur while this method executes, but it is better
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#include "atom/browser/mac/dict_util.h"
|
#include "atom/browser/mac/dict_util.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/browser/mac/in_app_purchase.h"
|
#include "atom/browser/mac/in_app_purchase.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/browser/mac/in_app_purchase_observer.h"
|
#include "atom/browser/mac/in_app_purchase_observer.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#include "atom/browser/mac/in_app_purchase_product.h"
|
#include "atom/browser/mac/in_app_purchase_product.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/browser/native_browser_view_mac.h"
|
#include "atom/browser/native_browser_view_mac.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/ui/inspectable_web_contents.h"
|
#include "atom/browser/ui/inspectable_web_contents.h"
|
||||||
#include "atom/browser/ui/inspectable_web_contents_view.h"
|
#include "atom/browser/ui/inspectable_web_contents_view.h"
|
||||||
#include "skia/ext/skia_utils_mac.h"
|
#include "skia/ext/skia_utils_mac.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <objc/objc-runtime.h>
|
#include <objc/objc-runtime.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/native_browser_view_mac.h"
|
#include "atom/browser/native_browser_view_mac.h"
|
||||||
#include "atom/browser/ui/cocoa/atom_native_widget_mac.h"
|
#include "atom/browser/ui/cocoa/atom_native_widget_mac.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/browser/notifications/mac/cocoa_notification.h"
|
#include "atom/browser/notifications/mac/cocoa_notification.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "atom/browser/notifications/notification_delegate.h"
|
#include "atom/browser/notifications/notification_delegate.h"
|
||||||
#include "atom/browser/notifications/notification_presenter.h"
|
#include "atom/browser/notifications/notification_presenter.h"
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/browser/notifications/mac/notification_center_delegate.h"
|
#include "atom/browser/notifications/mac/notification_center_delegate.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "atom/browser/notifications/mac/cocoa_notification.h"
|
#include "atom/browser/notifications/mac/cocoa_notification.h"
|
||||||
#include "atom/browser/notifications/mac/notification_presenter_mac.h"
|
#include "atom/browser/notifications/mac/notification_presenter_mac.h"
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/certificate_trust.h"
|
#include "atom/browser/ui/certificate_trust.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <SecurityInterface/SFCertificateTrustPanel.h>
|
#import <SecurityInterface/SFCertificateTrustPanel.h>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#import "atom/browser/ui/cocoa/atom_bundle_mover.h"
|
#import "atom/browser/ui/cocoa/atom_bundle_mover.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <Security/Security.h>
|
#import <Security/Security.h>
|
||||||
|
@ -389,19 +391,14 @@ bool AtomBundleMover::Trash(NSString* path) {
|
||||||
// This allows us to trash the app in macOS Sierra even when the app is
|
// This allows us to trash the app in macOS Sierra even when the app is
|
||||||
// running inside an app translocation image.
|
// running inside an app translocation image.
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
auto* code = R"str(
|
||||||
|
set theFile to POSIX file "%@"
|
||||||
|
tell application "Finder"
|
||||||
|
move theFile to trash
|
||||||
|
end tell
|
||||||
|
)str";
|
||||||
NSAppleScript* appleScript = [[[NSAppleScript alloc]
|
NSAppleScript* appleScript = [[[NSAppleScript alloc]
|
||||||
initWithSource:
|
initWithSource:[NSString stringWithFormat:@(code), path]] autorelease];
|
||||||
[NSString
|
|
||||||
stringWithFormat:
|
|
||||||
@"\
|
|
||||||
set theFile to POSIX file \"%@\" "
|
|
||||||
@"\n\
|
|
||||||
tell application \"Finder\" "
|
|
||||||
@"\n\
|
|
||||||
move theFile to trash \n\
|
|
||||||
"
|
|
||||||
@" end tell",
|
|
||||||
path]] autorelease];
|
|
||||||
NSDictionary* errorDict = nil;
|
NSDictionary* errorDict = nil;
|
||||||
NSAppleEventDescriptor* scriptResult =
|
NSAppleEventDescriptor* scriptResult =
|
||||||
[appleScript executeAndReturnError:&errorDict];
|
[appleScript executeAndReturnError:&errorDict];
|
||||||
|
@ -425,4 +422,4 @@ bool AtomBundleMover::DeleteOrTrash(NSString* path) {
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -182,8 +182,8 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
||||||
|
|
||||||
// Empties the source menu items to the destination.
|
// Empties the source menu items to the destination.
|
||||||
- (void)moveMenuItems:(NSMenu*)source to:(NSMenu*)destination {
|
- (void)moveMenuItems:(NSMenu*)source to:(NSMenu*)destination {
|
||||||
const long count = [source numberOfItems];
|
const NSInteger count = [source numberOfItems];
|
||||||
for (long index = 0; index < count; index++) {
|
for (NSInteger index = 0; index < count; index++) {
|
||||||
NSMenuItem* removedItem = [[[source itemAtIndex:0] retain] autorelease];
|
NSMenuItem* removedItem = [[[source itemAtIndex:0] retain] autorelease];
|
||||||
[source removeItemAtIndex:0];
|
[source removeItemAtIndex:0];
|
||||||
[destination addItem:removedItem];
|
[destination addItem:removedItem];
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/cocoa/atom_ns_window_delegate.h"
|
#include "atom/browser/ui/cocoa/atom_ns_window_delegate.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "atom/browser/native_window_mac.h"
|
#include "atom/browser/native_window_mac.h"
|
||||||
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#import "atom/browser/ui/cocoa/atom_touch_bar.h"
|
#import "atom/browser/ui/cocoa/atom_touch_bar.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/common/color_util.h"
|
#include "atom/common/color_util.h"
|
||||||
#include "atom/common/native_mate_converters/image_converter.h"
|
#include "atom/common/native_mate_converters/image_converter.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/ui/drag_util.h"
|
#include "atom/browser/ui/drag_util.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/file_dialog.h"
|
#include "atom/browser/ui/file_dialog.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <CoreServices/CoreServices.h>
|
#import <CoreServices/CoreServices.h>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/message_box.h"
|
#include "atom/browser/ui/message_box.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/tray_icon_cocoa.h"
|
#include "atom/browser/ui/tray_icon_cocoa.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/ui/cocoa/NSString+ANSI.h"
|
#include "atom/browser/ui/cocoa/NSString+ANSI.h"
|
||||||
#include "atom/browser/ui/cocoa/atom_menu_controller.h"
|
#include "atom/browser/ui/cocoa/atom_menu_controller.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/common/api/atom_api_native_image.h"
|
#include "atom/common/api/atom_api_native_image.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#import "atom/common/application_info.h"
|
#import "atom/common/application_info.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#import "atom/common/mac/main_application_bundle.h"
|
#import "atom/common/mac/main_application_bundle.h"
|
||||||
#import "base/mac/foundation_util.h"
|
#import "base/mac/foundation_util.h"
|
||||||
#import "base/strings/sys_string_conversions.h"
|
#import "base/strings/sys_string_conversions.h"
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
|
|
||||||
#include "atom/common/crash_reporter/crash_reporter_mac.h"
|
#include "atom/common/crash_reporter/crash_reporter_mac.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/mac/bundle_locations.h"
|
#include "base/mac/bundle_locations.h"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "atom/common/platform_util.h"
|
#include "atom/common/platform_util.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#import <Carbon/Carbon.h>
|
#import <Carbon/Carbon.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <ServiceManagement/ServiceManagement.h>
|
#import <ServiceManagement/ServiceManagement.h>
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
"lint:js": "node ./script/lint.js --js",
|
"lint:js": "node ./script/lint.js --js",
|
||||||
"lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
|
"lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
|
||||||
"lint:cpp": "node ./script/lint.js --cc",
|
"lint:cpp": "node ./script/lint.js --cc",
|
||||||
|
"lint:objc": "node ./script/lint.js --objc",
|
||||||
"lint:py": "node ./script/lint.js --py",
|
"lint:py": "node ./script/lint.js --py",
|
||||||
"lint:gn": "node ./script/lint.js --gn",
|
"lint:gn": "node ./script/lint.js --gn",
|
||||||
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links && npm run lint:check-trailing-whitespace",
|
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links && npm run lint:check-trailing-whitespace",
|
||||||
|
|
|
@ -41,6 +41,21 @@ function spawnAndCheckExitCode (cmd, args, opts) {
|
||||||
if (status) process.exit(status)
|
if (status) process.exit(status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cpplint (args) {
|
||||||
|
const result = childProcess.spawnSync('cpplint.py', args, { encoding: 'utf8' })
|
||||||
|
// cpplint.py writes EVERYTHING to stderr, including status messages
|
||||||
|
if (result.stderr) {
|
||||||
|
for (const line of result.stderr.split(/[\r\n]+/)) {
|
||||||
|
if (line.length && !line.startsWith('Done processing ') && line !== 'Total errors found: 0') {
|
||||||
|
console.warn(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result.status) {
|
||||||
|
process.exit(result.status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const LINTERS = [ {
|
const LINTERS = [ {
|
||||||
key: 'c++',
|
key: 'c++',
|
||||||
roots: ['atom', 'native_mate'],
|
roots: ['atom', 'native_mate'],
|
||||||
|
@ -51,18 +66,25 @@ const LINTERS = [ {
|
||||||
} else {
|
} else {
|
||||||
spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames])
|
spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames])
|
||||||
}
|
}
|
||||||
const result = childProcess.spawnSync('cpplint.py', filenames, { encoding: 'utf8' })
|
cpplint(filenames)
|
||||||
// cpplint.py writes EVERYTHING to stderr, including status messages
|
}
|
||||||
if (result.stderr) {
|
}, {
|
||||||
for (const line of result.stderr.split(/[\r\n]+/)) {
|
key: 'objc',
|
||||||
if (line.length && !line.startsWith('Done processing ') && line !== 'Total errors found: 0') {
|
roots: ['atom'],
|
||||||
console.warn(line)
|
test: filename => filename.endsWith('.mm'),
|
||||||
}
|
run: (opts, filenames) => {
|
||||||
}
|
if (opts.fix) {
|
||||||
}
|
spawnAndCheckExitCode('python', ['script/run-clang-format.py', '--fix', ...filenames])
|
||||||
if (result.status) {
|
} else {
|
||||||
process.exit(result.status)
|
spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames])
|
||||||
}
|
}
|
||||||
|
const filter = [
|
||||||
|
'-readability/casting',
|
||||||
|
'-whitespace/braces',
|
||||||
|
'-whitespace/indent',
|
||||||
|
'-whitespace/parens'
|
||||||
|
]
|
||||||
|
cpplint(['--extensions=mm', `--filter=${filter.join(',')}`, ...filenames])
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'python',
|
key: 'python',
|
||||||
|
@ -119,7 +141,7 @@ const LINTERS = [ {
|
||||||
function parseCommandLine () {
|
function parseCommandLine () {
|
||||||
let help
|
let help
|
||||||
const opts = minimist(process.argv.slice(2), {
|
const opts = minimist(process.argv.slice(2), {
|
||||||
boolean: [ 'c++', 'javascript', 'python', 'gn', 'help', 'changed', 'fix', 'verbose', 'only' ],
|
boolean: [ 'c++', 'objc', 'javascript', 'python', 'gn', 'help', 'changed', 'fix', 'verbose', 'only' ],
|
||||||
alias: { 'c++': ['cc', 'cpp', 'cxx'], javascript: ['js', 'es'], python: 'py', changed: 'c', help: 'h', verbose: 'v' },
|
alias: { 'c++': ['cc', 'cpp', 'cxx'], javascript: ['js', 'es'], python: 'py', changed: 'c', help: 'h', verbose: 'v' },
|
||||||
unknown: arg => { help = true }
|
unknown: arg => { help = true }
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue