Fixed: check the entire project with capp_lint doesn't open the reporting window or a notification

This commit is contained in:
Alexandre Wilhelm
2014-04-21 17:44:13 -07:00
parent 30c48df1f0
commit e8fef8104d
2 changed files with 16 additions and 1 deletions
+2 -1
View File
@@ -45,7 +45,8 @@ enum {
extern NSString * const XCCConversionDidStartNotification;
extern NSString * const XCCConversionDidEndNotification;
extern NSString * const XCCProjectDidFinishLoadingNotification;
extern NSString * const XCCCappLintDidStartNotification;
extern NSString * const XCCCappLintDidEndNotification;
@interface XcodeCapp : NSObject <NSTableViewDelegate, NSUserNotificationCenterDelegate, GrowlApplicationBridgeDelegate>
+14
View File
@@ -74,6 +74,8 @@ static NSPredicate * XCCDirectoriesToIgnorePredicate = nil;
// An array of the default predicates used to ignore paths.
static NSArray *XCCDefaultIgnoredPathPredicates = nil;
NSString * const XCCCappLintDidStartNotification = @"XCCCappLintDidStartNotification";
NSString * const XCCCappLintDidEndNotification = @"XCCCappLintDidEndNotification";
@interface XcodeCapp ()
@@ -1719,15 +1721,26 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
- (IBAction)checkProjectWithCappLint:(id)aSender
{
[self clearErrors:self];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(cappLintDidEndNotification:) name:XCCCappLintDidEndNotification object:nil];
[self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.projectPath];
}
- (void)cappLintDidEndNotification:(NSNotification*)aNotification
{
[self showCappLintErrors];
[[NSNotificationCenter defaultCenter] removeObserver:self name:XCCCappLintDidEndNotification object:nil];
}
- (BOOL)checkCappLintForPath:(NSString*)aPath
{
DDLogVerbose(@"Checking path %@ with capp_lint", aPath);
self.isProcessing = YES;
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidStartNotification object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidStartNotification object:self];
NSString *baseDirectory = [NSString stringWithFormat:@"--basedir='%@'", self.projectPath];
NSArray *arguments = [NSArray arrayWithObjects:baseDirectory, aPath, nil];
@@ -1781,6 +1794,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
self.isProcessing = NO;
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self];
return NO;
}