Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
disabled_rules: # rule identifiers to exclude from running
- colon
- control_statement
- identifier_name
- unused_optional_binding
- notification_center_detachment
- opening_brace
opt_in_rules: # some rules are only opt-in
- empty_count
- closure_spacing
- fatal_error_message
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- Sources
- Example/LocalizeExample/Sources
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 195
# they can set both implicitly with an array
type_body_length:
- 350 # warning
- 450 # error
function_body_length:
- 60 # warning
- 120 # error
# or they can set both explicitly
file_length:
warning: 800
error: 1400
cyclomatic_complexity:
- 16
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
identifier_name:
min_length: # only min_length
error: 4 # only error
excluded: # excluded via string array
- id
- URL
- url
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
7 changes: 7 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
swiftformat.additional_args = "Example/LocalizeExample/Sources Sources --cache ignore --indent 4 --self insert \
--wrapcollections beforefirst --wraparguments beforefirst \
--comments ignore --commas inline \
--disable blankLinesAroundMark,hoistPatternLet,redundantParens,redundantVoidReturnType,trailingClosures,andOperator" # optional
swiftformat.check_format(fail_on_error: true)

swiftlint.lint_files
4 changes: 1 addition & 3 deletions Example/LocalizeExample/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return true
}
}

10 changes: 4 additions & 6 deletions Example/LocalizeExample/Sources/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Here simulates their usage in code
let _ = NSLocalizedString("UntranslatedKey", comment: "")
let _ = NSLocalizedString("IgnoredUntranslatedKey", comment: "")
let _ = NSLocalizedString("MissingKey", comment: "")
_ = NSLocalizedString("UntranslatedKey", comment: "")
_ = NSLocalizedString("IgnoredUntranslatedKey", comment: "")
_ = NSLocalizedString("MissingKey", comment: "")
}
}

Loading