{"action":"created","issue":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1006","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1006/labels{/name}","comments_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1006/comments","events_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1006/events","html_url":"https://github.com/checkstyle/checkstyle/issues/1006","id":71601269,"number":1006,"title":"NeedBraces: false positives for single line 'if' in 'for', with allowSingleLineStatement enabled","user":{"login":"dhendriks","id":375606,"avatar_url":"https://avatars.githubusercontent.com/u/375606?v=3","gravatar_id":"","url":"https://api.github.com/users/dhendriks","html_url":"https://github.com/dhendriks","followers_url":"https://api.github.com/users/dhendriks/followers","following_url":"https://api.github.com/users/dhendriks/following{/other_user}","gists_url":"https://api.github.com/users/dhendriks/gists{/gist_id}","starred_url":"https://api.github.com/users/dhendriks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhendriks/subscriptions","organizations_url":"https://api.github.com/users/dhendriks/orgs","repos_url":"https://api.github.com/users/dhendriks/repos","events_url":"https://api.github.com/users/dhendriks/events{/privacy}","received_events_url":"https://api.github.com/users/dhendriks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/checkstyle/checkstyle/labels/approved","name":"approved","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"Vladlis","id":9678372,"avatar_url":"https://avatars.githubusercontent.com/u/9678372?v=3","gravatar_id":"","url":"https://api.github.com/users/Vladlis","html_url":"https://github.com/Vladlis","followers_url":"https://api.github.com/users/Vladlis/followers","following_url":"https://api.github.com/users/Vladlis/following{/other_user}","gists_url":"https://api.github.com/users/Vladlis/gists{/gist_id}","starred_url":"https://api.github.com/users/Vladlis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vladlis/subscriptions","organizations_url":"https://api.github.com/users/Vladlis/orgs","repos_url":"https://api.github.com/users/Vladlis/repos","events_url":"https://api.github.com/users/Vladlis/events{/privacy}","received_events_url":"https://api.github.com/users/Vladlis/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-04-28T14:15:44Z","updated_at":"2015-07-11T03:13:24Z","closed_at":null,"body":"For the NeedBraces check, with allowSingleLineStatement, I've identified what appear to be a false positive.\r\n\r\nTwo problems are reported for single line 'if' in single line 'for':\r\n\r\n```java\r\n        for (int i = 0; i < 10; i++) if (i == 5) break;\r\n```\r\n\r\nOne for the 'if', and one for the 'for', which are indicated as both needing braces, while they clearly don't, as both are single line."},"comment":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/comments/120565923","html_url":"https://github.com/checkstyle/checkstyle/issues/1006#issuecomment-120565923","issue_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1006","id":120565923,"user":{"login":"romani","id":812984,"avatar_url":"https://avatars.githubusercontent.com/u/812984?v=3","gravatar_id":"","url":"https://api.github.com/users/romani","html_url":"https://github.com/romani","followers_url":"https://api.github.com/users/romani/followers","following_url":"https://api.github.com/users/romani/following{/other_user}","gists_url":"https://api.github.com/users/romani/gists{/gist_id}","starred_url":"https://api.github.com/users/romani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romani/subscriptions","organizations_url":"https://api.github.com/users/romani/orgs","repos_url":"https://api.github.com/users/romani/repos","events_url":"https://api.github.com/users/romani/events{/privacy}","received_events_url":"https://api.github.com/users/romani/received_events","type":"User","site_admin":false},"created_at":"2015-07-11T03:13:24Z","updated_at":"2015-07-11T03:13:24Z","body":"@dhendriks, can you share a code (the more the better) with us where such structures are so meaningful to be a single-line ?\r\n\r\nif we allow that, it conflict with the whole idea of Check, and most likely you just do not need NeedBraces to be active in your config.  "}}