{"action":"created","comment":{"url":"https://api.github.com/repos/henryju-test/sonarqube/pulls/comments/26744873","id":26744873,"diff_hunk":"@@ -0,0 +1,85 @@\n+/*\n+ * SonarQube, open source software quality management tool.\n+ * Copyright (C) 2008-2014 SonarSource\n+ * mailto:contact AT sonarsource DOT com\n+ *\n+ * SonarQube 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+ * SonarQube 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+\n+package org.sonar.batch.protocol.output;\n+\n+import javax.annotation.CheckForNull;\n+\n+public class BatchReportMeasureUtils {\n+  private BatchReportMeasureUtils() {\n+    // static methods only\n+  }\n+\n+  /**\n+   * return the numerical value as a double. It's the type used in db.\n+   * Returns null if no numerical value found\n+   */\n+  @CheckForNull\n+  public static Double valueAsDouble(BatchReport.Measure measure) {\n+    switch (measure.getValueType()) {\n+      case BOOLEAN:\n+        return measure.getBooleanValue() ? 1.0d : 0.0d;\n+      case INT:\n+        return Double.valueOf(measure.getIntValue());\n+      case LONG:\n+        return Double.valueOf(measure.getLongValue());\n+      case DOUBLE:\n+        return measure.getDoubleValue();\n+      default:\n+        return null;\n+    }\n+  }\n+\n+  /**\n+   * check that measure has a value (numerical or string) and a metric key\n+   */\n+  public static void checkMeasure(BatchReport.Measure measure) {","path":"sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportMeasureUtils.java","position":53,"original_position":53,"commit_id":"2d635a4cb99a6551e04a85885312b5448a81516a","original_commit_id":"2d635a4cb99a6551e04a85885312b5448a81516a","user":{"login":"henryju-test","id":11535310,"avatar_url":"https://avatars.githubusercontent.com/u/11535310?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju-test","html_url":"https://github.com/henryju-test","followers_url":"https://api.github.com/users/henryju-test/followers","following_url":"https://api.github.com/users/henryju-test/following{/other_user}","gists_url":"https://api.github.com/users/henryju-test/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju-test/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju-test/subscriptions","organizations_url":"https://api.github.com/users/henryju-test/orgs","repos_url":"https://api.github.com/users/henryju-test/repos","events_url":"https://api.github.com/users/henryju-test/events{/privacy}","received_events_url":"https://api.github.com/users/henryju-test/received_events","type":"User","site_admin":false},"body":"MAJOR: The Cyclomatic Complexity of this method \"checkMeasure\" is 11 which is greater than 10 authorized.","created_at":"2015-03-19T11:11:58Z","updated_at":"2015-03-19T11:11:58Z","html_url":"https://github.com/henryju-test/sonarqube/pull/1#discussion_r26744873","pull_request_url":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/henryju-test/sonarqube/pulls/comments/26744873"},"html":{"href":"https://github.com/henryju-test/sonarqube/pull/1#discussion_r26744873"},"pull_request":{"href":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1","id":31508349,"html_url":"https://github.com/henryju-test/sonarqube/pull/1","diff_url":"https://github.com/henryju-test/sonarqube/pull/1.diff","patch_url":"https://github.com/henryju-test/sonarqube/pull/1.patch","issue_url":"https://api.github.com/repos/henryju-test/sonarqube/issues/1","number":1,"state":"open","locked":false,"title":"Feature/server/measures compute","user":{"login":"henryju-test","id":11535310,"avatar_url":"https://avatars.githubusercontent.com/u/11535310?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju-test","html_url":"https://github.com/henryju-test","followers_url":"https://api.github.com/users/henryju-test/followers","following_url":"https://api.github.com/users/henryju-test/following{/other_user}","gists_url":"https://api.github.com/users/henryju-test/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju-test/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju-test/subscriptions","organizations_url":"https://api.github.com/users/henryju-test/orgs","repos_url":"https://api.github.com/users/henryju-test/repos","events_url":"https://api.github.com/users/henryju-test/events{/privacy}","received_events_url":"https://api.github.com/users/henryju-test/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-19T09:55:50Z","updated_at":"2015-03-19T11:11:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"810118aebc0584973ab44adfd79b1c3abd71d0d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1/commits","review_comments_url":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1/comments","review_comment_url":"https://api.github.com/repos/henryju-test/sonarqube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/henryju-test/sonarqube/issues/1/comments","statuses_url":"https://api.github.com/repos/henryju-test/sonarqube/statuses/2d635a4cb99a6551e04a85885312b5448a81516a","head":{"label":"henryju-test:feature/server/measures_compute","ref":"feature/server/measures_compute","sha":"2d635a4cb99a6551e04a85885312b5448a81516a","user":{"login":"henryju-test","id":11535310,"avatar_url":"https://avatars.githubusercontent.com/u/11535310?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju-test","html_url":"https://github.com/henryju-test","followers_url":"https://api.github.com/users/henryju-test/followers","following_url":"https://api.github.com/users/henryju-test/following{/other_user}","gists_url":"https://api.github.com/users/henryju-test/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju-test/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju-test/subscriptions","organizations_url":"https://api.github.com/users/henryju-test/orgs","repos_url":"https://api.github.com/users/henryju-test/repos","events_url":"https://api.github.com/users/henryju-test/events{/privacy}","received_events_url":"https://api.github.com/users/henryju-test/received_events","type":"User","site_admin":false},"repo":{"id":32513526,"name":"sonarqube","full_name":"henryju-test/sonarqube","owner":{"login":"henryju-test","id":11535310,"avatar_url":"https://avatars.githubusercontent.com/u/11535310?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju-test","html_url":"https://github.com/henryju-test","followers_url":"https://api.github.com/users/henryju-test/followers","following_url":"https://api.github.com/users/henryju-test/following{/other_user}","gists_url":"https://api.github.com/users/henryju-test/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju-test/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju-test/subscriptions","organizations_url":"https://api.github.com/users/henryju-test/orgs","repos_url":"https://api.github.com/users/henryju-test/repos","events_url":"https://api.github.com/users/henryju-test/events{/privacy}","received_events_url":"https://api.github.com/users/henryju-test/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henryju-test/sonarqube","description":"Put your technical debt under control","fork":true,"url":"https://api.github.com/repos/henryju-test/sonarqube","forks_url":"https://api.github.com/repos/henryju-test/sonarqube/forks","keys_url":"https://api.github.com/repos/henryju-test/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henryju-test/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henryju-test/sonarqube/teams","hooks_url":"https://api.github.com/repos/henryju-test/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/henryju-test/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/henryju-test/sonarqube/events","assignees_url":"https://api.github.com/repos/henryju-test/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/henryju-test/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/henryju-test/sonarqube/tags","blobs_url":"https://api.github.com/repos/henryju-test/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henryju-test/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henryju-test/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/henryju-test/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henryju-test/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/henryju-test/sonarqube/languages","stargazers_url":"https://api.github.com/repos/henryju-test/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/henryju-test/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/henryju-test/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/henryju-test/sonarqube/subscription","commits_url":"https://api.github.com/repos/henryju-test/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/henryju-test/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/henryju-test/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/henryju-test/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/henryju-test/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/henryju-test/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henryju-test/sonarqube/merges","archive_url":"https://api.github.com/repos/henryju-test/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henryju-test/sonarqube/downloads","issues_url":"https://api.github.com/repos/henryju-test/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/henryju-test/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/henryju-test/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/henryju-test/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henryju-test/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/henryju-test/sonarqube/releases{/id}","created_at":"2015-03-19T09:54:28Z","updated_at":"2015-03-19T09:54:48Z","pushed_at":"2015-03-19T10:10:27Z","git_url":"git://github.com/henryju-test/sonarqube.git","ssh_url":"git@github.com:henryju-test/sonarqube.git","clone_url":"https://github.com/henryju-test/sonarqube.git","svn_url":"https://github.com/henryju-test/sonarqube","homepage":"http://www.sonarqube.org","size":520973,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"henryju-test:master","ref":"master","sha":"3ea46c74d8202c3dd11bd3569204093bfb173946","user":{"login":"henryju-test","id":11535310,"avatar_url":"https://avatars.githubusercontent.com/u/11535310?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju-test","html_url":"https://github.com/henryju-test","followers_url":"https://api.github.com/users/henryju-test/followers","following_url":"https://api.github.com/users/henryju-test/following{/other_user}","gists_url":"https://api.github.com/users/henryju-test/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju-test/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju-test/subscriptions","organizations_url":"https://api.github.com/users/henryju-test/orgs","repos_url":"https://api.github.com/users/henryju-test/repos","events_url":"https://api.github.com/users/henryju-test/events{/privacy}","received_events_url":"https://api.github.com/users/henryju-test/received_events","type":"User","site_admin":false},"repo":{"id":32513526,"name":"sonarqube","full_name":"henryju-test/sonarqube","owner":{"login":"henryju-test","id":11535310,"avatar_url":"https://avatars.githubusercontent.com/u/11535310?v=3","gravatar_id":"","url":"https://api.github.com/users/henryju-test","html_url":"https://github.com/henryju-test","followers_url":"https://api.github.com/users/henryju-test/followers","following_url":"https://api.github.com/users/henryju-test/following{/other_user}","gists_url":"https://api.github.com/users/henryju-test/gists{/gist_id}","starred_url":"https://api.github.com/users/henryju-test/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryju-test/subscriptions","organizations_url":"https://api.github.com/users/henryju-test/orgs","repos_url":"https://api.github.com/users/henryju-test/repos","events_url":"https://api.github.com/users/henryju-test/events{/privacy}","received_events_url":"https://api.github.com/users/henryju-test/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henryju-test/sonarqube","description":"Put your technical debt under control","fork":true,"url":"https://api.github.com/repos/henryju-test/sonarqube","forks_url":"https://api.github.com/repos/henryju-test/sonarqube/forks","keys_url":"https://api.github.com/repos/henryju-test/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henryju-test/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henryju-test/sonarqube/teams","hooks_url":"https://api.github.com/repos/henryju-test/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/henryju-test/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/henryju-test/sonarqube/events","assignees_url":"https://api.github.com/repos/henryju-test/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/henryju-test/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/henryju-test/sonarqube/tags","blobs_url":"https://api.github.com/repos/henryju-test/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henryju-test/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henryju-test/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/henryju-test/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henryju-test/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/henryju-test/sonarqube/languages","stargazers_url":"https://api.github.com/repos/henryju-test/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/henryju-test/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/henryju-test/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/henryju-test/sonarqube/subscription","commits_url":"https://api.github.com/repos/henryju-test/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/henryju-test/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/henryju-test/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/henryju-test/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/henryju-test/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/henryju-test/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henryju-test/sonarqube/merges","archive_url":"https://api.github.com/repos/henryju-test/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henryju-test/sonarqube/downloads","issues_url":"https://api.github.com/repos/henryju-test/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/henryju-test/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/henryju-test/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/henryju-test/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henryju-test/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/henryju-test/sonarqube/releases{/id}","created_at":"2015-03-19T09:54:28Z","updated_at":"2015-03-19T09:54:48Z","pushed_at":"2015-03-19T10:10:27Z","git_url":"git://github.com/henryju-test/sonarqube.git","ssh_url":"git@github.com:henryju-test/sonarqube.git","clone_url":"https://github.com/henryju-test/sonarqube.git","svn_url":"https://github.com/henryju-test/sonarqube","homepage":"http://www.sonarqube.org","size":520973,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1"},"html":{"href":"https://github.com/henryju-test/sonarqube/pull/1"},"issue":{"href":"https://api.github.com/repos/henryju-test/sonarqube/issues/1"},"comments":{"href":"https://api.github.com/repos/henryju-test/sonarqube/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/henryju-test/sonarqube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/henryju-test/sonarqube/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/henryju-test/sonarqube/statuses/2d635a4cb99a6551e04a85885312b5448a81516a"}}}}