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

`syntactic_sugar` message should be type specific #1803

Closed
freak4pc opened this Issue Aug 27, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@freak4pc
Collaborator

freak4pc commented Aug 27, 2017

New Issue Checklist

Bug Report

Environment

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

  • Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods

  • Are you using nested configurations? No

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

  • Do you have a sample that shows the issue?

$ echo "func filterNil<T>() -> Observable<T> where E == Optional<T> {" | swiftlint lint --no-cache --use-stdin --enable-all-rules

<nopath>:1:49: warning: Syntactic Sugar Violation: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int> (syntactic_sugar)

e4d5f878-f825-49cf-a424-9badb6dd72f1

@marcelofabri

This comment has been minimized.

Show comment
Hide comment
@marcelofabri

marcelofabri Aug 27, 2017

Collaborator

It's not complaining about an array, it's because of Optional<T>. Can you try changing to T??.

Anyway, we probably should be more specific on the message 👍

Collaborator

marcelofabri commented Aug 27, 2017

It's not complaining about an array, it's because of Optional<T>. Can you try changing to T??.

Anyway, we probably should be more specific on the message 👍

@freak4pc

This comment has been minimized.

Show comment
Hide comment
@freak4pc

freak4pc Aug 27, 2017

Collaborator

That solves it ! Thanks @marcelofabri !
It's interesting it warns about an array syntax in that case :)

Should I close it or do you want to use this to track fixing up the message?

Collaborator

freak4pc commented Aug 27, 2017

That solves it ! Thanks @marcelofabri !
It's interesting it warns about an array syntax in that case :)

Should I close it or do you want to use this to track fixing up the message?

@marcelofabri

This comment has been minimized.

Show comment
Hide comment
@marcelofabri

marcelofabri Aug 27, 2017

Collaborator

Yeah, we use the same message no matter the type currently. Let's keep it open to track enhancing the message 💯

Collaborator

marcelofabri commented Aug 27, 2017

Yeah, we use the same message no matter the type currently. Let's keep it open to track enhancing the message 💯

@marcelofabri marcelofabri changed the title from `syntactic_sugar` incorrectly recognizes generic constraint as array syntax to `syntactic_sugar` message should be type specific Aug 27, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Aug 27, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Aug 27, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Aug 27, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Aug 27, 2017

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