Last active
February 15, 2019 04:18
-
-
Save sumyapp/5e3d38d2f0f547af6b3da50ed08a4f93 to your computer and use it in GitHub Desktop.
Goodcheck sample for Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules: | |
- id: deprecated | |
pattern: | |
token: "@available(" | |
case_sensitive: false | |
message: The method is deprecated. Could you use new version? | |
glob: | |
- "**/*.h" | |
- "**/*.m" | |
- "**/*.swift" | |
fail: | |
- "@available(*, unavailable, deprecated: 3.0)" | |
pass: | |
- "[self.services removeObject:service];" | |
- "@availability(iOS, introduced=7.0)" | |
- id: do_not_use_sleep | |
pattern: | |
token: "sleep(" | |
case_sensitive: false | |
message: | |
Do not use sleep(). Please use another function. For example, dispatch_after. | |
See also these resources about this suggest. | |
* https://stackoverflow.com/questions/27517632/how-to-create-a-delay-in-swift/27517642 | |
glob: | |
- "**/*.h" | |
- "**/*.m" | |
- "**/*.swift" | |
fail: | |
- "Thread.sleep(forTimeInterval: 3.0)" | |
- "sleep(4)" | |
pass: | |
- "dispatch_after(time, dispatch_get_main_queue())" | |
- id: com.sample.GitHub | |
pattern: | |
literal: Github | |
case_sensitive: true | |
message: Write GitHub, not Github | |
glob: | |
- "**/*.h" | |
- "**/*.m" | |
- "**/*.swift" | |
fail: | |
- "Github" | |
pass: | |
- "GitHub" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment