calabash/calabash-ios-server — pull request #33 by jmoody (2014-02-17 10:27:49+00:00)
Title: applies a uniform formatting across source files, removes tab characters, whitespaces, and removed unused imports

## action items

@krukow
@jmoody

- [x] review changes with Karl
- [x] decide whether to merge https://github.com/calabash/calabash-ios-server/pull/30 first

* merge after 0.9.167
* merge before [branch repositioning - google forums] (https://groups.google.com/d/msg/calabash-ios/jX61SeuXlQk/A8OQp4ER75cJ)

## motivation

I had to deal with a pull request recently on a file with some truly bizarre formatting that made the diff very difficult to understand.

Looking at the project as a whole, I identified these issues:

* Xcode project says indent 4 spaces, but some files have tab characters (\t) and different indent settings
* there was whitespace everywhere (newlines and trailing spaces)
* there was no formatting convention follow - every file adopted its own convention or multiple conventions

## strategy

This pull request has _no_ semantic changes. All the changes are to the formatting.

Because they were 3rd party or submodules, I did not touch these directories:

* Classes/CocoaAsyncSocket
* Classes/CocoaHttpServer
* Classes/JSON
* LPCDDataScanner.*
* calabash-js/

###### important

- [ ] LPQueryAllOperation.m contains tab characters and inconsistent formatting
- I did not touch this file in case you want to merge pull request https://github.com/calabash/calabash-ios-server/pull/30

## what i did

- [x] tabs ==> spaces
- [x] reformatted all the source files using AppCode
- indent 2 spaces
- wrap to 80 characters
- uniform spacing between method bodies
- `- (void) play:(NSArray *) events` signature style
- 'smart' argument wrapping
- manual formatting
- [x] stripped trailing whitespace in _most_ of the files
- [x] removed unused imports

- [x] Xcode project indent is now 2 (was 4)
- [x] Xcode project Organization is now Xamarin
- [x] Xcode project Class prefix is now LP

## questions

- [x] copyright at the top of source files - **we have to keep these** :(
* LessPainful ==> { Xamarin | remove }
* +1 to remove (hard to maintain, ambiguous meaning, visual clutter, opaque to Xcode refactoring, generally useless)
- [x] Trevor Harmon - LPExitRoute.h/m copyright
- [x] Jim McBeath - LPAppPropertyRoute and LPLogQueryRoute

- [ ] modernize objc.

## bugs

- [ ] LPEnv.m `[super dealloc]` must be called _last_
- [ ] LPJSONUtils call to `respondsToSelector` is made on `result` and not on `object`
- [ ] LPReflectUtils is missing a return in `invokeSpec:onTarget:withError` and the default switch case is not defined
- [ ] LPUIAChannel [super dealloc] should be called _last_

## analysis

- [ ] should suppress unused variable warnings in LPSetTextOperation with __unused
- [ ] similar problem in calabash-js/CalabashJS/LPWebQuery.h
- [ ] why are these not extern'd or in the .m file?
- [ ] should i just fix this?
- [ ] fix or suppress unused variable warnings in calabash-js/CalabashJS/LPWebQuery.h
- [ ] should suppress undeclared selector warning is GCDAsyncSocket and LPHTTPServer with clang diagnostics push/pop
- [ ] LPSetTextOperation.h the static variable should externed or moved to the .m
- [ ] LPDebugRoute. result dictionary is never used
- [ ] LPGenericAsync suspicious conversion of UInt64 to -1
- [ ] LPKeyboardRoute missing dealloc method and `_events` ivar is not released
- [ ] LPLocationRoute missing import of UIAutomation.h
- [ ] LPQueryLogRoute has 2 suspicious unbalanced retains
- [ ] LPScreenshotRoute2 remove or change the name?
- [ ] MKMapView+ZoomLevel.m suspicious conversion of double to NSUInteger
- [ ] LPRecorder dealloc does not playbackDelegate but it retains it
- this is a singleton and dealloc is never called, but...

## recommendations

- [ ] drop iOS 4 support and bump min version to 5.1.1 to compile for x86_64
- [ ] turn on verbose warnings
- [ ] update 3rd Party Sources by building them as .a?

## tests

Since there are no semantic changes, I did not run an exhaustive test suite.

- [x] iPad 4 iOS 7.0.4 - 142 scenarios (5 pending, 137 passed) **woot!**

### XTC

```
Apple iPad 2 (6.1.3)
Apple iPad 4th Gen (7.0.4)
Apple iPad Mini Retina (7.0.4)
Apple iPhone 4S (6.1.3)
Apple iPhone 4S (7.0.4)
Apple iPhone 5C (7.0.4)
Apple iPhone 5 (7.0.4)
```