sspooky13 / yaml-alphabetical-checker
YAML alphabetical checker
Requires
- php: ~5.6 || ~7.0
- sebastian/diff: ~1.4
- symfony/console: ~3.0
- symfony/yaml: ~3.0
Requires (Dev)
- phing/phing: 2.16.*
- phpunit/phpunit: 5.7.* || 6.4.*
- shopsys/coding-standards: 3.1.*
This package is auto-updated.
Last update: 2020-04-19 16:23:50 UTC
README
This repository is unmaintained and deprecated. I recommend yaml standards repository
This library helps you to keep YAML files alphabetically sorted.
Requirements
Works with minimal requirement:
- PHP 5.6 or higher
- symfony/console version 3.0
- symfony/yaml version 3.0
- sebastian/diff version 1.4
Installation
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" } }
Options for run
--exclude=text
Exclude file contains thetext
in name. Can be used more times.
Usage
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>
PHPStorm Integration
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 codes
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).