diff --git a/src/PHPCensor/Model/Build/GithubBuild.php b/src/PHPCensor/Model/Build/GithubBuild.php index a4f2c686..daccdb48 100644 --- a/src/PHPCensor/Model/Build/GithubBuild.php +++ b/src/PHPCensor/Model/Build/GithubBuild.php @@ -202,25 +202,30 @@ class GithubBuild extends RemoteGitBuild $lineStart = null, $lineEnd = null ) { - $diffLineNumber = $this->getDiffLineNumber($builder, $file, $lineStart); + $allowCommentCommit = (boolean)Config::getInstance()->get('php-censor.github.comments.commit', false); + $allowCommentPullRequest = (boolean)Config::getInstance()->get('php-censor.github.comments.pull_request', false); - if (!is_null($diffLineNumber)) { - $helper = new Github(); + if ($allowCommentCommit || $allowCommentPullRequest) { + $diffLineNumber = $this->getDiffLineNumber($builder, $file, $lineStart); - $repo = $this->getProject()->getReference(); - $prNumber = $this->getExtra('pull_request_number'); - $commit = $this->getCommitId(); + if (!is_null($diffLineNumber)) { + $helper = new Github(); - $allowCommentCommit = (boolean)Config::getInstance()->get('php-censor.github.comments.commit', false); - $allowCommentPullRequest = (boolean)Config::getInstance()->get('php-censor.github.comments.pull_request', false); + $repo = $this->getProject()->getReference(); + $prNumber = $this->getExtra('pull_request_number'); + $commit = $this->getCommitId(); - if (!empty($prNumber)) { - if ($allowCommentPullRequest) { - $helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message); - } - } else { - if ($allowCommentCommit) { - $helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message); + $allowCommentCommit = (boolean)Config::getInstance()->get('php-censor.github.comments.commit', false); + $allowCommentPullRequest = (boolean)Config::getInstance()->get('php-censor.github.comments.pull_request', false); + + if (!empty($prNumber)) { + if ($allowCommentPullRequest) { + $helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message); + } + } else { + if ($allowCommentCommit) { + $helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message); + } } } } diff --git a/src/PHPCensor/Plugin/PhpUnit.php b/src/PHPCensor/Plugin/PhpUnit.php index 49fabb06..014b6337 100644 --- a/src/PHPCensor/Plugin/PhpUnit.php +++ b/src/PHPCensor/Plugin/PhpUnit.php @@ -145,7 +145,7 @@ class PhpUnit extends Plugin implements ZeroConfigPluginInterface protected function runConfigFile($configFile) { $options = clone $this->options; - $buildPath = $this->build->getBuildPath() . DIRECTORY_SEPARATOR; + $buildPath = $this->build->getBuildPath(); // Save the results into a json file $jsonFile = tempnam(RUNTIME_DIR, 'jLog_');