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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is to propose the addition of a new style rule that would check for vertical alignment of collection types (such as with arrays, dictionaries, and sets).
Why should this rule be added?
The proposed rule would ensure that collections that span multiple lines would be vertically aligned on the first character, or on colons for dictionaries.
Provide several examples of what would and wouldn't trigger violations.
Triggering examples
// ❌ Coordinates not aligned on first character
letcoordinates=[CLLocationCoordinate2D(latitude:0, longitude:33),CLLocationCoordinate2D(latitude:0, longitude:66),CLLocationCoordinate2D(latitude:0, longitude:99)]
// ❌ Strings not aligned on first character or on colons
letmeals=["breakfast":"oatmeal","lunch":"sandwich","dinner":"burger"]
// ❌ Integers not aligned on first character
varevenNumbers:Set<Int>=[2,4,6]
Non-triggering examples
// ✅ Dictionary keys aligned on first character
letcolorDictionary:[NSNumber:UIColor]=[0:.clear,5:.white,10:.green,15:.yellow,20:.red
]
// ✅ Dictionary keys aligned on colon
letcolorDictionary:[String:UIColor]=["mild":.green,"moderate":.yellow,"severe":.red
]
✅ Array of strings aligned on first character
letpets=["cat","dog","fish"]
Should the rule be configurable, if so what parameters should be configurable?
No, I don't believe the rule should be configurable.
Should the rule be opt-in or enabled by default? Why?
The proposed rule should be enabled by default to promote consistency in alignment, which is enforced through other rules. I'm open to this being different though.
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Rule Request
This issue is to propose the addition of a new style rule that would check for vertical alignment of collection types (such as with arrays, dictionaries, and sets).
The proposed rule would ensure that collections that span multiple lines would be vertically aligned on the first character, or on colons for dictionaries.
Triggering examples
Non-triggering examples
No, I don't believe the rule should be configurable.
The proposed rule should be enabled by default to promote consistency in alignment, which is enforced through other rules. I'm open to this being different though.
The text was updated successfully, but these errors were encountered: