{"action":"created","issue":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1008","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1008/labels{/name}","comments_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1008/comments","events_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1008/events","html_url":"https://github.com/checkstyle/checkstyle/issues/1008","id":71631350,"number":1008,"title":"Add possibility to specify a unique ID to all Regexp checks","user":{"login":"bananetomate","id":11858159,"avatar_url":"https://avatars.githubusercontent.com/u/11858159?v=3","gravatar_id":"","url":"https://api.github.com/users/bananetomate","html_url":"https://github.com/bananetomate","followers_url":"https://api.github.com/users/bananetomate/followers","following_url":"https://api.github.com/users/bananetomate/following{/other_user}","gists_url":"https://api.github.com/users/bananetomate/gists{/gist_id}","starred_url":"https://api.github.com/users/bananetomate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bananetomate/subscriptions","organizations_url":"https://api.github.com/users/bananetomate/orgs","repos_url":"https://api.github.com/users/bananetomate/repos","events_url":"https://api.github.com/users/bananetomate/events{/privacy}","received_events_url":"https://api.github.com/users/bananetomate/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-28T16:04:47Z","updated_at":"2015-04-29T05:11:37Z","closed_at":null,"body":"The rationale to specify an ID is in conjunction with all SuppressXYZWarnings/Comments. Regexp variants are useful to add additional validations that aren't possible to add with normal checkstyle checks. Unfortunately, when disabling a validation, for example with `// @cs-: RegexpSinglelineJava`, it disables all checks that extends RegexpSinglelineJava. \r\n\r\nIf it was possible to specify an ID to each Regexp variants, it could then be leveraged by the SuppressXYZ to disable only the one matching the ID. Something that could look like `// @cs-: RegexpSinglelineJava:ID`.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/comments/97307315","html_url":"https://github.com/checkstyle/checkstyle/issues/1008#issuecomment-97307315","issue_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/1008","id":97307315,"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-04-29T05:11:37Z","updated_at":"2015-04-29T05:11:37Z","body":"workaround is to use \"id\" of Check and suppress token, from http://checkstyle.sourceforge.net/config.html#Filters\r\n\r\n>\r\n```\r\n<module name=\"DescendantToken\">\r\n    <property name=\"id\" value=\"switchNoDefault\"/>\r\n    <property name=\"tokens\" value=\"LITERAL_SWITCH\"/>\r\n    <property name=\"maximumDepth\" value=\"2\"/>\r\n    <property name=\"limitedTokens\" value=\"LITERAL_DEFAULT\"/>\r\n    <property name=\"minimumNumber\" value=\"1\"/>\r\n</module>\r\n```    \r\nThen the following can be used to suppress only the first check and not the second by using the id attribute:\r\n```\r\n<suppress id=\"stringEqual\" files=\"SomeTestCode.java\"/>\r\n```    \r\n\r\n\r\nBut that is true that suppression by comments use only Check name.\r\nSuppressionCommentFilter, SuppressWithNearbyCommentFilter. The same should be added to  suppression by annotation SuppressWarningsFilter.\r\n\r\nnew new option \"idFormat\" for comments filters might be a good approach and user can specify Checkname or ID in his comment: \r\n```\r\n<module name=\"SuppressWithNearbyCommentFilter\">\r\n    <property name=\"commentFormat\" value=\"@cs.suppress \\[(\\w(\\|\\w)*)\\] \\w[-\\.'`,:;\\w ]{14,}\"/>\r\n    <property name=\"checkFormat\" value=\"$1\"/>\r\n    <property name=\"idFormat\" value=\"$1\"/>\r\n    <property name=\"influenceFormat\" value=\"1\"/>\r\n</module>\r\n```\r\nCode example:\r\n```\r\n// @cs.suppress: regexpSinglelineJavaSysout|LineLenght|testingValidation|RegexpMultiline\r\n```\r\n\r\nbut, there is no such options for SuppressWarningsFilter, so we could just extend filter to match by Check name and then try to match by Check Id. \r\n```\r\n@SuppressWarnings({\"membername\",\"myCheckReferencedByID\"})\r\nprivate int J; // should NOT fail MemberNameCheck and any check that have id=\"myCheckReferencedByID\"\r\n```\r\n\r\nI do not think that format \"<CHECK_NAME>:<CHECK_ID>\" is need to be used. Check name is default name of module, Check Id is user defined ID for reference.\r\n\r\n@bananetomate , does it make sense to you ?"}}