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

let_var_whitespace rule is triggered when on one line before there is #warning statement #2544

Closed
Igor-Palaguta opened this Issue Jan 5, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@Igor-Palaguta
Copy link

Igor-Palaguta commented Jan 5, 2019

New Issue Checklist

Describe the bug

let_var_whitespace rule is triggered when on one line before there is #warning statement

struct SomeStruct {
    let first: Int
    let second: Int

    #warning("Warning")
    let third: Int
}

Variable Declaration Whitespace Violation: Let and var should be separated from other statements by a blank line. (let_var_whitespace)

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.29.2
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    SwiftLint.pkg
  • Paste your configuration file:
opt_in_rules:
  - let_var_whitespace
  • Are you using nested configurations?
    If so, paste their relative paths and respective contents.
    No
  • Which Xcode version are you using (check xcode-select -p)?
    Version 10.0 (10A255)
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
struct SomeStruct {
    let first: Int
    let second: Int

    #warning("Warning")
    let third: Int
}

@marcelofabri marcelofabri added the bug label Jan 5, 2019

@marcelofabri

This comment has been minimized.

Copy link
Collaborator

marcelofabri commented Jan 5, 2019

@Igor-Palaguta would you like to work on a PR to fix this? 🚀

@Igor-Palaguta

This comment has been minimized.

Copy link
Author

Igor-Palaguta commented Jan 10, 2019

@marcelofabri yes sure, let me check

@undeaDD

This comment has been minimized.

Copy link

undeaDD commented Jan 11, 2019

Hey there @Igor-Palaguta, @marcelofabri.

I just found another bug with let_var_whitespace?
Or is this intended? I hope your PR will fix this aswell if its not.

thanks and good luck
Dominic

screenshot 2019-01-11 at 09 20 15

@Igor-Palaguta

This comment has been minimized.

Copy link
Author

Igor-Palaguta commented Feb 3, 2019

@undeaDD

Checked rule implementation. And fixing it for #warning is one line fix #2629. But for typealiases not so fast. As we should check that same type is used.

e.g.

Trigger:

typealias A = Int
typealias B = Float
let a = "Hello"

Not trigger:

typealias A = Int
let a: A

And not sure what to do here:

typealias A = Int
typealias B = Float
let a: B
@marcelofabri

This comment has been minimized.

Copy link
Collaborator

marcelofabri commented Feb 3, 2019

Fixed in #2629.

@undeaDD Please file a new issue for what you've described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
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.