Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/continuous-integration-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ jobs:

- name: Run PHPStan
run: vendor/bin/phpstan analyze

- name: Run Validator's mixin linter
run: bin/console lint:mixin
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
run: composer install --prefer-dist

- name: Lint documentation files
run: bin/console docs:lint
run: bin/console lint:docs
2 changes: 1 addition & 1 deletion .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
run: reuse lint

- name: Run SPDX conventions check
run: bin/console spdx:lint
run: bin/console lint:spdx
16 changes: 8 additions & 8 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ declare(strict_types=1);

require __DIR__ . '/../vendor/autoload.php';

use Respect\Dev\Commands\CreateMixinCommand;
use Respect\Dev\Commands\DocsLintCommand;
use Respect\Dev\Commands\LintDocsCommand;
use Respect\Dev\Commands\LintMixinCommand;
use Respect\Dev\Commands\SmokeTestsCheckCompleteCommand;
use Respect\Dev\Commands\SpdxLintCommand;
use Respect\Dev\Commands\LintSpdxCommand;
use Respect\Dev\Commands\UpdateDomainSuffixesCommand;
use Respect\Dev\Commands\UpdateDomainToplevelCommand;
use Respect\Dev\Commands\UpdatePostalCodesCommand;
use Respect\Dev\Differ\ConsoleDiffer;
use Respect\Dev\Markdown\CompositeLinter;
use Respect\Dev\Markdown\Differ as MarkdownDiffer;
use Respect\Dev\Markdown\Linters\AssertionMessageLinter;
use Respect\Dev\Markdown\Linters\ValidatorHeaderLinter;
use Respect\Dev\Markdown\Linters\ValidatorIndexLinter;
Expand All @@ -30,23 +30,23 @@ use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
use Symfony\Component\Console\Application;

return (static function () {
$differ = new MarkdownDiffer(new Differ(new UnifiedDiffOutputBuilder('', addLineNumbers: true)));
$differ = new ConsoleDiffer(new Differ(new UnifiedDiffOutputBuilder('', addLineNumbers: true)));

$application = new Application('Respect/Validation', '3.0');
$application->addCommand(new CreateMixinCommand());
$application->addCommand(new DocsLintCommand($differ, new CompositeLinter(
$application->addCommand(new LintDocsCommand($differ, new CompositeLinter(
new AssertionMessageLinter(),
new ValidatorHeaderLinter(),
new ValidatorIndexLinter(),
new ValidatorRelatedLinter(),
new ValidatorTemplatesLinter(),
new ValidatorChangelogLinter(),
)));
$application->addCommand(new LintMixinCommand($differ));
$application->addCommand(new LintSpdxCommand());
$application->addCommand(new UpdateDomainSuffixesCommand());
$application->addCommand(new UpdateDomainToplevelCommand());
$application->addCommand(new UpdatePostalCodesCommand());
$application->addCommand(new SmokeTestsCheckCompleteCommand());
$application->addCommand(new SpdxLintCommand());

return $application->run();
})();
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@
"scripts": {
"bench-profile": "vendor/bin/phpbench xdebug:profile",
"bench": "vendor/bin/phpbench run",
"docs-fix": "bin/console docs:lint --fix",
"docs": "bin/console docs:lint",
"docs-fix": "bin/console lint:docs --fix",
"docs": "bin/console lint:docs",
"pest": "vendor/bin/pest --testsuite=feature --compact",
"phpcs": "vendor/bin/phpcs",
"phpstan": "vendor/bin/phpstan analyze",
"phpunit": "vendor/bin/phpunit --testsuite=unit",
"smoke-complete": "bin/console smoke-tests:check-complete",
"spdx-lint": "bin/console spdx:lint",
"spdx-lint": "bin/console lint:spdx",
"qa": [
"@spdx-lint",
"@phpcs",
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<exclude-pattern>tests/Pest.php</exclude-pattern>
</rule>
<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>src/Mixins/</exclude-pattern>
<exclude-pattern>tests/feature/</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Functions.StaticClosure.ClosureNotStatic">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace Respect\Dev\Commands;

use Respect\Dev\Markdown\Differ;
use Respect\Dev\Differ\ConsoleDiffer;
use Respect\Dev\Differ\Item;
use Respect\Dev\Markdown\File;
use Respect\Dev\Markdown\Linter;
use Symfony\Component\Console\Attribute\AsCommand;
Expand All @@ -24,13 +25,13 @@
use function sprintf;

#[AsCommand(
name: 'docs:lint',
name: 'lint:docs',
description: 'Apply documentation linters and optionally auto-fix issues',
)]
final class DocsLintCommand extends Command
final class LintDocsCommand extends Command
{
public function __construct(
private readonly Differ $differ,
private readonly ConsoleDiffer $differ,
private readonly Linter $linter,
) {
parent::__construct();
Expand Down Expand Up @@ -61,7 +62,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$lintedFiles[] = $linted;

$output->writeln($this->differ->diff($original, $linted));
$output->writeln($this->differ->diff(
new Item($original->filename, $original->content->build()),
new Item($linted->filename, $linted->content->build()),
));
}

if ($lintedFiles === []) {
Expand Down
Loading