chore: add clang-format and limited linting for Objective-C sources (#18104)

This commit is contained in:
Milan Burda 2019-05-02 14:05:37 +02:00 committed by Cheng Zhao
parent 8785e9007c
commit 9585818a90
35 changed files with 142 additions and 36 deletions

View file

@ -33,6 +33,6 @@ void App::SetAppLogsPath(mate::Arguments* args) {
}
}
} // namespace atom
} // namespace api
} // namespace atom

View file

@ -4,6 +4,8 @@
#include "atom/browser/api/atom_api_app.h"
#include <string>
#import <Cocoa/Cocoa.h>
#include "base/strings/sys_string_conversions.h"
@ -59,6 +61,6 @@ base::RepeatingCallback<void()> App::StartAccessingSecurityScopedResource(
bookmarkUrl);
}
} // namespace atom
} // namespace api
} // namespace atom

View file

@ -4,6 +4,9 @@
#include "atom/browser/api/atom_api_browser_window.h"
#include <memory>
#include <vector>
#import <Cocoa/Cocoa.h>
#include "atom/browser/native_browser_view.h"

View file

@ -4,6 +4,9 @@
#import "atom/browser/api/atom_api_menu_mac.h"
#include <string>
#include <utility>
#include "atom/browser/native_window.h"
#include "atom/browser/unresponsive_suppressor.h"
#include "atom/common/node_includes.h"

View file

@ -4,7 +4,9 @@
#include "atom/browser/api/atom_api_power_monitor.h"
#include <ApplicationServices/ApplicationServices.h>
#include <vector>
#import <ApplicationServices/ApplicationServices.h>
#import <Cocoa/Cocoa.h>
@interface MacLockMonitor : NSObject {

View file

@ -5,6 +5,9 @@
#include "atom/browser/api/atom_api_system_preferences.h"
#include <map>
#include <memory>
#include <string>
#include <utility>
#import <AVFoundation/AVFoundation.h>
#import <Cocoa/Cocoa.h>

View file

@ -4,6 +4,8 @@
#include "atom/browser/auto_updater.h"
#include <string>
#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
#import <ReactiveCocoa/RACCommand.h>
#import <ReactiveCocoa/RACSignal.h>
@ -29,7 +31,7 @@ SQRLUpdater* g_updater = nil;
namespace {
bool g_update_available = false;
std::string update_url_ = "";
std::string update_url_ = ""; // NOLINT(runtime/string)
} // namespace

View file

@ -4,6 +4,9 @@
#include "atom/browser/browser.h"
#include <string>
#include <utility>
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/atom_application_delegate.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.";
}
#else
if (settings.open_at_login)
if (settings.open_at_login) {
base::mac::AddToLoginItems(settings.open_as_hidden);
else {
} else {
RemoveFromLoginItems();
}
#endif

View file

@ -4,6 +4,10 @@
#import "atom/browser/mac/atom_application.h"
#include <memory>
#include <string>
#include <utility>
#include "atom/browser/browser.h"
#import "atom/browser/mac/atom_application_delegate.h"
#include "atom/browser/mac/dict_util.h"

View file

@ -4,6 +4,9 @@
#import "atom/browser/mac/atom_application_delegate.h"
#include <memory>
#include <string>
#include "atom/browser/browser.h"
#import "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/dict_util.h"
@ -24,7 +27,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
@end
@implementation OOMDisabledIMKInputSession
- (void)_coreAttributesFromRange:(NSRange)range
whichAttributes:(long long)attributes
whichAttributes:(long long)attributes // NOLINT(runtime/int)
completionHandler:(void (^)(void))block {
// The allocator flag is per-process, so other threads may temporarily
// not have fatal OOM occur while this method executes, but it is better

View file

@ -4,6 +4,10 @@
#include "atom/browser/mac/dict_util.h"
#include <memory>
#include <string>
#include <utility>
#include "base/json/json_writer.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"

View file

@ -4,6 +4,9 @@
#include "atom/browser/mac/in_app_purchase.h"
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/post_task.h"

View file

@ -4,6 +4,8 @@
#include "atom/browser/mac/in_app_purchase_observer.h"
#include <vector>
#include "base/bind.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/post_task.h"

View file

@ -4,6 +4,10 @@
#include "atom/browser/mac/in_app_purchase_product.h"
#include <string>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/post_task.h"

View file

@ -4,6 +4,8 @@
#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_view.h"
#include "skia/ext/skia_utils_mac.h"

View file

@ -8,6 +8,7 @@
#include <objc/objc-runtime.h>
#include <string>
#include <vector>
#include "atom/browser/native_browser_view_mac.h"
#include "atom/browser/ui/cocoa/atom_native_widget_mac.h"

View file

@ -4,6 +4,9 @@
#include "atom/browser/notifications/mac/cocoa_notification.h"
#include <string>
#include <utility>
#include "atom/browser/notifications/notification_delegate.h"
#include "atom/browser/notifications/notification_presenter.h"
#include "base/mac/mac_util.h"

View file

@ -4,6 +4,8 @@
#include "atom/browser/notifications/mac/notification_center_delegate.h"
#include <string>
#include "atom/browser/notifications/mac/cocoa_notification.h"
#include "atom/browser/notifications/mac/notification_presenter_mac.h"

View file

@ -4,6 +4,10 @@
#include "atom/browser/ui/certificate_trust.h"
#include <memory>
#include <string>
#include <utility>
#import <Cocoa/Cocoa.h>
#import <SecurityInterface/SFCertificateTrustPanel.h>

View file

@ -4,6 +4,8 @@
#import "atom/browser/ui/cocoa/atom_bundle_mover.h"
#include <string>
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.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
// running inside an app translocation image.
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]
initWithSource:
[NSString
stringWithFormat:
@"\
set theFile to POSIX file \"%@\" "
@"\n\
tell application \"Finder\" "
@"\n\
move theFile to trash \n\
"
@" end tell",
path]] autorelease];
initWithSource:[NSString stringWithFormat:@(code), path]] autorelease];
NSDictionary* errorDict = nil;
NSAppleEventDescriptor* scriptResult =
[appleScript executeAndReturnError:&errorDict];
@ -425,4 +422,4 @@ bool AtomBundleMover::DeleteOrTrash(NSString* path) {
} // namespace ui
} // namespace atom
} // namespace atom

View file

@ -182,8 +182,8 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Empties the source menu items to the destination.
- (void)moveMenuItems:(NSMenu*)source to:(NSMenu*)destination {
const long count = [source numberOfItems];
for (long index = 0; index < count; index++) {
const NSInteger count = [source numberOfItems];
for (NSInteger index = 0; index < count; index++) {
NSMenuItem* removedItem = [[[source itemAtIndex:0] retain] autorelease];
[source removeItemAtIndex:0];
[destination addItem:removedItem];

View file

@ -4,6 +4,8 @@
#include "atom/browser/ui/cocoa/atom_ns_window_delegate.h"
#include <algorithm>
#include "atom/browser/browser.h"
#include "atom/browser/native_window_mac.h"
#include "atom/browser/ui/cocoa/atom_preview_item.h"

View file

@ -4,6 +4,9 @@
#import "atom/browser/ui/cocoa/atom_touch_bar.h"
#include <string>
#include <vector>
#include "atom/common/color_util.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "base/strings/sys_string_conversions.h"

View file

@ -4,6 +4,8 @@
#import <Cocoa/Cocoa.h>
#include <vector>
#include "atom/browser/ui/drag_util.h"
#include "base/files/file_path.h"
#include "base/strings/sys_string_conversions.h"

View file

@ -4,6 +4,10 @@
#include "atom/browser/ui/file_dialog.h"
#include <string>
#include <utility>
#include <vector>
#import <Cocoa/Cocoa.h>
#import <CoreServices/CoreServices.h>

View file

@ -4,6 +4,10 @@
#include "atom/browser/ui/message_box.h"
#include <string>
#include <utility>
#include <vector>
#import <Cocoa/Cocoa.h>
#include "atom/browser/native_window.h"

View file

@ -4,6 +4,9 @@
#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/atom_menu_controller.h"
#include "base/strings/sys_string_conversions.h"