-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdump_rules.php
More file actions
executable file
·32 lines (25 loc) · 884 Bytes
/
dump_rules.php
File metadata and controls
executable file
·32 lines (25 loc) · 884 Bytes
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
<?php
/**
* This PHP script is useful to dump rules descriptions into Markdown,
* so that it's easier to open PRs with descriptive content aimed at
* adding new rules to this repository ruleset.
*
* Launching this script with no options will dump all rules which are
* not already enabled.
*
* TODO: Launching it with arguments will dump the listed rules.
*/
use Facile\CodingStandardsTest\RulesMaintenance\Dumper;
require __DIR__ . '/vendor/autoload.php';
$output = __DIR__ . '/dump_rules.md';
@unlink($output);
$dumper = new Dumper();
foreach ($dumper->getUnlistedRulesDescription(true) as $ruleName => $ruleDescription) {
if (str_starts_with($ruleName, 'warning')) {
echo $ruleDescription;
} else {
echo 'dumping rule ' . $ruleName . '...' . \PHP_EOL;
file_put_contents($output, $ruleDescription, \FILE_APPEND);
}
}
echo 'Done';