@@ -39,15 +39,15 @@ class LintCommand extends Command
39
39
private $ displayCorrectFiles ;
40
40
private $ directoryIteratorProvider ;
41
41
private $ isReadableProvider ;
42
- private $ linterConfig ;
42
+ private $ lintConfig ;
43
43
44
- public function __construct (string $ name = null , callable $ directoryIteratorProvider = null , callable $ isReadableProvider = null , string $ linterConfig = '.yamllinter .yml ' )
44
+ public function __construct (string $ name = null , callable $ directoryIteratorProvider = null , callable $ isReadableProvider = null , string $ lintConfig = '.yamllint .yml ' )
45
45
{
46
46
parent ::__construct ($ name );
47
47
48
48
$ this ->directoryIteratorProvider = $ directoryIteratorProvider ;
49
49
$ this ->isReadableProvider = $ isReadableProvider ;
50
- $ this ->linterConfig = $ linterConfig ;
50
+ $ this ->lintConfig = $ lintConfig ;
51
51
}
52
52
53
53
/**
@@ -57,7 +57,7 @@ protected function configure()
57
57
{
58
58
$ this
59
59
->setDescription ('Lints a file and outputs encountered errors ' )
60
- ->addArgument ('filename ' , InputArgument::IS_ARRAY , 'A file, a ' .$ this ->linterConfig .' config, a directory or "-" for reading from STDIN ' )
60
+ ->addArgument ('filename ' , InputArgument::IS_ARRAY , 'A file, a ' .$ this ->lintConfig .' config, a directory or "-" for reading from STDIN ' )
61
61
->addOption ('format ' , null , InputOption::VALUE_REQUIRED , 'The output format ' )
62
62
->addOption ('exclude ' , null , InputOption::VALUE_REQUIRED , 'Files to exclude ' )
63
63
->addOption ('parse-tags ' , null , InputOption::VALUE_NONE , 'Parse custom tags ' )
@@ -71,7 +71,7 @@ protected function configure()
71
71
72
72
You can validate YAML contents passed from config file:
73
73
74
- <info>php %command.full_name% .yamllinter .yml</info>
74
+ <info>php %command.full_name% .yamllint .yml</info>
75
75
76
76
You can also validate the syntax of a file:
77
77
@@ -107,12 +107,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
107
107
$ this ->displayCorrectFiles = $ output ->isVerbose ();
108
108
$ flags = $ input ->getOption ('parse-tags ' ) ? Yaml::PARSE_CUSTOM_TAGS : 0 ;
109
109
110
- if ([$ this ->linterConfig ] === $ filenames ) {
110
+ if ([$ this ->lintConfig ] === $ filenames ) {
111
111
if (!file_exists ($ filenames [0 ])) {
112
- throw new RuntimeException (sprintf ('Linter configuration file "%s" not found ' , $ filenames [0 ]));
112
+ throw new RuntimeException (sprintf ('Lint config "%s" not found ' , $ filenames [0 ]));
113
113
}
114
114
115
- $ config = $ this ->parseLinterConfig ($ filenames [0 ]);
115
+ $ config = $ this ->parseLintConfig ($ filenames [0 ]);
116
116
117
117
$ this ->format = $ config ['format ' ] ?? $ this ->format ;
118
118
$ flags = $ config['parse-tags ' ] ?? $ flags ;
@@ -293,15 +293,15 @@ private function isReadable(string $fileOrDirectory): bool
293
293
return $ default ($ fileOrDirectory );
294
294
}
295
295
296
- private function parseLinterConfig (string $ config ): array
296
+ private function parseLintConfig (string $ config ): array
297
297
{
298
298
$ result = (new Parser ())
299
299
->parseFile ($ config );
300
300
301
- if (!isset ($ result ['yamllinter ' ])) {
302
- throw new RuntimeException (sprintf ('Invalid YAML linter config "%s". ' , $ config ));
301
+ if (!isset ($ result ['yaml-lint ' ])) {
302
+ throw new RuntimeException (sprintf ('Invalid YAML lint config "%s". ' , $ config ));
303
303
}
304
304
305
- return $ result ['yamllinter ' ];
305
+ return $ result ['yaml-lint ' ];
306
306
}
307
307
}
0 commit comments