Skip to content
New issue

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

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

Already on GitHub? # to your account

syntactic_sugar message should be type specific #1803

Closed
2 tasks done
freak4pc opened this issue Aug 27, 2017 · 3 comments
Closed
2 tasks done

syntactic_sugar message should be type specific #1803

freak4pc opened this issue Aug 27, 2017 · 3 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@freak4pc
Copy link
Contributor

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
Copy link
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 👍

@freak4pc
Copy link
Contributor Author

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
Copy link
Collaborator

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

@marcelofabri marcelofabri added the enhancement Ideas for improvements of existing features and rules. label Aug 27, 2017
@marcelofabri marcelofabri changed the title syntactic_sugar incorrectly recognizes generic constraint as array syntax syntactic_sugar message should be type specific Aug 27, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

No branches or pull requests

2 participants