{"action":"created","comment":{"url":"https://api.github.com/repos/mwz/sonar-scala/pulls/comments/183090476","pull_request_review_id":114027264,"id":183090476,"diff_hunk":"@@ -0,0 +1,74 @@\n+/*\n+ * Sonar Scala Plugin\n+ * Copyright (C) 2018 All contributors\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 3 of the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation,\n+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n+ */\n+package com.mwz.sonar.scala.scapegoat\n+\n+import com.sksamuel.scapegoat.Inspection\n+import com.sksamuel.scapegoat.Levels\n+import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner\n+import io.github.lukehutch.fastclasspathscanner.matchprocessor.SubclassMatchProcessor\n+import scala.collection.mutable\n+import sbt._\n+import Keys._\n+\n+/** SBT Task that generates a managed file with all scapegoat inspections */\n+object ScapegoatInspectionsGenerator {\n+  val generatorTask = Def.task {\n+    val log = streams.value.log\n+    log.info(\"Generating the scapegoat inspections file\")\n+\n+    val inspectionClass = classOf[Inspection]\n+    val inspections = mutable.ListBuffer.empty[Inspection]\n+\n+    // We need to override the scanner class loader so it can find the scapegoat inspections\n+    log.debug(\"[ScapegoatInspectionsGenerator] Scanning the classpath\")\n+    val fastCPScanner = new FastClasspathScanner(inspectionClass.getPackage.getName)\n+    fastCPScanner\n+      .overrideClassLoaders(inspectionClass.getClassLoader)\n+      .matchSubclassesOf(\n+        inspectionClass,\n+        new SubclassMatchProcessor[Inspection] {\n+          override def processMatch(matchingClass: Class[_ <: Inspection]): Unit = {\n+            log.debug(s\"[ScapegoatInspectionsGenerator] Found the inspection: ${matchingClass.getName}\")\n+            inspections += matchingClass.newInstance()\n+          }\n+        }\n+      ).scan()\n+\n+    val AllScapegoatInspections = inspections.toList.zipWithIndex map {\n+      case (inspection, idx) =>\n+        s\"\"\"ScapegoatInspection(id = ${idx}, name = \"${inspection.text}\", description = \"${inspection.explanation.getOrElse(\"No Explanation\")}\", defaultLevel = ${inspection.defaultLevel}),\"\"\"\n+    }\n+\n+    val lines = List(\n+      \"package com.mwz.sonar.scala.scapegoat\",\n+      \"package object inspections {\",","path":"project/ScapegoatInspectionsGenerator.scala","position":60,"original_position":60,"commit_id":"75d7805663db6aaa580569aa2ad0d1e8df2ec380","original_commit_id":"75d7805663db6aaa580569aa2ad0d1e8df2ec380","user":{"login":"BalmungSan","id":11336950,"avatar_url":"https://avatars2.githubusercontent.com/u/11336950?v=4","gravatar_id":"","url":"https://api.github.com/users/BalmungSan","html_url":"https://github.com/BalmungSan","followers_url":"https://api.github.com/users/BalmungSan/followers","following_url":"https://api.github.com/users/BalmungSan/following{/other_user}","gists_url":"https://api.github.com/users/BalmungSan/gists{/gist_id}","starred_url":"https://api.github.com/users/BalmungSan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalmungSan/subscriptions","organizations_url":"https://api.github.com/users/BalmungSan/orgs","repos_url":"https://api.github.com/users/BalmungSan/repos","events_url":"https://api.github.com/users/BalmungSan/events{/privacy}","received_events_url":"https://api.github.com/users/BalmungSan/received_events","type":"User","site_admin":false},"body":"Ok","created_at":"2018-04-20T15:37:45Z","updated_at":"2018-04-20T15:37:46Z","html_url":"https://github.com/mwz/sonar-scala/pull/50#discussion_r183090476","pull_request_url":"https://api.github.com/repos/mwz/sonar-scala/pulls/50","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mwz/sonar-scala/pulls/comments/183090476"},"html":{"href":"https://github.com/mwz/sonar-scala/pull/50#discussion_r183090476"},"pull_request":{"href":"https://api.github.com/repos/mwz/sonar-scala/pulls/50"}},"in_reply_to_id":182898663},"pull_request":{"url":"https://api.github.com/repos/mwz/sonar-scala/pulls/50","id":182323092,"html_url":"https://github.com/mwz/sonar-scala/pull/50","diff_url":"https://github.com/mwz/sonar-scala/pull/50.diff","patch_url":"https://github.com/mwz/sonar-scala/pull/50.patch","issue_url":"https://api.github.com/repos/mwz/sonar-scala/issues/50","number":50,"state":"open","locked":false,"title":"Adding the scapegoat inspections generator task","user":{"login":"BalmungSan","id":11336950,"avatar_url":"https://avatars2.githubusercontent.com/u/11336950?v=4","gravatar_id":"","url":"https://api.github.com/users/BalmungSan","html_url":"https://github.com/BalmungSan","followers_url":"https://api.github.com/users/BalmungSan/followers","following_url":"https://api.github.com/users/BalmungSan/following{/other_user}","gists_url":"https://api.github.com/users/BalmungSan/gists{/gist_id}","starred_url":"https://api.github.com/users/BalmungSan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalmungSan/subscriptions","organizations_url":"https://api.github.com/users/BalmungSan/orgs","repos_url":"https://api.github.com/users/BalmungSan/repos","events_url":"https://api.github.com/users/BalmungSan/events{/privacy}","received_events_url":"https://api.github.com/users/BalmungSan/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-17T22:35:57Z","updated_at":"2018-04-20T15:37:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fbb31638ffdca280f7ab6df98abcaec80537f14","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mwz/sonar-scala/pulls/50/commits","review_comments_url":"https://api.github.com/repos/mwz/sonar-scala/pulls/50/comments","review_comment_url":"https://api.github.com/repos/mwz/sonar-scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mwz/sonar-scala/issues/50/comments","statuses_url":"https://api.github.com/repos/mwz/sonar-scala/statuses/75d7805663db6aaa580569aa2ad0d1e8df2ec380","head":{"label":"BalmungSan:adding-scapegoat-inspections-generation-task","ref":"adding-scapegoat-inspections-generation-task","sha":"75d7805663db6aaa580569aa2ad0d1e8df2ec380","user":{"login":"BalmungSan","id":11336950,"avatar_url":"https://avatars2.githubusercontent.com/u/11336950?v=4","gravatar_id":"","url":"https://api.github.com/users/BalmungSan","html_url":"https://github.com/BalmungSan","followers_url":"https://api.github.com/users/BalmungSan/followers","following_url":"https://api.github.com/users/BalmungSan/following{/other_user}","gists_url":"https://api.github.com/users/BalmungSan/gists{/gist_id}","starred_url":"https://api.github.com/users/BalmungSan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalmungSan/subscriptions","organizations_url":"https://api.github.com/users/BalmungSan/orgs","repos_url":"https://api.github.com/users/BalmungSan/repos","events_url":"https://api.github.com/users/BalmungSan/events{/privacy}","received_events_url":"https://api.github.com/users/BalmungSan/received_events","type":"User","site_admin":false},"repo":{"id":122070729,"name":"sonar-scala","full_name":"BalmungSan/sonar-scala","owner":{"login":"BalmungSan","id":11336950,"avatar_url":"https://avatars2.githubusercontent.com/u/11336950?v=4","gravatar_id":"","url":"https://api.github.com/users/BalmungSan","html_url":"https://github.com/BalmungSan","followers_url":"https://api.github.com/users/BalmungSan/followers","following_url":"https://api.github.com/users/BalmungSan/following{/other_user}","gists_url":"https://api.github.com/users/BalmungSan/gists{/gist_id}","starred_url":"https://api.github.com/users/BalmungSan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalmungSan/subscriptions","organizations_url":"https://api.github.com/users/BalmungSan/orgs","repos_url":"https://api.github.com/users/BalmungSan/repos","events_url":"https://api.github.com/users/BalmungSan/events{/privacy}","received_events_url":"https://api.github.com/users/BalmungSan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BalmungSan/sonar-scala","description":"SonarQube plugin for static code analysis of Scala projects.","fork":true,"url":"https://api.github.com/repos/BalmungSan/sonar-scala","forks_url":"https://api.github.com/repos/BalmungSan/sonar-scala/forks","keys_url":"https://api.github.com/repos/BalmungSan/sonar-scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BalmungSan/sonar-scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BalmungSan/sonar-scala/teams","hooks_url":"https://api.github.com/repos/BalmungSan/sonar-scala/hooks","issue_events_url":"https://api.github.com/repos/BalmungSan/sonar-scala/issues/events{/number}","events_url":"https://api.github.com/repos/BalmungSan/sonar-scala/events","assignees_url":"https://api.github.com/repos/BalmungSan/sonar-scala/assignees{/user}","branches_url":"https://api.github.com/repos/BalmungSan/sonar-scala/branches{/branch}","tags_url":"https://api.github.com/repos/BalmungSan/sonar-scala/tags","blobs_url":"https://api.github.com/repos/BalmungSan/sonar-scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BalmungSan/sonar-scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BalmungSan/sonar-scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/BalmungSan/sonar-scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BalmungSan/sonar-scala/statuses/{sha}","languages_url":"https://api.github.com/repos/BalmungSan/sonar-scala/languages","stargazers_url":"https://api.github.com/repos/BalmungSan/sonar-scala/stargazers","contributors_url":"https://api.github.com/repos/BalmungSan/sonar-scala/contributors","subscribers_url":"https://api.github.com/repos/BalmungSan/sonar-scala/subscribers","subscription_url":"https://api.github.com/repos/BalmungSan/sonar-scala/subscription","commits_url":"https://api.github.com/repos/BalmungSan/sonar-scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/BalmungSan/sonar-scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/BalmungSan/sonar-scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/BalmungSan/sonar-scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/BalmungSan/sonar-scala/contents/{+path}","compare_url":"https://api.github.com/repos/BalmungSan/sonar-scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BalmungSan/sonar-scala/merges","archive_url":"https://api.github.com/repos/BalmungSan/sonar-scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BalmungSan/sonar-scala/downloads","issues_url":"https://api.github.com/repos/BalmungSan/sonar-scala/issues{/number}","pulls_url":"https://api.github.com/repos/BalmungSan/sonar-scala/pulls{/number}","milestones_url":"https://api.github.com/repos/BalmungSan/sonar-scala/milestones{/number}","notifications_url":"https://api.github.com/repos/BalmungSan/sonar-scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BalmungSan/sonar-scala/labels{/name}","releases_url":"https://api.github.com/repos/BalmungSan/sonar-scala/releases{/id}","deployments_url":"https://api.github.com/repos/BalmungSan/sonar-scala/deployments","created_at":"2018-02-19T14:03:19Z","updated_at":"2018-04-10T13:27:48Z","pushed_at":"2018-04-17T22:34:30Z","git_url":"git://github.com/BalmungSan/sonar-scala.git","ssh_url":"git@github.com:BalmungSan/sonar-scala.git","clone_url":"https://github.com/BalmungSan/sonar-scala.git","svn_url":"https://github.com/BalmungSan/sonar-scala","homepage":"","size":993,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mwz:master","ref":"master","sha":"ec6915781d1de19f37a7d73162463ef654cc9e62","user":{"login":"mwz","id":1190768,"avatar_url":"https://avatars0.githubusercontent.com/u/1190768?v=4","gravatar_id":"","url":"https://api.github.com/users/mwz","html_url":"https://github.com/mwz","followers_url":"https://api.github.com/users/mwz/followers","following_url":"https://api.github.com/users/mwz/following{/other_user}","gists_url":"https://api.github.com/users/mwz/gists{/gist_id}","starred_url":"https://api.github.com/users/mwz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwz/subscriptions","organizations_url":"https://api.github.com/users/mwz/orgs","repos_url":"https://api.github.com/users/mwz/repos","events_url":"https://api.github.com/users/mwz/events{/privacy}","received_events_url":"https://api.github.com/users/mwz/received_events","type":"User","site_admin":false},"repo":{"id":118381706,"name":"sonar-scala","full_name":"mwz/sonar-scala","owner":{"login":"mwz","id":1190768,"avatar_url":"https://avatars0.githubusercontent.com/u/1190768?v=4","gravatar_id":"","url":"https://api.github.com/users/mwz","html_url":"https://github.com/mwz","followers_url":"https://api.github.com/users/mwz/followers","following_url":"https://api.github.com/users/mwz/following{/other_user}","gists_url":"https://api.github.com/users/mwz/gists{/gist_id}","starred_url":"https://api.github.com/users/mwz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwz/subscriptions","organizations_url":"https://api.github.com/users/mwz/orgs","repos_url":"https://api.github.com/users/mwz/repos","events_url":"https://api.github.com/users/mwz/events{/privacy}","received_events_url":"https://api.github.com/users/mwz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mwz/sonar-scala","description":"SonarQube plugin for static code analysis of Scala projects.","fork":false,"url":"https://api.github.com/repos/mwz/sonar-scala","forks_url":"https://api.github.com/repos/mwz/sonar-scala/forks","keys_url":"https://api.github.com/repos/mwz/sonar-scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mwz/sonar-scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mwz/sonar-scala/teams","hooks_url":"https://api.github.com/repos/mwz/sonar-scala/hooks","issue_events_url":"https://api.github.com/repos/mwz/sonar-scala/issues/events{/number}","events_url":"https://api.github.com/repos/mwz/sonar-scala/events","assignees_url":"https://api.github.com/repos/mwz/sonar-scala/assignees{/user}","branches_url":"https://api.github.com/repos/mwz/sonar-scala/branches{/branch}","tags_url":"https://api.github.com/repos/mwz/sonar-scala/tags","blobs_url":"https://api.github.com/repos/mwz/sonar-scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mwz/sonar-scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mwz/sonar-scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/mwz/sonar-scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mwz/sonar-scala/statuses/{sha}","languages_url":"https://api.github.com/repos/mwz/sonar-scala/languages","stargazers_url":"https://api.github.com/repos/mwz/sonar-scala/stargazers","contributors_url":"https://api.github.com/repos/mwz/sonar-scala/contributors","subscribers_url":"https://api.github.com/repos/mwz/sonar-scala/subscribers","subscription_url":"https://api.github.com/repos/mwz/sonar-scala/subscription","commits_url":"https://api.github.com/repos/mwz/sonar-scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/mwz/sonar-scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/mwz/sonar-scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/mwz/sonar-scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/mwz/sonar-scala/contents/{+path}","compare_url":"https://api.github.com/repos/mwz/sonar-scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mwz/sonar-scala/merges","archive_url":"https://api.github.com/repos/mwz/sonar-scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mwz/sonar-scala/downloads","issues_url":"https://api.github.com/repos/mwz/sonar-scala/issues{/number}","pulls_url":"https://api.github.com/repos/mwz/sonar-scala/pulls{/number}","milestones_url":"https://api.github.com/repos/mwz/sonar-scala/milestones{/number}","notifications_url":"https://api.github.com/repos/mwz/sonar-scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mwz/sonar-scala/labels{/name}","releases_url":"https://api.github.com/repos/mwz/sonar-scala/releases{/id}","deployments_url":"https://api.github.com/repos/mwz/sonar-scala/deployments","created_at":"2018-01-21T23:04:15Z","updated_at":"2018-04-18T17:43:19Z","pushed_at":"2018-04-17T22:35:58Z","git_url":"git://github.com/mwz/sonar-scala.git","ssh_url":"git@github.com:mwz/sonar-scala.git","clone_url":"https://github.com/mwz/sonar-scala.git","svn_url":"https://github.com/mwz/sonar-scala","homepage":"","size":994,"stargazers_count":14,"watchers_count":14,"language":"Scala","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":5,"open_issues":20,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mwz/sonar-scala/pulls/50"},"html":{"href":"https://github.com/mwz/sonar-scala/pull/50"},"issue":{"href":"https://api.github.com/repos/mwz/sonar-scala/issues/50"},"comments":{"href":"https://api.github.com/repos/mwz/sonar-scala/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/mwz/sonar-scala/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/mwz/sonar-scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mwz/sonar-scala/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/mwz/sonar-scala/statuses/75d7805663db6aaa580569aa2ad0d1e8df2ec380"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"BalmungSan"}}