Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 584b29d

Browse filesBrowse files
committed
feature #34387 [Yaml] Added yaml-lint binary (jschaedl)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Yaml] Added yaml-lint binary | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | no | New feature? | yes | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #18987 <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | tbd. <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> Commits ------- 2640dfe [Yaml] Introduce yaml-lint binary
2 parents 596caf7 + 2640dfe commit 584b29d
Copy full SHA for 584b29d

File tree

3 files changed

+57
-0
lines changed
Filter options

3 files changed

+57
-0
lines changed

‎src/Symfony/Component/Yaml/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.1.0
5+
-----
6+
7+
* Added `yaml-lint` binary.
8+
49
5.0.0
510
-----
611

+49Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/*
5+
* This file is part of the Symfony package.
6+
*
7+
* (c) Fabien Potencier <fabien@symfony.com>
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
/**
14+
* Runs the Yaml lint command.
15+
*
16+
* @author Jan Schädlich <jan.schaedlich@sensiolabs.de>
17+
*/
18+
19+
use Psr\Log\LoggerInterface;
20+
use Symfony\Component\Console\Application;
21+
use Symfony\Component\Console\Input\ArgvInput;
22+
use Symfony\Component\Console\Logger\ConsoleLogger;
23+
use Symfony\Component\Console\Output\ConsoleOutput;
24+
use Symfony\Component\Yaml\Command\LintCommand;
25+
26+
function includeIfExists(string $file): bool
27+
{
28+
return file_exists($file) && include $file;
29+
}
30+
31+
if (
32+
!includeIfExists(__DIR__ . '/../../../../autoload.php') &&
33+
!includeIfExists(__DIR__ . '/../../vendor/autoload.php') &&
34+
!includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php')
35+
) {
36+
fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL);
37+
exit(1);
38+
}
39+
40+
if (!class_exists(Application::class)) {
41+
fwrite(STDERR, 'You need the "symfony/console" component in order to run the Yaml linter.'.PHP_EOL);
42+
exit(1);
43+
}
44+
45+
(new Application())->add($command = new LintCommand())
46+
->getApplication()
47+
->setDefaultCommand($command->getName(), true)
48+
->run()
49+
;

‎src/Symfony/Component/Yaml/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/composer.json
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
"/Tests/"
3535
]
3636
},
37+
"bin": [
38+
"Resources/bin/yaml-lint"
39+
],
3740
"minimum-stability": "dev",
3841
"extra": {
3942
"branch-alias": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.