{"action":"created","issue":{"url":"https://api.github.com/repos/adangel/pmd/issues/21","labels_url":"https://api.github.com/repos/adangel/pmd/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/adangel/pmd/issues/21/comments","events_url":"https://api.github.com/repos/adangel/pmd/issues/21/events","html_url":"https://github.com/adangel/pmd/pull/21","id":68215361,"number":21,"title":"Added PMD Rules for Singleton pattern violations.","user":{"login":"kshantaramanUFL","id":6924897,"avatar_url":"https://avatars.githubusercontent.com/u/6924897?v=3","gravatar_id":"","url":"https://api.github.com/users/kshantaramanUFL","html_url":"https://github.com/kshantaramanUFL","followers_url":"https://api.github.com/users/kshantaramanUFL/followers","following_url":"https://api.github.com/users/kshantaramanUFL/following{/other_user}","gists_url":"https://api.github.com/users/kshantaramanUFL/gists{/gist_id}","starred_url":"https://api.github.com/users/kshantaramanUFL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshantaramanUFL/subscriptions","organizations_url":"https://api.github.com/users/kshantaramanUFL/orgs","repos_url":"https://api.github.com/users/kshantaramanUFL/repos","events_url":"https://api.github.com/users/kshantaramanUFL/events{/privacy}","received_events_url":"https://api.github.com/users/kshantaramanUFL/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-13T23:08:23Z","updated_at":"2015-04-14T00:51:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/adangel/pmd/pulls/21","html_url":"https://github.com/adangel/pmd/pull/21","diff_url":"https://github.com/adangel/pmd/pull/21.diff","patch_url":"https://github.com/adangel/pmd/pull/21.patch"},"body":"Hi Andreas,\r\n\r\nI have added two java rules for PMD and have run it against dogfood.xml to check any violations to the coding standard/quality. Explaining these rules in detail as below\r\n\r\nSingleMethodSingletonRule: Rule that checks that a class following the Singleton Design pattern should have only 1 getInstance method and no overloaded copies of the method. The reason for this rule SIngleton Classes are intended to contain only one getInstance method. Developers may have added another getInstance method for test purposes but would have forgotten to remove them. This rule intends to catch those scenarios. \r\n\r\nSingletonClassReturningNewInstance: A rule that checks if the getInstance method of the Singleton Class instantiates the data member instance of the class and does not return a locally created instance inside the getInstance method. The reason for this rule is that, Singleton classes are meant to instantiate their class variable and cache them than returning a locally created variable which is not cached. This does not conform to Singleton Design Pattern and the class essentially becomes a non-singleton class.\r\n\r\nAs these rules conform to a design pattern the rules have been added in design.xml ruleset of the PMD-java code.\r\n\r\nThe test cases have been added to the corresponding folders. Please have a look at it and let me know if you need additional information."},"comment":{"url":"https://api.github.com/repos/adangel/pmd/issues/comments/92548714","html_url":"https://github.com/adangel/pmd/pull/21#issuecomment-92548714","issue_url":"https://api.github.com/repos/adangel/pmd/issues/21","id":92548714,"user":{"login":"buildhive","id":1584733,"avatar_url":"https://avatars.githubusercontent.com/u/1584733?v=3","gravatar_id":"","url":"https://api.github.com/users/buildhive","html_url":"https://github.com/buildhive","followers_url":"https://api.github.com/users/buildhive/followers","following_url":"https://api.github.com/users/buildhive/following{/other_user}","gists_url":"https://api.github.com/users/buildhive/gists{/gist_id}","starred_url":"https://api.github.com/users/buildhive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildhive/subscriptions","organizations_url":"https://api.github.com/users/buildhive/orgs","repos_url":"https://api.github.com/users/buildhive/repos","events_url":"https://api.github.com/users/buildhive/events{/privacy}","received_events_url":"https://api.github.com/users/buildhive/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T00:51:50Z","updated_at":"2015-04-14T00:51:50Z","body":"[Andreas Dangel » pmd #265](https://buildhive.cloudbees.com/job/adangel/job/pmd/265/) UNSTABLE\nLooks like there's a problem with this pull request\n[(what's this?)](https://www.cloudbees.com/what-is-buildhive)"}}