Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat: Release v3.0.0 - PHPStan-style analysis, configuration, baseline, and advanced WCAG rules
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Reporting;
|
||||
|
||||
use YakNet\AccessibilityConsole\Core\Violation;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
class ConsoleFormatter implements FormatterInterface
|
||||
{
|
||||
public function format(array $violations, int $baselinedCount, SymfonyStyle $io): int
|
||||
{
|
||||
if (empty($violations)) {
|
||||
$io->success("No violations found!");
|
||||
if ($baselinedCount > 0) {
|
||||
$io->comment("($baselinedCount violations ignored by baseline)");
|
||||
}
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
// Group by file
|
||||
$grouped = [];
|
||||
foreach ($violations as $v) {
|
||||
$file = $v->location['file'] ?? 'unknown';
|
||||
$grouped[$file][] = $v;
|
||||
}
|
||||
|
||||
// Sort files alphabetically for stable order
|
||||
ksort($grouped);
|
||||
|
||||
foreach ($grouped as $file => $fileViolations) {
|
||||
$io->section("File: " . $file);
|
||||
|
||||
// Sort violations by line number
|
||||
usort($fileViolations, function ($a, $b) {
|
||||
return ($a->location['line'] ?? 0) <=> ($b->location['line'] ?? 0);
|
||||
});
|
||||
|
||||
foreach ($fileViolations as $v) {
|
||||
$line = $v->location['line'] ?? 0;
|
||||
|
||||
$severityColor = 'red';
|
||||
if ($v->severity->value === 'warning') {
|
||||
$severityColor = 'yellow';
|
||||
} elseif ($v->severity->value === 'info') {
|
||||
$severityColor = 'cyan';
|
||||
}
|
||||
|
||||
// Format the output
|
||||
$io->writeln(sprintf(
|
||||
" <fg=gray>Line %d:</> <fg=%s;options=bold>[%s]</> %s",
|
||||
$line,
|
||||
$severityColor,
|
||||
$v->ruleId,
|
||||
$v->message
|
||||
));
|
||||
|
||||
// Show snippet
|
||||
$snippet = (string)preg_replace('/\s+/', ' ', trim($v->htmlSnippet));
|
||||
$io->writeln(" <fg=gray>Snippet:</> <fg=yellow>" . htmlspecialchars($snippet) . "</>");
|
||||
|
||||
if ($v->fixSuggestion !== null && $v->fixSuggestion !== '') {
|
||||
$io->writeln(" <fg=gray>AI Suggestion:</> <fg=green>" . htmlspecialchars(trim($v->fixSuggestion)) . "</>");
|
||||
}
|
||||
$io->writeln("");
|
||||
}
|
||||
}
|
||||
|
||||
$totalViolations = count($violations);
|
||||
$io->error(sprintf(
|
||||
"Found %d %s across %d %s.",
|
||||
$totalViolations,
|
||||
$totalViolations === 1 ? 'violation' : 'violations',
|
||||
count($grouped),
|
||||
count($grouped) === 1 ? 'file' : 'files'
|
||||
));
|
||||
|
||||
if ($baselinedCount > 0) {
|
||||
$io->comment("($baselinedCount violations ignored by baseline)");
|
||||
}
|
||||
|
||||
return Command::FAILURE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user