jamf / PPPC-Utility

Privacy Preferences Policy Control (PPPC) Utility
MIT License
748 stars 54 forks source link

Add SwiftLint and custom rules #55

Closed watkyn closed 4 years ago

watkyn commented 4 years ago

Add swiftlint as a script phase to the project to integrate warnings with Xcode and standardize on some code styles and conventions:

https://github.com/realm/SwiftLint

Here are some rules to add to a .swiftlint file for the project:

opt_in_rules:
  - empty_count
  - operator_usage_whitespace
  - trailing_closure
  - yoda_condition

disabled_rules:
  - line_length
  - trailing_whitespace

# Overriding existing rules

file_length:
  ignore_comment_only_lines: true

type_body_length:
  - 200 # warning
  - 400 # error

Here is an example script to add to the Xcode build phase

if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

Once added, all warnings should then be resolved as part of this ticket.