protected function getDiffLineNumber(Builder $builder, $file, $line)
    {
        $line = (integer)$line;

        $builder->logExecOutput(false);

        $prNumber = $this->getExtra('pull_request_number');
        $path = $builder->buildPath;

        if (!empty($prNumber)) {
            $builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
        } else {
            $commitId = $this->getCommitId();
            $compare = $commitId == 'Manual' ? 'HEAD' : $commitId;
            $builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
        }

        $builder->logExecOutput(true);

        $diff = $builder->getLastOutput();

        $helper = new Diff();
        $lines = $helper->getLinePositions($diff);

        return isset($lines[$line]) ? $lines[$line] : null;
    }
protected function getDiffLineNumber(Builder $builder, $file, $line)
    {
        $line = (integer)$line;

        $builder->logExecOutput(false);

        $prNumber = $this->getExtra('pull_request_number');
        $path = $builder->buildPath;

        if (!empty($prNumber)) {
            $builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
        } else {
            $commitId = $this->getCommitId();
            $compare = $commitId == 'Manual' ? 'HEAD' : $commitId;
            $builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
        }

        $builder->logExecOutput(true);

        $diff = $builder->getLastOutput();

        $helper = new Diff();
        $lines = $helper->getLinePositions($diff);

        return isset($lines[$line]) ? $lines[$line] : null;
    }
protected function getDiffLineNumber ( Builder $ builder , $ file , $ line ) { $ line = ( integer ) $ line ; $ builder -> logExecOutput ( false ) ; $ prNumber = $ this -> getExtra ( 'pull_request_number' ) ; $ path = $ builder -> buildPath ; if ( ! empty ( $ prNumber ) ) { $ builder -> executeCommand ( 'cd %s && git diff origin/%s "%s"' , $ path , $ this -> getBranch ( ) , $ file ) ; } else { $ commitId = $ this -> getCommitId ( ) ; $ compare = $ commitId == 'Manual' ? 'HEAD' : $ commitId ; $ builder -> executeCommand ( 'cd %s && git diff %s^^ "%s"' , $ path , $ compare , $ file ) ; } $ builder -> logExecOutput ( true ) ; $ diff = $ builder -> getLastOutput ( ) ; $ helper = new Diff ( ) ; $ lines = $ helper -> getLinePositions ( $ diff ) ; return isset ( $ lines [ $ line ] ) ? $ lines [ $ line ] : null ; }
Uses git diff to figure out what the diff line position is, based on the error line number.
@param Builder $builder
@param $file
@param $line
@return int|null
Uses git diff to figure out what the diff line position is based on the error line number .