-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Exclude trailing_comma validation on single-line declarations #910
Labels
enhancement
Ideas for improvements of existing features and rules.
Comments
The existing warning is also annoying in cases of single-element arrays, like this: let components = calendar.dateComponents([Calendar.Component.day], from: from, to: to) By the way, my SwiftLint configuration includes: trailing_comma:
mandatory_comma: true |
Should be pretty easy to only report errors in |
Single-line? Don't you mean multi-line? |
Yes, sorry, updated. |
Fixed by @marcelofabri in #912. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The typical arguments for requiring a trailing comma in arrays and dictionaries is so that adding or removing elements doesn't dirty adjacent lines in source control. However, that argument doesn't hold for single-line declarations such as this one I just came across in a project:
It would be nice for SwiftLint to ignore cases like this. There could potentially be a separate rule that all arrays and dictionaries must be multiline, but I personally would leave that one off.
The text was updated successfully, but these errors were encountered: