-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathphpcs-check-feature-completeness
63 lines (59 loc) · 2.69 KB
/
phpcs-check-feature-completeness
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env php
<?php
/**
* Validate that each sniff is complete, i.e. has unit tests and documentation.
*
* This script should be run from the root of a PHPCS standards repo and can
* be used both on PHPCS itself as well as by external standards.
*
* Usage:
* phpcs-check-feature-completeness
* phpcs-check-feature-completeness [-q] [--exclude=<dir>] [directories]
*
* Options:
* directories <dir> One or more specific directories to examine.
* Defaults to the directory from which the script is run.
* -q, --quiet Turn off warnings for missing documentation and orphaned
* files.
* Equivalent to running with "--no-docs --no-orphans".
* --exclude=<dir1,dir2> Comma-delimited list of (relative) directories to
* exclude from the scan.
* Defaults to excluding the /vendor/ directory.
* --no-docs Disable missing documentation check.
* --no-orphans Disable orphaned files check.
* --no-progress Disable progress in console output.
* --colors Enable colors in console output.
* (disables auto detection of color support).
* --no-colors Disable colors in console output.
* -v Verbose mode.
* -h, --help Print this help.
* -V, --version Display the current version of this script.
*
* @package PHPCSDevTools
* @copyright 2019 PHPCSDevTools Contributors
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
* @link https://github.com/PHPCSStandards/PHPCSDevTools
*/
$autoloadLocations = [
__DIR__ . '/../devtools-autoload.php', // Git clone or direct run from within vendor package directory.
__DIR__ . '/../phpcsstandards/phpcsdevtools/devtools-autoload.php', // Composer bin dir install.
__DIR__ . '/../autoload.php', // Try Composer autoload from a bin dir install.
__DIR__ . '/../../../autoload.php', // Try Composer autoload from within vendor package directory.
__DIR__ . '/../vendor/autoload.php', // Try Composer autoload from a git clone install.
];
// Try and find a usable autoload file.
foreach ($autoloadLocations as $file) {
$file = realpath($file);
if ($file !== false && is_file($file) === true) {
require_once($file);
break;
}
}
$writer = new PHPCSDevTools\Scripts\Utils\CliWriter();
$config = new PHPCSDevTools\Scripts\FeatureComplete\Config($writer);
if ($config->executeCheck === false) {
// This was a help request or version check.
exit(0);
}
$validate = new PHPCSDevTools\Scripts\FeatureComplete\Check($config, $writer);
exit($validate->validate());