You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prefer checking isEmpty over comparing count to zero. (empty_count)
for the below code.
guard let count = notify.object as?Intelse{fatalError()}
if count ==0{}
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Environment
# SwiftLint Rules Configuration# https://github.com/realm/SwiftLint## By default, SwiftLint uses a set of sensible default rules you can adjust:disabled_rules: # rule identifiers turned on by default to exclude from running# - colon# - comma# - control_statement
- trailing_whitespace
- unused_optional_binding
- multiple_closures_with_trailing_closure
- unused_capture_listopt_in_rules: # some rules are turned off by default, so you need to opt-in
- empty_count # Find all the available rules by running: `swiftlint rules`line_length: 200function_body_length: 60#type_body_length:# - 300 # warning# - 400 # error## or they can set both explicitly#file_length:# warning: 500# error: 1200nesting:
type_level: 3identifier_name:
# min_length: # only min_length# error: 4 # only errorexcluded: # excluded via string array
- id
- URL
- GlobalAPIKey
- kmcyclomatic_complexity:
ignores_case_statements: truetype_name:
min_length: 3# only warningmax_length: # warning and errorwarning: 50error: 60
The text was updated successfully, but these errors were encountered:
@davidpasztor is exactly right. There's only so much information SwiftLint has at the pre-typechecked stage. Consider writing an analyzer rule similar to #3914 if you'd like a more accurate, typechecked version of the empty_count rule.
New Issue Checklist
Describe the bug
I'm getting Empty Count Violation:
for the below code.
Complete output when running SwiftLint, including the stack trace and command used
Environment
The text was updated successfully, but these errors were encountered: