class Gitlab
Same name in this branch
- 11.1.x vendor/composer/composer/src/Composer/Util/GitLab.php \Composer\Util\GitLab
Hierarchy
- class \Micheh\PhpCodeSniffer\Report\Gitlab implements \PHP_CodeSniffer\Reports\Report
Expanded class hierarchy of Gitlab
1 string reference to 'Gitlab'
- RepositoryFactory::manager in vendor/
composer/ composer/ src/ Composer/ Repository/ RepositoryFactory.php
File
-
vendor/
micheh/ phpcs-gitlab/ src/ Report/ Gitlab.php, line 21
Namespace
Micheh\PhpCodeSniffer\ReportView source
class Gitlab implements Report {
/**
* @psalm-suppress ImplementedParamTypeMismatch PHP_CodeSniffer has a wrong docblock
*/
public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) {
$hasOutput = false;
foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($colErrors as $error) {
$issue = [
'type' => 'issue',
'categories' => [
'Style',
],
'check_name' => $error['source'],
'fingerprint' => md5($report['filename'] . $error['message'] . $line . $column),
'severity' => $error['type'] === 'ERROR' ? 'major' : 'minor',
'description' => str_replace([
"\n",
"\r",
"\t",
], [
'\\n',
'\\r',
'\\t',
], $error['message']),
'location' => [
'path' => $report['filename'],
'lines' => [
'begin' => $line,
'end' => $line,
],
],
];
echo json_encode($issue, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ',';
$hasOutput = true;
}
}
}
return $hasOutput;
}
public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $interactive = false, $toScreen = true) {
echo '[' . rtrim($cachedData, ',') . ']' . PHP_EOL;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
Gitlab::generate | public | function | Generate the actual report. | Overrides Report::generate |
Gitlab::generateFileReport | public | function | @psalm-suppress ImplementedParamTypeMismatch PHP_CodeSniffer has a wrong docblock | Overrides Report::generateFileReport |