New: Integration of capp_lint in xCodeCapp

Now capp_lint is fully integrated in xCodeCapp.
You can check the entire project with the menuitem of the app.
There is an option in the preference to make a capp_lint (on the file who was just processed) each time a file is processed by xCodeCapp.
Error of capp_lint are reported in the error tableView. The messages displayed the following informations : path of the file, line and error.
This commit is contained in:
Alexandre Wilhelm committed 2014-04-17 18:26:25 -07:00
1 parent b5f9501001
commit 973940fcb2
6 files changed
+567 -2579

No files matched your search

+2 -1
View File
@@ -151,7 +151,8 @@ AppController *SharedAppControllerInstance = nil;
kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN],
kDefaultAutoOpenXcodeProject: @YES,
kDefaultShowProcessingNotices: @YES,
kDefaultUseSymlinkWhenCreatingProject: @YES
kDefaultUseSymlinkWhenCreatingProject: @YES,
KDefaultUsesCappLintForEveryNotifications: @NO
};
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+1
View File
@@ -27,5 +27,6 @@ extern NSString * const kDefaultLogLevel;
extern NSString * const kDefaultAutoOpenXcodeProject;
extern NSString * const kDefaultShowProcessingNotices;
extern NSString * const kDefaultUseSymlinkWhenCreatingProject;
extern NSString * const KDefaultUsesCappLintForEveryNotifications;
#endif
+1
View File
@@ -25,3 +25,4 @@ NSString * const kDefaultLogLevel = @"logLevel";
NSString * const kDefaultAutoOpenXcodeProject = @"autoOpenXcodeProject";
NSString * const kDefaultShowProcessingNotices = @"showProcessingNotices";
NSString * const kDefaultUseSymlinkWhenCreatingProject = @"useSymlinkWhenCreatingProject";
NSString * const KDefaultUsesCappLintForEveryNotifications = @"usesCappLintForEveryNotifications";
+1
View File
@@ -119,6 +119,7 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
- (IBAction)openErrorInEditor:(id)sender;
- (IBAction)openXcodeProject:(id)aSender;
- (IBAction)synchronizeProject:(id)aSender;
- (IBAction)checkProjectWithCappLint:(id)aSender;
- (BOOL)executablesAreAccessible;
- (void)stop;
+66 -2
View File
@@ -241,7 +241,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
// Make sure we are using jsc as the narwhal engine!
self.environment[@"NARWHAL_ENGINE"] = @"jsc";
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp"];
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp", @"capp_lint"];
// This is used to get the env var of $CAPP_BUILD
NSDictionary *processEnvironment = [[NSProcessInfo processInfo] environment];
@@ -729,7 +729,12 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
self.pbxOperations[@"add"] = addPaths;
}
}
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults boolForKey:KDefaultUsesCappLintForEveryNotifications])
[self checkCappLintForPath:path];
DDLogVerbose(@"%@ %@", NSStringFromSelector(_cmd), path);
}
@@ -1723,6 +1728,65 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
return YES;
}
- (IBAction)checkProjectWithCappLint:(id)aSender
{
[self checkCappLintForPath:self.projectPath];
}
- (void)checkCappLintForPath:(NSString*)aPath
{
DDLogVerbose(@"Checking path %@ with capp_lint", aPath);
NSArray *arguments = [NSArray arrayWithObject:aPath];
NSDictionary *taskResult = [self runTaskWithLaunchPath:self.executablePaths[@"capp_lint"]
arguments:arguments
returnType:kTaskReturnTypeStdOut];
NSInteger status = [taskResult[@"status"] intValue];
NSString *response = taskResult[@"response"];
if (status == 0)
return;
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
[errors removeLastObject];
[errors removeObjectAtIndex:0];
NSInteger i = 0;
NSInteger numberOfErrors = [errors count];
for (i = 0; i < numberOfErrors; i++)
{
NSMutableString *error = (NSMutableString*)[errors objectAtIndex:i];
NSString *firstCaract = [NSString stringWithFormat:@"%c" ,[error characterAtIndex:0]];
NSString *path;
NSString *line;
if ([[NSScanner scannerWithString:firstCaract] scanInt:nil])
error = (NSMutableString*)[NSString stringWithFormat:@"%@:%@",aPath,error];
NSInteger positionOfFirstColon = [error rangeOfString:@":"].location;
path = [error substringToIndex:positionOfFirstColon];
NSString *errorWithoutPath = [error substringFromIndex:(positionOfFirstColon + 1)];
NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location;
line = [errorWithoutPath substringToIndex:positionOfSecondColon];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:[line intValue]], @"line",
[NSString stringWithFormat:@"capp_lint error in %@ \n%@", path, errorWithoutPath], @"message",
path, @"path",
nil];
[self.errorListController addObject:dict];
}
[self showErrors];
}
@end
File diff suppressed because it is too large. Load diff