stripe-ios/stripe3ds2-support/CONTRIBUTING.md

1.8 KiB

Organization

Stripe3DS2/

This directory contains the actual SDK project and files. Stripe3DS2.xcodeproj is the entry point here.

The Public folder/group should only contain classes and files that are intended to be exposed publically in the SDK. Everything else should go under either Internal or a separate folder/group.

doc/

This directory is automatically generated by appledoc.

Style Guidelines

Required

  • Do not use #define to define a block of code -- #define code is very difficult to debug
  • Each return statement should be on a separate line for ease of debugging. i.e. do NOT write if (condition) return YES;
  • Always use brackets, even for a single line if-statement. Avoid goto fail!
  • If a method takes more than three arguments, each argument should be on a separate line.
  • switch statements for enums should contain an entry for each value and avoid using default
  • Internal/private methods and ivars should being with an _, e.g. - (void)_doPrivateStuff and _internalVariable. This is not required for private properties which should not include an underscore (this is to distinguish them from their underlying variable which automatically has an _ prefix).

Suggested

  • Prefer static const to #define
  • Use NS_ASSUME_NONNULL_BEGIN/END in both the interface (.h) and implementation (.m) files. It is not techincally necessary for the implementation file, but including it allows the compiler to sanity check nullability assumptions.
  • Opening braces should be on the same line as method signatures and control statements, e.g. if (condition) { and - (void)doStuff {
  • else and else if statements should be on the same line as the closing brace for the preceding statement, i.e. } else if (otherCondition) {