{"action":"created","issue":{"url":"https://api.github.com/repos/realm/SwiftLint/issues/2226","repository_url":"https://api.github.com/repos/realm/SwiftLint","labels_url":"https://api.github.com/repos/realm/SwiftLint/issues/2226/labels{/name}","comments_url":"https://api.github.com/repos/realm/SwiftLint/issues/2226/comments","events_url":"https://api.github.com/repos/realm/SwiftLint/issues/2226/events","html_url":"https://github.com/realm/SwiftLint/issues/2226","id":328036849,"node_id":"MDU6SXNzdWUzMjgwMzY4NDk=","number":2226,"title":"`mandatory_comma: true` incorrectly indents the next line at end of literals.","user":{"login":"j-h-a","id":1160012,"node_id":"MDQ6VXNlcjExNjAwMTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1160012?v=4","gravatar_id":"","url":"https://api.github.com/users/j-h-a","html_url":"https://github.com/j-h-a","followers_url":"https://api.github.com/users/j-h-a/followers","following_url":"https://api.github.com/users/j-h-a/following{/other_user}","gists_url":"https://api.github.com/users/j-h-a/gists{/gist_id}","starred_url":"https://api.github.com/users/j-h-a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-h-a/subscriptions","organizations_url":"https://api.github.com/users/j-h-a/orgs","repos_url":"https://api.github.com/users/j-h-a/repos","events_url":"https://api.github.com/users/j-h-a/events{/privacy}","received_events_url":"https://api.github.com/users/j-h-a/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-31T08:12:19Z","updated_at":"2018-05-31T18:24:04Z","closed_at":null,"author_association":"NONE","body":"### New Issue Checklist\r\n\r\n- [x] Updated SwiftLint to the latest version\r\n- [x] I searched for [existing GitHub issues](https://github.com/realm/SwiftLint/issues)\r\n\r\n### Bug Report\r\n\r\nThe `trailing_comma` rule with `mandatory_comma: true` does not behave correctly with the `autocorrect --format` option, incorrectly aligning the next line at the end of literals. This makes it incompatible to use with the `literal_expression_end_indentation` opt-in rule.\r\n\r\n### Environment\r\n\r\n* SwiftLint version: `0.25.1`\r\n* Installation method used: `CocoaPods`\r\n\r\n**Minimal triggering example:**\r\n\r\n`.swiftlint.yml`:\r\n```yml\r\nopt_in_rules:\r\n   - literal_expression_end_indentation\r\ntrailing_comma:\r\n  mandatory_comma: true\r\n```\r\n\r\n`example.swift`:\r\n```swift\r\nstruct TheStruct {\r\n    let anArray = [\r\n        \"a\",\r\n        \"b\"\r\n    ]\r\n}\r\n```\r\n\r\nTo test this example create the above two files and run `swiftlint autocorrect --format`\r\n\r\n**Expected behaviour** (`example.swift` after autocorrect):\r\n```swift\r\nstruct TheStruct {\r\n    let anArray = [\r\n        \"a\",\r\n        \"b\",\r\n    ]\r\n}\r\n```\r\nComma is inserted after `\"b\"` and square bracket on line below is left alone.\r\n\r\n**Actual behaviour** (`example.swift` after autocorrect):\r\n```swift\r\nstruct TheStruct {\r\n    let anArray = [\r\n        \"a\",\r\n        \"b\",\r\n        ]\r\n}\r\n```\r\nComma is inserted after `\"b\"` and square bracket on line below is indented to the same level as the array element.\r\n\r\nA subsequent `swiftlint lint --path example.swift --no-cache` command will now trigger a warning for the \"Literal Expression End Indentation Violation\".\r\n"},"comment":{"url":"https://api.github.com/repos/realm/SwiftLint/issues/comments/393628017","html_url":"https://github.com/realm/SwiftLint/issues/2226#issuecomment-393628017","issue_url":"https://api.github.com/repos/realm/SwiftLint/issues/2226","id":393628017,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzYyODAxNw==","user":{"login":"j-h-a","id":1160012,"node_id":"MDQ6VXNlcjExNjAwMTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1160012?v=4","gravatar_id":"","url":"https://api.github.com/users/j-h-a","html_url":"https://github.com/j-h-a","followers_url":"https://api.github.com/users/j-h-a/followers","following_url":"https://api.github.com/users/j-h-a/following{/other_user}","gists_url":"https://api.github.com/users/j-h-a/gists{/gist_id}","starred_url":"https://api.github.com/users/j-h-a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-h-a/subscriptions","organizations_url":"https://api.github.com/users/j-h-a/orgs","repos_url":"https://api.github.com/users/j-h-a/repos","events_url":"https://api.github.com/users/j-h-a/events{/privacy}","received_events_url":"https://api.github.com/users/j-h-a/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T18:24:04Z","updated_at":"2018-05-31T18:24:04Z","author_association":"NONE","body":"Confirmed: `sourcekitten format --file example.swift` is causing this behaviour. Bracket is indented when there is a comma and not when there isn't one."}}
{"actor":{"display_login":"j-h-a"}}