{"action":"opened","issue":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/2507","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/2507/labels{/name}","comments_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/2507/comments","events_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/2507/events","html_url":"https://github.com/checkstyle/checkstyle/issues/2507","id":114536160,"number":2507,"title":"add example to DescendantToken for catching ASSIGN under EXPR token","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},"labels":[{"url":"https://api.github.com/repos/checkstyle/checkstyle/labels/approved","name":"approved","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-02T06:43:54Z","updated_at":"2015-11-02T06:43:54Z","closed_at":null,"body":"http://checkstyle.sourceforge.net/config_misc.html#DescendantToken\r\n\r\nplease add example of forbidding ASSIGN at expressions. Requested at https://sourceforge.net/p/checkstyle/feature-requests/539/\r\n\r\n/var/tmp $ java -jar checkstyle-6.12-SNAPSHOT-all.jar -c 3.xml   3.java\r\nStarting audit...\r\n/var/tmp/3.java:5:9: error: Count of 1 for 'EXPR' descendant 'ASSIGN' exceeds maximum count 0.\r\nAudit done.\r\nCheckstyle ends with 1 errors.\r\n\r\n/var/tmp $ cat 3.java \r\npackage test;\r\n\r\nclass Test {\r\n    Inpu boo() {\r\n    \tif (a = 1) {}\r\n    }\r\n}\r\n\r\n/var/tmp $ cat 3.xml\r\n<?xml version=\"1.0\"?>\r\n<!DOCTYPE module PUBLIC\r\n    \"-//Puppy Crawl//DTD Check Configuration 1.3//EN\"\r\n    \"http://www.puppycrawl.com/dtds/configuration_1_3.dtd\">\r\n\r\n<module name=\"Checker\">\r\n  <module name=\"TreeWalker\">\r\n\t<module name=\"DescendantToken\">\r\n\t    <property name=\"tokens\" value=\"EXPR\"/>\r\n\t    <property name=\"limitedTokens\" value=\"ASSIGN\"/>\r\n\t    <property name=\"maximumNumber\" value=\"0\"/>\r\n\t</module>\r\n  </module>\r\n</module>"}}