Skip to content

Instantly share code, notes, and snippets.

@tylermilner
Last active July 6, 2019 17:11
Show Gist options
  • Save tylermilner/146b8d3627505a967ee3a434b4e7919b to your computer and use it in GitHub Desktop.
Save tylermilner/146b8d3627505a967ee3a434b4e7919b to your computer and use it in GitHub Desktop.
SwiftLint config for tests, DEPRECATED. Use https://gist.github.com/tylermilner/f33e33e3b4f23d8c6b2fdd4f87af98a1
#
#### DEPRECATED ####
# Use the standard .swiftlint.yml for all files in your project, including tests.
# https://gist.github.com/tylermilner/f33e33e3b4f23d8c6b2fdd4f87af98a1
#
# Set max line length before warning (default is 120)
line_length: 240
disabled_rules:
- type_name
- trailing_whitespace
- force_try
- force_cast
- todo
custom_rules:
# Warns for usage of improper year format (e.g. MM/dd/YYYY instead of MM/dd/yyyy)
YYYY_considered_harmful: # rule identifier
name: "YYYY considered harmful" # rule name. optional.
regex: "(YYYY)" # matching pattern
message: "YYYY means week-year; you probably want yyyy" # violation message. optional.
severity: error # violation severity. optional.
@tylermilner
Copy link
Author

tylermilner commented Oct 8, 2018

This configuration isn't something I make use of anymore. I now try to hold my test code to the same standard as my main app code. This configuration file disabled things like force unwrapping and force casting in all of my test code. I still make use of these techniques from time-to-time, but disable the rules on a case-by-case basis using the // swiftlint:disable <rule_name> in-line comment syntax.

The most complete version of my .swiftlint.yml configuration file is hosted in this gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment