Skip to content
Permalink
Browse files

Add support for Scrutinizer output

  • Loading branch information...
muglug committed Apr 14, 2019
1 parent f788fb1 commit ece191cc8416d6838279e1817fa66ef84f50a3af
Showing with 37 additions and 1 deletion.
  1. +37 −1 src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php
@@ -43,7 +43,8 @@ public function collect() : array
->fillTravisCi()
->fillCircleCi()
->fillAppVeyor()
->fillJenkins();
->fillJenkins()
->fillScrutinizer();
return $this->readEnv;
}
@@ -195,4 +196,39 @@ protected function fillJenkins() : self
return $this;
}
/**
* Fill Scrutinizer environment variables.
*
* "JENKINS_URL", "BUILD_NUMBER" must be set.
*
* @return $this
*/
protected function fillScrutinizer() : self
{
if (isset($this->env['SCRUTINIZER']) && $this->env['SCRUTINIZER']) {
$this->readEnv['CI_JOB_ID'] = $this->env['SCRUTINIZER_INSPECTION_UUID'];
$this->readEnv['CI_BRANCH'] = $this->env['SCRUTINIZER_BRANCH'];
$this->readEnv['CI_PR_NUMBER'] = $this->env['SCRUTINIZER_PR_NUMBER'] ?? '';
// backup
$this->readEnv['CI_NAME'] = 'Scrutinizer';
$repo_slug = (string) $this->env['SCRUTINIZER_PROJECT'] ?? '';
if ($repo_slug) {
$slug_parts = explode('/', $repo_slug);
if ($this->readEnv['CI_PR_NUMBER']) {
$this->readEnv['CI_PR_REPO_OWNER'] = $slug_parts[1];
$this->readEnv['CI_PR_REPO_NAME'] = $slug_parts[2];
} else {
$this->readEnv['CI_REPO_OWNER'] = $slug_parts[1];
$this->readEnv['CI_REPO_NAME'] = $slug_parts[2];
}
}
}
return $this;
}
}

0 comments on commit ece191c

Please sign in to comment.
You can’t perform that action at this time.