Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Forked from raulfraile/yamllint.php
Created October 20, 2016 08:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mickaelandrieu/7f60e516f95000055b81fd6199d84740 to your computer and use it in GitHub Desktop.
YAML linter
<?php
<<<CONFIG
packages:
- "symfony/yaml: ~2.3"
CONFIG;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
$content = file_get_contents($argv[1]);
$parser = new Parser();
try {
$parser->parse($content);
} catch (ParseException $e) {
echo $e->getMessage();
return 1;
}
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment