New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positives for explicit_acl #2014

Closed
jdmarshall90 opened this Issue Jan 22, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@jdmarshall90
Copy link

jdmarshall90 commented Jan 22, 2018

tl;dr: explicitly marked internal protocols are having their contents flagged as failing the explicit_acl rule, as is a deinit.

New Issue Checklist

Bug Report

Complete output when running SwiftLint, including the stack trace and command used
# running as a build phase
# note that I am using zshell
swiftlint lint --config "Carthage/Checkouts/MySwiftLintConfigRepoNameHere/.swiftlint.yml" 

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    • 0.24.2
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    • Download release .pkg from GitHub
  • Paste your configuration file:
opt_in_rules:
  - array_init
  - attributes
  - class_delegate_protocol
  - closure_end_indentation
  - closure_spacing
  - compiler_protocol_init
  - contains_over_first_not_nil
  - empty_count
  - empty_parentheses_with_trailing_closure
  - explicit_acl
  - explicit_init
  - explicit_top_level_acl
  - fatal_error_message
  - first_where
  - force_unwrapping
  - generic_type_name
  - implicit_return
  - implicitly_unwrapped_optional
  - joined_default_parameter
  - large_tuple
  - let_var_whitespace
  - literal_expression_end_indentation
  - multiline_arguments
  - multiline_parameters
  - number_separator
  - no_grouping_extension
  - object_literal
  - operator_usage_whitespace
  - overridden_super_call
  - override_in_extension
  - private_action
  - prohibited_super_call
  - redundant_nil_coalescing
  - redundant_optional_initialization
  - redundant_void_return
  - shorthand_operator
  - single_test_class
  - sorted_first_last
  - sorted_imports
  - switch_case_on_newline
  - trailing_closure
  - unneeded_parentheses_in_closure_argument
  - valid_ibinspectable
  - vertical_parameter_alignment
  - vertical_parameter_alignment_on_call
  - vertical_whitespace
  - yoda_condition
disabled_rules:
  - nesting
  - notification_center_detachment
  - trailing_whitespace
  - line_length
  - operator_whitespace
file_length:
  ignore_comment_only_lines: true
  warning: 300
  error: 500
cyclomatic_complexity:
  ignores_case_statements: true
excluded:
  - Carthage/Checkouts
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit)
disabled_rules:
  - explicit_acl
  - explicit_top_level_acl
  - file_length
  - type_body_length
  • Which Xcode version are you using (check xcode-select -p)?
    • 9.2 (9C40b)
  • Do you have a sample that shows the issue?
// 26 warnings for this rule, all very similar to the following:
// (yet not *all* instances like this are flagged, only some)

internal class MyRedactedClass: NSObject, ProtocolOne, ProtocolTwo {
    // code above, each item explicitly marked as internal
    
    // This triggers a violation even though you can't mark deinits with an ACL:
    deinit {
        NotificationCenter.default.removeObserver(self)
    }

    // code below each item explicitly marked as internal
}

internal protocol MyProtocol {
    // some properties get flagged as well
    var someValue: String { get set }

    // so does this even though you can't mark protocol contents with an ACL:
    func allTheThings() -> [MyType]
}

Also note that some of these false positives sometimes go away, but come right back on the next build. I have tried the --no-cache flag, but to no avail.

@jdmarshall90

This comment has been minimized.

Copy link
Author

jdmarshall90 commented Jan 26, 2018

Thank you!

@jdmarshall90

This comment has been minimized.

Copy link
Author

jdmarshall90 commented Jan 26, 2018

Any ETA on an official release containing this fix?

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