This repository is unmaintained and deprecated. I recommend yaml standards repository
This library helps you to keep YAML files alphabetically sorted.
Works with minimal requirement:
- PHP 5.6 or higher
- symfony/console version 3.0
- symfony/yaml version 3.0
- sebastian/diff version 1.4
If you prefer using Composer you can easily install with the following command:
composer require --dev sspooky13/yaml-alphabetical-checker
Or alternatively, include a dependency for sspooky13/yaml-alphabetical-checker in your composer.json file. For example:
{
"require-dev": {
"sspooky13/yaml-alphabetical-checker": "~2.0"
}
}
--exclude=text
Exclude file contains thetext
in name. Can be used more times.
For run from command line:
./bin/yaml-alphabetical-checker ./app ./src/path/to/config/file.yml ./src --exclude=serv --exclude=conf
If you need exclude a files from check, you can print command --exclude=NAME
how much you want.
or setting for ANT:
<property name="path.yaml-alphabetical-checker" value="./vendor/bin/yaml-alphabetical-checker"/>
<target name="yaml-alphabetical-checker" description="Run yaml alphabetical checker">
<exec
executable="${path.yaml-alphabetical-checker}"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="./app" />
<arg value="./src/path/to/config/file.yml" />
<arg value="./src" />
<arg value="--exclude=serv" />
<arg value="--exclude=conf" />
</exec>
</target>
You can integrate YAML alphabetical checker into PHPStorm by using File Watcher.
- Open Settings -> Tools -> File Watchers
- Add new -> custom
- Give it a name
- Select file type:
YAML
- Program:
\vendor\bin\yaml-alphabetical-checker.bat
- Arguments:
$FilePath$
for check actual opened file or$SourcepathEntry$
for check all source file, etc.
Now, file watcher check YAML files, whether is right alphabetically sorted and will open the console if they have errors
Exit code is built using following bit flags:
0 OK.
1 Some file is unsorted.
2 General error (file is not readable, error with parse yaml file).