Closed cprime closed 9 years ago
We have line character limits on OnShape. From what I've seen. Pros:
Cons: You have to make so many more spacing rules.
We certainly can remove this requirement. The community seems pretty split on this one.
When a block appears as a method parameter and the function call requires multiple lines, favor colon aligning the parameters and bringing the block's opening brace onto its own line:
[[RMHTTPClient sharedHTTPClient] discardJob:job
completion:^(NSError *errorOrNil)
{
if (errorOrNil) {
if (completion) {
completion(errorOrNil);
}
} else {
[self deleteJobs:@[job]];
if (completion) {
completion(nil);
}
}
}];
When a method's signature requires multiple lines but impossible to do so, favor bringing the problem parameters as far over as you can.
- (void)tableView:(UITableView *)tableView
didEndDisplayingHeaderView:(UIView *)view
forSection:(NSInteger)section {
// CODE
}
When declaring a variable, favor aligning colons followed by breaking at equals:
MYCollectionViewLayout *myCollectionViewLayout = [[MYCollectionViewLayout alloc] initWithShortBit:shortBit
otherBit:otherBit];
MYCollectionViewLayout *myCollectionViewLayout =
[[MYCollectionViewLayout alloc] initWithSomeReallyLongPropertyName:longPropertyGoesHere];
(Note: this dialog box seems to mess up my spacing from Xcode)
I do not agree with “Line Character Limits”. If this is the convention I will follow it, but I think it adds unnecessary work for a developer, particularly when dealing with long strings. Could you at least add an explanation of why this is important?