2012-11-06 08:09:36 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once dirname(__FILE__).'/../__init_script__.php';
|
|
|
|
|
2012-11-09 03:37:15 +01:00
|
|
|
$synopsis = <<<EOT
|
|
|
|
**save_lint.php**
|
|
|
|
Discover lint problems and save them to database so that they can
|
|
|
|
be displayed in Diffusion.
|
|
|
|
|
|
|
|
EOT;
|
|
|
|
|
|
|
|
$args = id(new PhutilArgumentParser($argv))
|
|
|
|
->setTagline('save lint errors to database')
|
|
|
|
->setSynopsis($synopsis)
|
|
|
|
->parseStandardArguments()
|
|
|
|
->parse(array(
|
|
|
|
array(
|
|
|
|
'name' => 'all',
|
|
|
|
'help' =>
|
2014-06-09 20:36:49 +02:00
|
|
|
'Discover problems in the whole repository instead of just changes '.
|
|
|
|
'since the last run.',
|
2012-11-09 03:37:15 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'arc',
|
|
|
|
'param' => 'path',
|
|
|
|
'default' => 'arc',
|
2014-06-09 20:36:49 +02:00
|
|
|
'help' => 'Path to Arcanist executable.',
|
2012-11-09 03:37:15 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'severity',
|
|
|
|
'param' => 'string',
|
|
|
|
'default' => ArcanistLintSeverity::SEVERITY_ADVICE,
|
2014-06-09 20:36:49 +02:00
|
|
|
'help' => 'Minimum severity, one of ArcanistLintSeverity constants.',
|
2012-11-09 03:37:15 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => 'chunk-size',
|
|
|
|
'param' => 'number',
|
|
|
|
'default' => 256,
|
2014-06-09 20:36:49 +02:00
|
|
|
'help' => 'Number of paths passed to `arc` at once.',
|
2012-11-09 03:37:15 +01:00
|
|
|
),
|
2013-03-05 01:22:30 +01:00
|
|
|
array(
|
|
|
|
'name' => 'blame',
|
2014-06-09 20:36:49 +02:00
|
|
|
'help' => 'Assign lint errors to authors who last modified the line.',
|
2013-03-05 01:22:30 +01:00
|
|
|
),
|
2012-11-09 03:37:15 +01:00
|
|
|
));
|
|
|
|
|
|
|
|
echo "Saving lint errors to database...\n";
|
|
|
|
|
|
|
|
$count = id(new DiffusionLintSaveRunner())
|
|
|
|
->setAll($args->getArg('all', false))
|
|
|
|
->setArc($args->getArg('arc'))
|
|
|
|
->setSeverity($args->getArg('severity'))
|
|
|
|
->setChunkSize($args->getArg('chunk-size'))
|
2013-03-05 01:22:30 +01:00
|
|
|
->setNeedsBlame($args->getArg('blame'))
|
2012-11-09 03:37:15 +01:00
|
|
|
->run('.');
|
|
|
|
|
|
|
|
echo "\nProcessed {$count} files.\n";
|