Skip to content
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

unused_import not taking into account @_exported declarations. #2877

Closed
2 tasks done
rz-robsn opened this issue Sep 24, 2019 · 1 comment
Closed
2 tasks done

unused_import not taking into account @_exported declarations. #2877

rz-robsn opened this issue Sep 24, 2019 · 1 comment

Comments

@rz-robsn
Copy link

rz-robsn commented Sep 24, 2019

New Issue Checklist

Describe the bug

Running the analyzer with the unused_import rule enabled sometimes wrongfully deletes an import if the imported Module contains a @_exported declaration.

Consider the following example :

/// Module A
@_exported import B

/// Module B
public class MyBClass {}

/// Module C
import A

let bClass = MyBClass()

Running the analyzer would currently remove the import A declaration from Module C, leading to a compile error.

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.35.0

  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Downloaded binary from the github release page

  • Paste your configuration file:

whitelist_rules:
  - closure_spacing
  - colon
  - empty_enum_arguments
  - fatal_error_message
  - force_cast
  - force_try
  - force_unwrapping
  - implicitly_unwrapped_optional
  - legacy_cggeometry_functions
  - legacy_constant
  - legacy_constructor
  - legacy_nsgeometry_functions
  - operator_usage_whitespace
  - redundant_string_enum_value
  - redundant_void_return
  - return_arrow_whitespace
  - trailing_newline
  - type_name
  - unused_closure_parameter
  - unused_optional_binding
  - vertical_whitespace
  - void_return
  - custom_rules

analyzer_rules:
  - unused_import

excluded:
  - Carthage
  - Pods

colon:
  apply_to_dictionaries: false

indentation: 2

custom_rules:
  no_objcMembers:
    name: "@objcMembers"
    regex: "@objcMembers"
    message: "Explicitly use @objc on each member you want to expose to Objective-C"
    severity: error
  • Are you using nested configurations?
    No

  • Which Xcode version are you using (check xcode-select -p)?
    10.3

@jpsim
Copy link
Collaborator

jpsim commented Dec 18, 2019

Fixed in #2993.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants