@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1#!/usr/bin/env php
2<?php
3
4require_once dirname(__FILE__).'/../__init_script__.php';
5
6$synopsis = pht(<<<EOT
7**save_lint.php**
8 Discover lint problems and save them to database so that they can
9 be displayed in Diffusion.
10
11EOT
12);
13
14$args = id(new PhutilArgumentParser($argv))
15 ->setTagline(pht('save lint errors to database'))
16 ->setSynopsis($synopsis)
17 ->parseStandardArguments()
18 ->parse(array(
19 array(
20 'name' => 'all',
21 'help' => pht(
22 'Discover problems in the whole repository instead of just changes '.
23 'since the last run.'),
24 ),
25 array(
26 'name' => 'arc',
27 'param' => 'path',
28 'default' => 'arc',
29 'help' => pht('Path to Arcanist executable.'),
30 ),
31 array(
32 'name' => 'severity',
33 'param' => 'string',
34 'default' => ArcanistLintSeverity::SEVERITY_ADVICE,
35 'help' => pht(
36 'Minimum severity, one of %s constants.',
37 'ArcanistLintSeverity'),
38 ),
39 array(
40 'name' => 'chunk-size',
41 'param' => 'number',
42 'default' => 256,
43 'help' => pht('Number of paths passed to `%s` at once.', 'arc'),
44 ),
45 array(
46 'name' => 'blame',
47 'help' => pht(
48 'Assign lint errors to authors who last modified the line.'),
49 ),
50 ));
51
52echo pht('Saving lint errors to database...')."\n";
53
54$count = id(new DiffusionLintSaveRunner())
55 ->setAll($args->getArg('all', false))
56 ->setArc($args->getArg('arc'))
57 ->setSeverity($args->getArg('severity'))
58 ->setChunkSize($args->getArg('chunk-size'))
59 ->setNeedsBlame($args->getArg('blame'))
60 ->run('.');
61
62echo "\n".pht('Processed %d files.', $count)."\n";