{"action":"closed","issue":{"url":"https://api.github.com/repos/buschmais/jqassistant/issues/133","labels_url":"https://api.github.com/repos/buschmais/jqassistant/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/buschmais/jqassistant/issues/133/comments","events_url":"https://api.github.com/repos/buschmais/jqassistant/issues/133/events","html_url":"https://github.com/buschmais/jqassistant/issues/133","id":46094828,"number":133,"title":"Make verify of constraints a first class citizen","user":{"login":"jensnerche","id":139336,"avatar_url":"https://avatars.githubusercontent.com/u/139336?v=3","gravatar_id":"","url":"https://api.github.com/users/jensnerche","html_url":"https://github.com/jensnerche","followers_url":"https://api.github.com/users/jensnerche/followers","following_url":"https://api.github.com/users/jensnerche/following{/other_user}","gists_url":"https://api.github.com/users/jensnerche/gists{/gist_id}","starred_url":"https://api.github.com/users/jensnerche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jensnerche/subscriptions","organizations_url":"https://api.github.com/users/jensnerche/orgs","repos_url":"https://api.github.com/users/jensnerche/repos","events_url":"https://api.github.com/users/jensnerche/events{/privacy}","received_events_url":"https://api.github.com/users/jensnerche/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/buschmais/jqassistant/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"DirkMahler","id":437925,"avatar_url":"https://avatars.githubusercontent.com/u/437925?v=3","gravatar_id":"","url":"https://api.github.com/users/DirkMahler","html_url":"https://github.com/DirkMahler","followers_url":"https://api.github.com/users/DirkMahler/followers","following_url":"https://api.github.com/users/DirkMahler/following{/other_user}","gists_url":"https://api.github.com/users/DirkMahler/gists{/gist_id}","starred_url":"https://api.github.com/users/DirkMahler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirkMahler/subscriptions","organizations_url":"https://api.github.com/users/DirkMahler/orgs","repos_url":"https://api.github.com/users/DirkMahler/repos","events_url":"https://api.github.com/users/DirkMahler/events{/privacy}","received_events_url":"https://api.github.com/users/DirkMahler/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/buschmais/jqassistant/milestones/6","html_url":"https://github.com/buschmais/jqassistant/milestones/1.0.0","labels_url":"https://api.github.com/repos/buschmais/jqassistant/milestones/6/labels","id":928745,"number":6,"title":"1.0.0","description":"","creator":{"login":"DirkMahler","id":437925,"avatar_url":"https://avatars.githubusercontent.com/u/437925?v=3","gravatar_id":"","url":"https://api.github.com/users/DirkMahler","html_url":"https://github.com/DirkMahler","followers_url":"https://api.github.com/users/DirkMahler/followers","following_url":"https://api.github.com/users/DirkMahler/following{/other_user}","gists_url":"https://api.github.com/users/DirkMahler/gists{/gist_id}","starred_url":"https://api.github.com/users/DirkMahler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirkMahler/subscriptions","organizations_url":"https://api.github.com/users/DirkMahler/orgs","repos_url":"https://api.github.com/users/DirkMahler/repos","events_url":"https://api.github.com/users/DirkMahler/events{/privacy}","received_events_url":"https://api.github.com/users/DirkMahler/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":12,"state":"open","created_at":"2015-01-09T15:27:16Z","updated_at":"2015-03-23T16:20:40Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2014-10-17T12:41:50Z","updated_at":"2015-03-23T16:20:40Z","closed_at":"2015-03-23T16:20:40Z","body":"Currently, the verification of constraints is implemented as part of reports. The verification should be extracted as separated step. \r\nThe constraints should also get a (optional?) verify section defining the expected result. Let's start with these verification operations: equal, lesser, greater, not, in, regex, count, script.\r\n\r\n\r\nExample:\r\n```\r\n<constraint id=\"example:ConstructorOfDateMustNotBeUsed\">\r\n        <description>Constructors of java.util.Date must not be used.</description>\r\n        <cypher><![CDATA[\r\n            match\r\n                (dateType:Type)-[:DECLARES]->(forbiddenMethod:Method),\r\n                (type:Type)-[:DECLARES]->(method:Method)-[:INVOKES]->(forbiddenMethod)\r\n            where\r\n                dateType.fqn = 'java.util.Date'\r\n                and forbiddenMethod:Constructor\r\n            return\r\n                method as Method, type as Type\r\n        ]]></cypher>\r\n        <verify>\r\n            <count>2</count>\r\n            <equal property=\"Method.name\">thisMethodUsesDateToShowAConstraintViolation</equal>\r\n            <equal property=\"Method.name\">anotherAllowedMethod</equal>\r\n            <equal property=\"Type.fqn\">TheClassName</equal>\r\n            <in property=\"Method.name\">\r\n                thisMethodUsesDateToShowAConstraintViolation\r\n                anotherAllowedMethod\r\n            </in>            \r\n           <not>\r\n                <equal property=\"Type.fqn\">DisallowedClassName</equal>\r\n            </not>\r\n            <script lang=\"groovy\">\r\n                Type -> Type.fqn.equals(\"TheClassName\")\r\n            </script>\r\n        </verify>\r\n    </constraint>\r\n```"}}