mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-28 22:47:04 +00:00
New: Added option in xCodeCapp for displaying error in notification
Previously it wasn't possible to configure xCodeCapp to show or not errors/warnings and capp_lint with notifications
This commit is contained in:
@@ -1641,6 +1641,16 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
[self runTaskWithLaunchPath:executablePath arguments:args returnType:kTaskReturnTypeNone];
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowWarningNotification
|
||||
{
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnWarnings];
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowErrorNotification
|
||||
{
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnErrors];
|
||||
}
|
||||
|
||||
- (void)showErrors
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
@@ -1652,6 +1662,32 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showCappLintErrors
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint] && self.errorList.count)
|
||||
[self openErrorsPanel:self];
|
||||
|
||||
if ([defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint])
|
||||
{
|
||||
NSUInteger numberError = [self.errorList count];
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < numberError; i++)
|
||||
{
|
||||
NSDictionary *error = [self.errorList objectAtIndex:i];
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInteger:self.projectId] , @"projectId",
|
||||
@"Capp_lint error", @"title",
|
||||
[error objectForKey:@"message"] , @"message",
|
||||
nil];
|
||||
|
||||
[self wantUserNotificationWithInfo:dict];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pruneProcessingErrorsForProjectPath:(NSString *)path
|
||||
{
|
||||
// Remove all errors for the path being processed
|
||||
@@ -1749,11 +1785,11 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
returnType:kTaskReturnTypeStdOut];
|
||||
|
||||
NSInteger status = [taskResult[@"status"] intValue];
|
||||
NSString *response = taskResult[@"response"];
|
||||
|
||||
if (status == 0)
|
||||
return;
|
||||
|
||||
NSString *response = taskResult[@"response"];
|
||||
NSMutableArray *errors = [NSMutableArray arrayWithArray:[response componentsSeparatedByString:@"\n\n"]];
|
||||
|
||||
// We need to remove the first object who is the number of errors and the last object who is an empty line
|
||||
@@ -1780,16 +1816,19 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location;
|
||||
line = [errorWithoutPath substringToIndex:positionOfSecondColon];
|
||||
|
||||
NSString *messageError = [NSString stringWithFormat:@"capp_lint error in %@ \n%@", path, errorWithoutPath];
|
||||
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:[line intValue]], @"line",
|
||||
[NSString stringWithFormat:@"capp_lint error in %@ \n%@", path, errorWithoutPath], @"message",
|
||||
messageError , @"message",
|
||||
path, @"path",
|
||||
nil];
|
||||
|
||||
[self.errorListController addObject:dict];
|
||||
}
|
||||
|
||||
[self showErrors];
|
||||
|
||||
[self showCappLintErrors];
|
||||
|
||||
self.isProcessing = NO;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self];
|
||||
|
||||
Reference in New Issue
Block a user