{"action":"created","comment":{"url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/comments/190261068","pull_request_review_id":122599869,"id":190261068,"diff_hunk":"@@ -38,40 +39,65 @@ class MainImpl extends CLIApp {\n           \"No credentials found.\".asLeft[ProjectConfiguration]\n         } { _.getRemoteConfiguration }\n \n-        val resultsUploader: Either[String, ResultsUploader] = codacyClientOpt.fold {\n-          \"No credentials found.\".asLeft[ResultsUploader]\n-        } { codacyClient =>\n-          analyse.commitUuid.fold {\n-            \"No commit option found.\".asLeft[ResultsUploader]\n-          } { commit =>\n-            if (analyse.uploadValue) {\n-              new ResultsUploader(commit, codacyClient, None).asRight[String]\n-            } else {\n-              \"Upload option disabled.\".asLeft[ResultsUploader]\n-            }\n-          }\n-\n-        }\n-\n-        new AnalyseExecutor(\n+        val analysisResults = new AnalyseExecutor(\n           analyse.tool,\n           analyse.directory,\n           formatter,\n           analyser,\n-          resultsUploader,\n           fileCollector,\n           remoteProjectConfiguration,\n           analyse.parallel).run()\n-    }\n \n-    Await.result(res, Duration.Inf) match {\n-      case Left(e) =>\n-        logger.error(s\"Failed analysis: $e\")\n-      case Right(_) =>\n-        logger.info(\"Completed analysis successfully\")\n+        val uploadResult = uploadResults(codacyClientOpt)(analyse.uploadValue, analyse.commitUuid, analysisResults)\n+        Await.result(uploadResult, Duration.Inf) match {\n+          case Left(err) if analyse.uploadValue =>\n+            logger.error(s\"Upload of results failed: $err\")\n+          case Right(_) if analyse.uploadValue =>\n+            logger.info(\"Completed upload of results to API\")\n+          case _ =>\n+            logger.info(\"Skipping upload of results to API\")\n+        }\n+\n+        System.exit(new Status(analyse.maxAllowedIssues, analyse.failIfIncompleteValue).exitCode(analysisResults))\n     }\n \n     ()\n   }\n \n+  private def uploadResults(codacyClientOpt: Option[CodacyClient])(\n+    upload: Boolean,\n+    commitUuid: Option[String],\n+    executorResultsEither: Either[String, Seq[ExecutorResult]]): Future[Either[String, Unit]] = {\n+    val resultsUploader: Either[String, ResultsUploader] = codacyClientOpt.fold {","path":"src/main/scala/com/codacy/analysis/cli/Main.scala","position":93,"original_position":93,"commit_id":"31e4621273aa48bc27b25977ad87d00ac8f37d79","original_commit_id":"31e4621273aa48bc27b25977ad87d00ac8f37d79","user":{"login":"xplosunn","id":7125555,"avatar_url":"https://avatars0.githubusercontent.com/u/7125555?v=4","gravatar_id":"","url":"https://api.github.com/users/xplosunn","html_url":"https://github.com/xplosunn","followers_url":"https://api.github.com/users/xplosunn/followers","following_url":"https://api.github.com/users/xplosunn/following{/other_user}","gists_url":"https://api.github.com/users/xplosunn/gists{/gist_id}","starred_url":"https://api.github.com/users/xplosunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xplosunn/subscriptions","organizations_url":"https://api.github.com/users/xplosunn/orgs","repos_url":"https://api.github.com/users/xplosunn/repos","events_url":"https://api.github.com/users/xplosunn/events{/privacy}","received_events_url":"https://api.github.com/users/xplosunn/received_events","type":"User","site_admin":false},"body":"I would prefer this as a for comprehension with the \"Option\"s converted to \"Either\"s using \".toRight\", but not a mandatory change.","created_at":"2018-05-23T14:10:24Z","updated_at":"2018-05-23T14:52:22Z","html_url":"https://github.com/codacy/codacy-analysis-cli/pull/17#discussion_r190261068","pull_request_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/comments/190261068"},"html":{"href":"https://github.com/codacy/codacy-analysis-cli/pull/17#discussion_r190261068"},"pull_request":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17","id":189773441,"html_url":"https://github.com/codacy/codacy-analysis-cli/pull/17","diff_url":"https://github.com/codacy/codacy-analysis-cli/pull/17.diff","patch_url":"https://github.com/codacy/codacy-analysis-cli/pull/17.patch","issue_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/17","number":17,"state":"open","locked":false,"title":"Add support for absolute value failure","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars0.githubusercontent.com/u/902384?v=4","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"body":"This should be a skeleton of what we need. Still missing the tests.","created_at":"2018-05-22T19:52:05Z","updated_at":"2018-05-23T14:52:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e8bbacd122285ebcf82161c6e2049ece7d89eab","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17/commits","review_comments_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17/comments","review_comment_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/17/comments","statuses_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/statuses/31e4621273aa48bc27b25977ad87d00ac8f37d79","head":{"label":"codacy:fail-cli-with-absolute-values-FT-4987","ref":"fail-cli-with-absolute-values-FT-4987","sha":"31e4621273aa48bc27b25977ad87d00ac8f37d79","user":{"login":"codacy","id":1834093,"avatar_url":"https://avatars0.githubusercontent.com/u/1834093?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy","html_url":"https://github.com/codacy","followers_url":"https://api.github.com/users/codacy/followers","following_url":"https://api.github.com/users/codacy/following{/other_user}","gists_url":"https://api.github.com/users/codacy/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy/subscriptions","organizations_url":"https://api.github.com/users/codacy/orgs","repos_url":"https://api.github.com/users/codacy/repos","events_url":"https://api.github.com/users/codacy/events{/privacy}","received_events_url":"https://api.github.com/users/codacy/received_events","type":"Organization","site_admin":false},"repo":{"id":133814935,"name":"codacy-analysis-cli","full_name":"codacy/codacy-analysis-cli","owner":{"login":"codacy","id":1834093,"avatar_url":"https://avatars0.githubusercontent.com/u/1834093?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy","html_url":"https://github.com/codacy","followers_url":"https://api.github.com/users/codacy/followers","following_url":"https://api.github.com/users/codacy/following{/other_user}","gists_url":"https://api.github.com/users/codacy/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy/subscriptions","organizations_url":"https://api.github.com/users/codacy/orgs","repos_url":"https://api.github.com/users/codacy/repos","events_url":"https://api.github.com/users/codacy/events{/privacy}","received_events_url":"https://api.github.com/users/codacy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codacy/codacy-analysis-cli","description":"Command line interface to execute Codacy code analysis locally","fork":false,"url":"https://api.github.com/repos/codacy/codacy-analysis-cli","forks_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/forks","keys_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/teams","hooks_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/hooks","issue_events_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/events{/number}","events_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/events","assignees_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/assignees{/user}","branches_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/branches{/branch}","tags_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/tags","blobs_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/languages","stargazers_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/stargazers","contributors_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/contributors","subscribers_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/subscribers","subscription_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/subscription","commits_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/contents/{+path}","compare_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/merges","archive_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/downloads","issues_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues{/number}","pulls_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/labels{/name}","releases_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/releases{/id}","deployments_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/deployments","created_at":"2018-05-17T13:08:23Z","updated_at":"2018-05-23T13:27:18Z","pushed_at":"2018-05-23T13:57:01Z","git_url":"git://github.com/codacy/codacy-analysis-cli.git","ssh_url":"git@github.com:codacy/codacy-analysis-cli.git","clone_url":"https://github.com/codacy/codacy-analysis-cli.git","svn_url":"https://github.com/codacy/codacy-analysis-cli","homepage":"https://www.codacy.com","size":265,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3,"open_issues":4,"watchers":3,"default_branch":"master"}},"base":{"label":"codacy:master","ref":"master","sha":"f0826a08b58efdb41832b6082c90f1d9d2d9fe85","user":{"login":"codacy","id":1834093,"avatar_url":"https://avatars0.githubusercontent.com/u/1834093?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy","html_url":"https://github.com/codacy","followers_url":"https://api.github.com/users/codacy/followers","following_url":"https://api.github.com/users/codacy/following{/other_user}","gists_url":"https://api.github.com/users/codacy/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy/subscriptions","organizations_url":"https://api.github.com/users/codacy/orgs","repos_url":"https://api.github.com/users/codacy/repos","events_url":"https://api.github.com/users/codacy/events{/privacy}","received_events_url":"https://api.github.com/users/codacy/received_events","type":"Organization","site_admin":false},"repo":{"id":133814935,"name":"codacy-analysis-cli","full_name":"codacy/codacy-analysis-cli","owner":{"login":"codacy","id":1834093,"avatar_url":"https://avatars0.githubusercontent.com/u/1834093?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy","html_url":"https://github.com/codacy","followers_url":"https://api.github.com/users/codacy/followers","following_url":"https://api.github.com/users/codacy/following{/other_user}","gists_url":"https://api.github.com/users/codacy/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy/subscriptions","organizations_url":"https://api.github.com/users/codacy/orgs","repos_url":"https://api.github.com/users/codacy/repos","events_url":"https://api.github.com/users/codacy/events{/privacy}","received_events_url":"https://api.github.com/users/codacy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codacy/codacy-analysis-cli","description":"Command line interface to execute Codacy code analysis locally","fork":false,"url":"https://api.github.com/repos/codacy/codacy-analysis-cli","forks_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/forks","keys_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/teams","hooks_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/hooks","issue_events_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/events{/number}","events_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/events","assignees_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/assignees{/user}","branches_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/branches{/branch}","tags_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/tags","blobs_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/languages","stargazers_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/stargazers","contributors_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/contributors","subscribers_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/subscribers","subscription_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/subscription","commits_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/contents/{+path}","compare_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/merges","archive_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/downloads","issues_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues{/number}","pulls_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/labels{/name}","releases_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/releases{/id}","deployments_url":"https://api.github.com/repos/codacy/codacy-analysis-cli/deployments","created_at":"2018-05-17T13:08:23Z","updated_at":"2018-05-23T13:27:18Z","pushed_at":"2018-05-23T13:57:01Z","git_url":"git://github.com/codacy/codacy-analysis-cli.git","ssh_url":"git@github.com:codacy/codacy-analysis-cli.git","clone_url":"https://github.com/codacy/codacy-analysis-cli.git","svn_url":"https://github.com/codacy/codacy-analysis-cli","homepage":"https://www.codacy.com","size":265,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17"},"html":{"href":"https://github.com/codacy/codacy-analysis-cli/pull/17"},"issue":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/17"},"comments":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/codacy/codacy-analysis-cli/statuses/31e4621273aa48bc27b25977ad87d00ac8f37d79"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"xplosunn"}}