{"action":"created","issue":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1059","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1059/labels{/name}","comments_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1059/comments","events_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1059/events","html_url":"https://github.com/checkstyle/checkstyle/issues/1059","id":73804813,"number":1059,"title":"IndentationCheck does not work with single line comments in the middle","user":{"login":"rnveach","id":5427943,"avatar_url":"https://avatars.githubusercontent.com/u/5427943?v=3","gravatar_id":"","url":"https://api.github.com/users/rnveach","html_url":"https://github.com/rnveach","followers_url":"https://api.github.com/users/rnveach/followers","following_url":"https://api.github.com/users/rnveach/following{/other_user}","gists_url":"https://api.github.com/users/rnveach/gists{/gist_id}","starred_url":"https://api.github.com/users/rnveach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnveach/subscriptions","organizations_url":"https://api.github.com/users/rnveach/orgs","repos_url":"https://api.github.com/users/rnveach/repos","events_url":"https://api.github.com/users/rnveach/events{/privacy}","received_events_url":"https://api.github.com/users/rnveach/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-07T02:07:12Z","updated_at":"2015-05-09T00:50:35Z","closed_at":null,"body":"This is not related to CommentsIndentationCheck as the comments are not stand-alone, but in the middle of a statement.\r\nThese comments are in the middle of an if statement for explanations about the separate conditions. IndentationCheck incorrectly marks them as errors when they are formatted correctly with Eclipse.\r\n\r\nConfig:\r\n````\r\n\t\t<module name=\"Indentation\">\r\n\t\t\t<property name=\"tabWidth\" value=\"4\" />\r\n\t\t\t<property name=\"basicOffset\" value=\"4\" />\r\n\t\t\t<property name=\"braceAdjustment\" value=\"0\" />\r\n\t\t\t<property name=\"caseIndent\" value=\"0\" />\r\n\t\t\t<property name=\"throwsIndent\" value=\"4\" />\r\n\t\t\t<property name=\"lineWrappingIndentation\" value=\"0\" />\r\n\t\t\t<property name=\"arrayInitIndent\" value=\"8\" />\r\n\t\t</module>\r\n````\r\n\r\nInput after formatted with Eclipse (ignore \"//<-- \" as explanations of the start of the lines)\r\n````\r\npackage test;\r\n\r\npublic class TestClass {\r\n\tpublic static void test() { //<-- 4:4\r\n\t\tif ( //<-- 5:8\r\n\t\t// comment explaining complex condition //<-- 6:8\r\n\t\t(true) && //<-- 7:8\r\n\t\t// comment explaining 2nd complex condition //<-- 8:8\r\n\t\t(true)) { //<-- 9:8\r\n\t\t\tSystem.out.println(\"work\"); //<-- 10:12\r\n\t\t} //<-- 11:8\r\n\t} //<-- 12:4\r\n}\r\n````\r\n\r\nErrors:\r\n````\r\nTestClass.java:7: 'if' child have incorrect indentation level 8, expected level should be 12.\r\nTestClass.java:9: 'if' child have incorrect indentation level 8, expected level should be 16.\r\n````\r\n\r\nIt doesn't know the comments are there which affects the indentation on the following line.\r\nI couldn't find a specific setting in Eclipse that changed this behavior. Even the built-in formatter does it."},"comment":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/comments/100401602","html_url":"https://github.com/checkstyle/checkstyle/issues/1059#issuecomment-100401602","issue_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1059","id":100401602,"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-05-09T00:50:35Z","updated_at":"2015-05-09T00:50:35Z","body":"Indentation Check is not aware of comments at all. All comments are skipped from analysed AST tree.\r\n\r\nWe do have new generation of Checks that are comments aware - https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.java#L75 , but it is new functionality and not widely used, as fast majority of Checks do not need comments at all.\r\n\r\nIndentation Check is one of them most complicated and buggy Check that we have. We do not have enough dev force to fix it :( . All are welcome with any help there. \r\nScope of problems - https://github.com/checkstyle/checkstyle/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+indentationcheck\r\n\r\nJudging amount of problems that we have right now even without comments support, I doubt that we will do comments support in that year with current development team. \r\n\r\nBut thanks a lot for feature request , It help us understand that this feature really in demand. "}}