mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 14:22:40 +01:00
Remove @group
annotations
Summary: I'm pretty sure that `@group` annotations are useless now... I believe that they were originally used by Diviner? Test Plan: Eye-balled it. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin, aurelijus Differential Revision: https://secure.phabricator.com/D9855
This commit is contained in:
parent
b09d21d878
commit
d09beeb75c
123 changed files with 347 additions and 575 deletions
|
@ -11,7 +11,6 @@
|
|||
* When looking in these places, we expect to find a 'libphutil/' directory.
|
||||
*/
|
||||
function arcanist_adjust_php_include_path() {
|
||||
|
||||
// The 'arcanist/' directory.
|
||||
$arcanist_dir = dirname(dirname(__FILE__));
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* - add new flags to existing workflows by overriding
|
||||
* getCustomArgumentsForCommand().
|
||||
*
|
||||
* @group config
|
||||
* @concrete-extensible
|
||||
*/
|
||||
class ArcanistConfiguration {
|
||||
|
@ -65,8 +64,11 @@ class ArcanistConfiguration {
|
|||
// This is a hook.
|
||||
}
|
||||
|
||||
public function didRunWorkflow($command, ArcanistBaseWorkflow $workflow,
|
||||
$err) {
|
||||
public function didRunWorkflow(
|
||||
$command,
|
||||
ArcanistBaseWorkflow $workflow,
|
||||
$err) {
|
||||
|
||||
// This is a hook.
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* This class holds everything related to configuration and configuration files.
|
||||
*
|
||||
* @group config
|
||||
*/
|
||||
final class ArcanistConfigurationManager {
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group config
|
||||
*/
|
||||
final class ArcanistSettings {
|
||||
|
||||
private function getOptions() {
|
||||
|
@ -167,7 +164,7 @@ final class ArcanistSettings {
|
|||
'type' => 'bool',
|
||||
'help' =>
|
||||
'Whether arc should permit the automatic stashing of changes in '.
|
||||
'the working directory when requiring a clean working copy. '.
|
||||
'the working directory when requiring a clean working copy. '.
|
||||
'This option should only be used when users understand how '.
|
||||
'to restore their working directory from the local stash if '.
|
||||
'an Arcanist operation causes an unrecoverable error.',
|
||||
|
@ -329,5 +326,4 @@ final class ArcanistSettings {
|
|||
return $value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ final class ArcanistBritishTestCase extends ArcanistTestCase {
|
|||
"Correction of {$input} against: {$commands}");
|
||||
}
|
||||
|
||||
|
||||
public function testArgumentCompletion() {
|
||||
$this->assertArgumentCompletion(
|
||||
array('nolint'),
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Dumping ground for diff- and diff-algorithm-related miscellany.
|
||||
*
|
||||
* @group diff
|
||||
*/
|
||||
final class ArcanistDiffUtils {
|
||||
|
||||
|
|
|
@ -2,71 +2,70 @@
|
|||
|
||||
/**
|
||||
* Test cases for @{class:ArcanistDiffUtils}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
||||
|
||||
public function testLevenshtein() {
|
||||
$tests = array(
|
||||
array(
|
||||
'a',
|
||||
'b',
|
||||
'x'
|
||||
'x',
|
||||
),
|
||||
array(
|
||||
'kalrmr(array($b))',
|
||||
'array($b)',
|
||||
'dddddddssssssssds'
|
||||
'dddddddssssssssds',
|
||||
),
|
||||
array(
|
||||
'array($b)',
|
||||
'kalrmr(array($b))',
|
||||
'iiiiiiissssssssis'
|
||||
'iiiiiiissssssssis',
|
||||
),
|
||||
array(
|
||||
'zkalrmr(array($b))z',
|
||||
'xarray($b)x',
|
||||
'dddddddxsssssssssdx'
|
||||
'dddddddxsssssssssdx',
|
||||
),
|
||||
array(
|
||||
'xarray($b)x',
|
||||
'zkalrmr(array($b))z',
|
||||
'iiiiiiixsssssssssix'
|
||||
'iiiiiiixsssssssssix',
|
||||
),
|
||||
array(
|
||||
'abcdefghi',
|
||||
'abcdefghi',
|
||||
'sssssssss'
|
||||
'sssssssss',
|
||||
),
|
||||
array(
|
||||
'abcdefghi',
|
||||
'abcdefghijkl',
|
||||
'sssssssssiii'
|
||||
'sssssssssiii',
|
||||
),
|
||||
array(
|
||||
'abcdefghijkl',
|
||||
'abcdefghi',
|
||||
'sssssssssddd'
|
||||
'sssssssssddd',
|
||||
),
|
||||
array(
|
||||
'xyzabcdefghi',
|
||||
'abcdefghi',
|
||||
'dddsssssssss'
|
||||
'dddsssssssss',
|
||||
),
|
||||
array(
|
||||
'abcdefghi',
|
||||
'xyzabcdefghi',
|
||||
'iiisssssssss'
|
||||
'iiisssssssss',
|
||||
),
|
||||
array(
|
||||
'abcdefg',
|
||||
'abxdxfg',
|
||||
'ssxsxss'
|
||||
'ssxsxss',
|
||||
),
|
||||
array(
|
||||
'private function a($a, $b) {',
|
||||
'public function and($b, $c) {',
|
||||
'siixsdddxsssssssssssiissxsssxsss'
|
||||
'siixsdddxsssssssssssiissxsssxsss',
|
||||
),
|
||||
array(
|
||||
|
||||
|
@ -121,9 +120,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = '';
|
||||
$right = '';
|
||||
$result = array(
|
||||
array(array(0, 0)),
|
||||
array(array(0, 0))
|
||||
);
|
||||
array(array(0, 0)),
|
||||
array(array(0, 0)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -132,9 +131,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = '';
|
||||
$right = "Grumpy\xE2\x98\x83at";
|
||||
$result = array(
|
||||
array(array(0, 0)),
|
||||
array(array(0, 11))
|
||||
);
|
||||
array(array(0, 0)),
|
||||
array(array(0, 11)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -143,9 +142,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = "Grumpy\xE2\x98\x83at";
|
||||
$right = '';
|
||||
$result = array(
|
||||
array(array(0, 11)),
|
||||
array(array(0, 0))
|
||||
);
|
||||
array(array(0, 11)),
|
||||
array(array(0, 0)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -154,9 +153,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = "Grumpy\xE2\x98\x83at";
|
||||
$right = "Grumpy\xE2\x98\x83at";
|
||||
$result = array(
|
||||
array(array(0, 11)),
|
||||
array(array(0, 11))
|
||||
);
|
||||
array(array(0, 11)),
|
||||
array(array(0, 11)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -165,9 +164,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = "Grumpy\xE2\x98\x83at";
|
||||
$right = 'Smiling Dog';
|
||||
$result = array(
|
||||
array(array(1, 11)),
|
||||
array(array(1, 11))
|
||||
);
|
||||
array(array(1, 11)),
|
||||
array(array(1, 11)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -176,9 +175,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = 'GrumpyCat';
|
||||
$right = "Grumpy\xE2\x98\x83at";
|
||||
$result = array(
|
||||
array(array(0, 6), array(1, 1), array(0, 2)),
|
||||
array(array(0, 6), array(1, 3), array(0, 2))
|
||||
);
|
||||
array(array(0, 6), array(1, 1), array(0, 2)),
|
||||
array(array(0, 6), array(1, 3), array(0, 2)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -187,9 +186,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = 'GrumpyCat';
|
||||
$right = "Grumpy\xE2\x98\x83a\xE2\x98\x83t";
|
||||
$result = array(
|
||||
array(array(0, 6), array(1, 2), array(0, 1)),
|
||||
array(array(0, 6), array(1, 7), array(0, 1))
|
||||
);
|
||||
array(array(0, 6), array(1, 2), array(0, 1)),
|
||||
array(array(0, 6), array(1, 7), array(0, 1)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -198,9 +197,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = "GrumpyC\xE2\x98\x83t";
|
||||
$right = "DrumpyC\xE2\x98\x83t";
|
||||
$result = array(
|
||||
array(array(1, 1), array(0, 10)),
|
||||
array(array(1, 1), array(0, 10))
|
||||
);
|
||||
array(array(1, 1), array(0, 10)),
|
||||
array(array(1, 1), array(0, 10)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -209,9 +208,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = "GrumpyC\xE2\x98\x83t";
|
||||
$right = "GrumpyC\xE2\x98\x83P";
|
||||
$result = array(
|
||||
array(array(0, 10), array(1, 1)),
|
||||
array(array(0, 10), array(1, 1))
|
||||
);
|
||||
array(array(0, 10), array(1, 1)),
|
||||
array(array(0, 10), array(1, 1)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -220,9 +219,9 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = "GrumpyC\xE2\x98\x83t";
|
||||
$right = "DrumpyC\xE2\x98\x83P";
|
||||
$result = array(
|
||||
array(array(1, 1), array(0, 9), array(1, 1)),
|
||||
array(array(1, 1), array(0, 9), array(1, 1))
|
||||
);
|
||||
array(array(1, 1), array(0, 9), array(1, 1)),
|
||||
array(array(1, 1), array(0, 9), array(1, 1)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
|
@ -232,11 +231,12 @@ final class ArcanistDiffUtilsTestCase extends ArcanistTestCase {
|
|||
$left = 'Senor';
|
||||
$right = "Sen{$cc}or";
|
||||
$result = array(
|
||||
array(array(0, 2), array(1, 1), array(0, 2)),
|
||||
array(array(0, 2), array(1, 3), array(0, 2))
|
||||
);
|
||||
array(array(0, 2), array(1, 1), array(0, 2)),
|
||||
array(array(0, 2), array(1, 3), array(0, 2)),
|
||||
);
|
||||
$this->assertEqual(
|
||||
$result,
|
||||
ArcanistDiffUtils::generateIntralineDiff($left, $right));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Represents a parsed commit message.
|
||||
*
|
||||
* @group differential
|
||||
*/
|
||||
final class ArcanistDifferentialCommitMessage {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Thrown when a commit message isn't parseable.
|
||||
*
|
||||
* @group differential
|
||||
*/
|
||||
final class ArcanistDifferentialCommitMessageParserException extends Exception {
|
||||
|
||||
|
|
|
@ -12,4 +12,5 @@ final class ArcanistEventType extends PhutilEventType {
|
|||
const TYPE_REVISION_WILLCREATEREVISION = 'revision.willCreateRevision';
|
||||
|
||||
const TYPE_LAND_WILLPUSHREVISION = 'land.willPushRevision';
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,5 @@
|
|||
|
||||
/**
|
||||
* Thrown when the user chooses an invalid revision when prompted by a workflow.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistChooseInvalidRevisionException extends Exception {
|
||||
|
||||
}
|
||||
final class ArcanistChooseInvalidRevisionException extends Exception {}
|
||||
|
|
|
@ -3,9 +3,5 @@
|
|||
/**
|
||||
* Thrown when there are no valid revisions to choose from, in a workflow which
|
||||
* prompts the user to choose a revision.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistChooseNoRevisionsException extends Exception {
|
||||
|
||||
}
|
||||
final class ArcanistChooseNoRevisionsException extends Exception {}
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
* Thrown when there is a problem with how a user is invoking a command, rather
|
||||
* than a technical problem.
|
||||
*
|
||||
* @group workflow
|
||||
* @concrete-extensible
|
||||
*/
|
||||
class ArcanistUsageException extends Exception {
|
||||
|
||||
}
|
||||
class ArcanistUsageException extends Exception {}
|
||||
|
|
|
@ -3,8 +3,5 @@
|
|||
/**
|
||||
* Thrown when lint or unit tests have no effect, i.e. no paths are affected
|
||||
* by any linter or no unit tests provide coverage.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistNoEffectException extends ArcanistUsageException {
|
||||
}
|
||||
final class ArcanistNoEffectException extends ArcanistUsageException {}
|
||||
|
|
|
@ -2,8 +2,5 @@
|
|||
|
||||
/**
|
||||
* Thrown when no engine is configured for linting or running unit tests.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistNoEngineException extends ArcanistUsageException {
|
||||
}
|
||||
final class ArcanistNoEngineException extends ArcanistUsageException {}
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
/**
|
||||
* Thrown when the user chooses not to continue when warned that they're about
|
||||
* to do something dangerous.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistUserAbortException extends ArcanistUsageException {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct('User aborted the workflow.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Client for an @{class:ArcanistHgProxyServer}. This client talks to a PHP
|
||||
* process which serves as a proxy in front of a Mercurial server process.
|
||||
|
|
|
@ -446,7 +446,6 @@ final class ArcanistHgProxyServer {
|
|||
}
|
||||
|
||||
private function daemonize() {
|
||||
|
||||
// Keep stdout if it's been redirected somewhere, otherwise shut it down.
|
||||
$keep_stdout = false;
|
||||
$keep_stderr = false;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Message emitted by a linter, like an error or warning.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintMessage {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Applies lint patches to the working copy.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintPatcher {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* A group of @{class:ArcanistLintMessage}s that apply to a file.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintResult {
|
||||
|
||||
|
@ -101,7 +99,6 @@ final class ArcanistLintResult {
|
|||
|
||||
$this->effectiveMessages = $messages;
|
||||
$this->needsSort = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Describes the severity of an @{class:ArcanistLintMessage}.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintSeverity {
|
||||
|
||||
|
@ -34,7 +32,6 @@ final class ArcanistLintSeverity {
|
|||
}
|
||||
|
||||
public static function isAtLeastAsSevere($message_sev, $level) {
|
||||
|
||||
static $map = array(
|
||||
self::SEVERITY_DISABLED => 10,
|
||||
self::SEVERITY_ADVICE => 20,
|
||||
|
@ -50,5 +47,4 @@ final class ArcanistLintSeverity {
|
|||
return $map[$message_sev] >= idx($map, $level, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
* See @{article@phabricator:Arcanist User Guide: Customizing Lint, Unit Tests
|
||||
* and Workflows} for more information about configuring lint engines.
|
||||
*
|
||||
* @group lint
|
||||
* @stable
|
||||
*/
|
||||
abstract class ArcanistLintEngine {
|
||||
|
@ -385,8 +384,10 @@ abstract class ArcanistLintEngine {
|
|||
return ArcanistLintSeverity::isAtLeastAsSevere($severity, $minimum);
|
||||
}
|
||||
|
||||
final private function shouldUseCache($cache_granularity,
|
||||
$repository_version) {
|
||||
final private function shouldUseCache(
|
||||
$cache_granularity,
|
||||
$repository_version) {
|
||||
|
||||
if ($this->commitHookMode) {
|
||||
return false;
|
||||
}
|
||||
|
@ -580,5 +581,4 @@ abstract class ArcanistLintEngine {
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
*
|
||||
* Set which linter should be run by configuring `lint.engine.single.linter` in
|
||||
* `.arcconfig` or user config.
|
||||
*
|
||||
* @group linter
|
||||
*/
|
||||
final class ArcanistSingleLintEngine extends ArcanistLintEngine {
|
||||
|
||||
|
@ -60,4 +58,5 @@ final class ArcanistSingleLintEngine extends ArcanistLintEngine {
|
|||
|
||||
return array($linter);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Basic lint engine which just applies several linters based on the file types
|
||||
*
|
||||
* @group linter
|
||||
* Basic lint engine which just applies several linters based on the file types.
|
||||
*/
|
||||
final class ComprehensiveLintEngine extends ArcanistLintEngine {
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
/**
|
||||
* Lint engine for use in constructing test cases. See
|
||||
* @{class:ArcanistLinterTestCase}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class UnitTestableArcanistLintEngine extends ArcanistLintEngine {
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
|
|||
throw new Exception(
|
||||
"In order to keep StyleCop integration with IDEs and other tools ".
|
||||
"consistent with Arcanist results, you aren't permitted to ".
|
||||
"disable StyleCop rules within '.arclint'. ".
|
||||
"disable StyleCop rules within '.arclint'. ".
|
||||
"Instead configure the severity using the StyleCop settings dialog ".
|
||||
"(usually accessible from within your IDE). StyleCop settings ".
|
||||
"(usually accessible from within your IDE). StyleCop settings ".
|
||||
"for your project will be used when linting for Arcanist.");
|
||||
}
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Determines what executables and lint paths to use. Between platforms
|
||||
* this also changes whether the lint engine is run under .NET or Mono. It
|
||||
* Determines what executables and lint paths to use. Between platforms
|
||||
* this also changes whether the lint engine is run under .NET or Mono. It
|
||||
* also ensures that all of the required binaries are available for the lint
|
||||
* to run successfully.
|
||||
*
|
||||
|
@ -112,18 +112,18 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
|
|||
list($err, $stdout, $stderr) = $ver_future->resolve();
|
||||
if ($err !== 0) {
|
||||
throw new Exception(
|
||||
'You are running an old version of cslint. Please '.
|
||||
'You are running an old version of cslint. Please '.
|
||||
'upgrade to version '.self::SUPPORTED_VERSION.'.');
|
||||
}
|
||||
$ver = (int)$stdout;
|
||||
if ($ver < self::SUPPORTED_VERSION) {
|
||||
throw new Exception(
|
||||
'You are running an old version of cslint. Please '.
|
||||
'You are running an old version of cslint. Please '.
|
||||
'upgrade to version '.self::SUPPORTED_VERSION.'.');
|
||||
} else if ($ver > self::SUPPORTED_VERSION) {
|
||||
throw new Exception(
|
||||
'Arcanist does not support this version of cslint (it is '.
|
||||
'newer). You can try upgrading Arcanist with `arc upgrade`.');
|
||||
'newer). You can try upgrading Arcanist with `arc upgrade`.');
|
||||
}
|
||||
|
||||
$this->loaded = true;
|
||||
|
@ -149,11 +149,11 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
|
|||
}
|
||||
if ($total + strlen($path) > 6000) {
|
||||
// %s won't pass through the JSON correctly
|
||||
// under Windows. This is probably because not only
|
||||
// under Windows. This is probably because not only
|
||||
// does the JSON have quotation marks in the content,
|
||||
// but because there'll be a lot of escaping and
|
||||
// double escaping because the JSON also contains
|
||||
// regular expressions. cslint supports passing the
|
||||
// regular expressions. cslint supports passing the
|
||||
// settings JSON through base64-encoded to mitigate
|
||||
// this issue.
|
||||
$futures[] = new ExecFuture(
|
||||
|
|
|
@ -85,18 +85,17 @@ final class ArcanistConduitLinter extends ArcanistLinter {
|
|||
// customization directly.
|
||||
throw new ArcanistUsageException(
|
||||
'ArcanistConduitLinter does not support client-side severity '.
|
||||
'customization.'
|
||||
);
|
||||
'customization.');
|
||||
}
|
||||
|
||||
public function getLintNameMap() {
|
||||
// See getLintSeverityMap for rationale.
|
||||
throw new ArcanistUsageException(
|
||||
'ArcanistConduitLinter does not support a name map.'
|
||||
);
|
||||
'ArcanistConduitLinter does not support a name map.');
|
||||
}
|
||||
|
||||
protected function canCustomizeLintSeverities() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,4 +93,5 @@ final class ArcanistJSONLintLinter extends ArcanistExternalLinter {
|
|||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* Implements lint rules, like syntax checks for a specific language.
|
||||
*
|
||||
* @task info Human Readable Information
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
abstract class ArcanistLinter {
|
||||
|
|
|
@ -50,4 +50,5 @@ final class ArcanistMergeConflictLinter extends ArcanistLinter {
|
|||
self::LINT_MERGECONFLICT => pht('Unresolved merge conflict'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Uses "PHP_CodeSniffer" to detect checkstyle errors in PHP code.
|
||||
*
|
||||
* @group linter
|
||||
*/
|
||||
final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
||||
|
||||
|
|
|
@ -103,4 +103,5 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
|
|||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,20 +48,18 @@
|
|||
* (E) error, for probable bugs in the code
|
||||
* (F) fatal, if an error occurred which prevented pylint from
|
||||
* doing further processing.
|
||||
*
|
||||
* @group linter
|
||||
*/
|
||||
final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||
|
||||
private function getMessageCodeSeverity($code) {
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
|
||||
$error_regexp =
|
||||
$config->getConfigFromAnySource('lint.pylint.codes.error');
|
||||
$warning_regexp =
|
||||
$config->getConfigFromAnySource('lint.pylint.codes.warning');
|
||||
$advice_regexp =
|
||||
$config->getConfigFromAnySource('lint.pylint.codes.advice');
|
||||
$error_regexp = $config->getConfigFromAnySource(
|
||||
'lint.pylint.codes.error');
|
||||
$warning_regexp = $config->getConfigFromAnySource(
|
||||
'lint.pylint.codes.warning');
|
||||
$advice_regexp = $config->getConfigFromAnySource(
|
||||
'lint.pylint.codes.advice');
|
||||
|
||||
if (!$error_regexp && !$warning_regexp && !$advice_regexp) {
|
||||
throw new ArcanistUsageException(
|
||||
|
|
|
@ -152,8 +152,6 @@
|
|||
* @task linterinfo Linter Information
|
||||
* @task parse Parsing Output
|
||||
* @task config Validating Configuration
|
||||
*
|
||||
* @group linter
|
||||
*/
|
||||
final class ArcanistScriptAndRegexLinter extends ArcanistLinter {
|
||||
|
||||
|
|
|
@ -2084,7 +2084,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
|
||||
/**
|
||||
* preg_quote() takes two arguments, but the second one is optional because
|
||||
* it is possible to use (), [] or {} as regular expression delimiters. If
|
||||
* it is possible to use (), [] or {} as regular expression delimiters. If
|
||||
* you don't pass a second argument, you're probably going to get something
|
||||
* wrong.
|
||||
*/
|
||||
|
@ -2248,7 +2248,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
|
||||
/**
|
||||
* Finds duplicate keys in array initializers, as in
|
||||
* array(1 => 'anything', 1 => 'foo'). Since the first entry is ignored,
|
||||
* array(1 => 'anything', 1 => 'foo'). Since the first entry is ignored,
|
||||
* this is almost certainly an error.
|
||||
*/
|
||||
private function lintDuplicateKeysInArray(XHPASTNode $root) {
|
||||
|
|
|
@ -195,4 +195,5 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
|||
$actual,
|
||||
'File as patched by lint did not match the expected patched file.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* @task override Overriding Symbol Name Lint Messages
|
||||
* @task util Name Utilities
|
||||
* @task internal Internals
|
||||
* @group lint
|
||||
* @stable
|
||||
*/
|
||||
abstract class ArcanistXHPASTLintNamingHook {
|
||||
|
@ -114,8 +113,8 @@ abstract class ArcanistXHPASTLintNamingHook {
|
|||
* @task util
|
||||
*/
|
||||
public static function stripPHPFunction($symbol) {
|
||||
// Allow initial "__" for magic methods like __construct; we could also
|
||||
// enumerate these explicitly.
|
||||
// Allow initial "__" for magic methods like __construct; we could also
|
||||
// enumerate these explicitly.
|
||||
return preg_replace('/^__/', '', $symbol);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
/**
|
||||
* You can extend this class and set `xhpast.switchhook` in your `.arclint`
|
||||
* to have an opportunity to override results for linting `switch` statements.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
abstract class ArcanistXHPASTLintSwitchHook {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Test cases for @{class:ArcanistXHPASTLintNamingHook}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class ArcanistXHPASTLintNamingHookTestCase extends ArcanistTestCase {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Shows lint messages to the user.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintCheckstyleXMLRenderer extends ArcanistLintRenderer {
|
||||
|
||||
|
@ -53,4 +51,5 @@ final class ArcanistLintCheckstyleXMLRenderer extends ArcanistLintRenderer {
|
|||
$this->writer->endDocument();
|
||||
return $this->writer->flush();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
/**
|
||||
* Shows lint messages to the user.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
|
||||
|
||||
private $showAutofixPatches = false;
|
||||
|
||||
public function setShowAutofixPatches($show_autofix_patches) {
|
||||
|
@ -234,7 +233,8 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
|
|||
}
|
||||
|
||||
public function renderOkayResult() {
|
||||
return
|
||||
phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
return phutil_console_format(
|
||||
"<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
/**
|
||||
* Shows lint messages to the user.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintJSONRenderer extends ArcanistLintRenderer {
|
||||
|
||||
const LINES_OF_CONTEXT = 3;
|
||||
|
||||
public function renderLintResult(ArcanistLintResult $result) {
|
||||
|
@ -32,4 +31,5 @@ final class ArcanistLintJSONRenderer extends ArcanistLintRenderer {
|
|||
public function renderOkayResult() {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
/**
|
||||
* Shows lint messages to the user.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintLikeCompilerRenderer extends ArcanistLintRenderer {
|
||||
|
||||
public function renderLintResult(ArcanistLintResult $result) {
|
||||
$lines = array();
|
||||
$messages = $result->getMessages();
|
||||
|
@ -32,4 +31,5 @@ final class ArcanistLintLikeCompilerRenderer extends ArcanistLintRenderer {
|
|||
public function renderOkayResult() {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintNoneRenderer extends ArcanistLintRenderer {
|
||||
|
||||
public function renderLintResult(ArcanistLintResult $result) {
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Shows lint messages to the user.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
abstract class ArcanistLintRenderer {
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
/**
|
||||
* Shows lint messages to the user.
|
||||
*
|
||||
* @group lint
|
||||
*/
|
||||
final class ArcanistLintSummaryRenderer extends ArcanistLintRenderer {
|
||||
|
||||
public function renderLintResult(ArcanistLintResult $result) {
|
||||
$messages = $result->getMessages();
|
||||
$path = $result->getPath();
|
||||
|
@ -24,7 +23,8 @@ final class ArcanistLintSummaryRenderer extends ArcanistLintRenderer {
|
|||
}
|
||||
|
||||
public function renderOkayResult() {
|
||||
return
|
||||
phutil_console_format("<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
return phutil_console_format(
|
||||
"<bg:green>** OKAY **</bg> No lint warnings.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -91,7 +91,6 @@ final class ArcanistBaseCommitParser {
|
|||
* Handle resolving individual rules.
|
||||
*/
|
||||
private function resolveRule($rule, $source) {
|
||||
|
||||
// NOTE: Returning `null` from this method means "no match".
|
||||
// Returning `false` from this method means "stop current ruleset".
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Converts changesets between different formats.
|
||||
*
|
||||
* @group diff
|
||||
*/
|
||||
final class ArcanistBundle {
|
||||
|
||||
|
@ -108,7 +106,6 @@ final class ArcanistBundle {
|
|||
}
|
||||
|
||||
private function getEOL($patch_type) {
|
||||
|
||||
// NOTE: Git always generates "\n" line endings, even under Windows, and
|
||||
// can not parse certain patches with "\r\n" line endings. SVN generates
|
||||
// patches with "\n" line endings on Mac or Linux and "\r\n" line endings
|
||||
|
@ -198,9 +195,7 @@ final class ArcanistBundle {
|
|||
return $obj;
|
||||
}
|
||||
|
||||
private function __construct() {
|
||||
|
||||
}
|
||||
private function __construct() {}
|
||||
|
||||
public function writeToDisk($path) {
|
||||
$changes = $this->getChanges();
|
||||
|
@ -260,7 +255,6 @@ final class ArcanistBundle {
|
|||
}
|
||||
|
||||
public function toUnifiedDiff() {
|
||||
|
||||
$eol = $this->getEOL('unified');
|
||||
|
||||
$result = array();
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Parses diffs from a working copy.
|
||||
*
|
||||
* @group diff
|
||||
*/
|
||||
final class ArcanistDiffParser {
|
||||
|
||||
|
@ -453,7 +451,6 @@ final class ArcanistDiffParser {
|
|||
}
|
||||
|
||||
private function parseSVNPropertyChange($op, $prop) {
|
||||
|
||||
$old = array();
|
||||
$new = array();
|
||||
|
||||
|
@ -1378,7 +1375,6 @@ final class ArcanistDiffParser {
|
|||
* Returns a parseable normal diff and a textual commit message.
|
||||
*/
|
||||
private function stripGitFormatPatch($diff) {
|
||||
|
||||
// We can parse this by splitting it into two pieces over and over again
|
||||
// along different section dividers:
|
||||
//
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Test cases for @{class:ArcanistDiffParser}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class ArcanistDiffParserTestCase extends ArcanistTestCase {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Represents a change to an individual path.
|
||||
*
|
||||
* @group diff
|
||||
*/
|
||||
final class ArcanistDiffChange {
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
/**
|
||||
* Defines constants for file types and operations in changesets.
|
||||
*
|
||||
* @group diff
|
||||
*/
|
||||
final class ArcanistDiffChangeType {
|
||||
|
||||
const TYPE_ADD = 1;
|
||||
const TYPE_CHANGE = 2;
|
||||
const TYPE_DELETE = 3;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Represents a contiguous set of added and removed lines in a diff.
|
||||
*
|
||||
* @group diff
|
||||
*/
|
||||
final class ArcanistDiffHunk {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Interfaces with Git working copies.
|
||||
*
|
||||
* @group workingcopy
|
||||
*/
|
||||
final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||
|
||||
|
@ -24,7 +22,6 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
}
|
||||
|
||||
protected function buildLocalFuture(array $argv) {
|
||||
|
||||
$argv[0] = 'git '.$argv[0];
|
||||
|
||||
$future = newv('ExecFuture', $argv);
|
||||
|
@ -547,8 +544,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
'svn find-rev %s',
|
||||
$input);
|
||||
if (!$stdout) {
|
||||
throw new ArcanistUsageException("Cannot find the {$vcs} equivalent "
|
||||
."of {$input}.");
|
||||
throw new ArcanistUsageException(
|
||||
"Cannot find the {$vcs} equivalent of {$input}.");
|
||||
}
|
||||
// When git performs a partial-rebuild during svn
|
||||
// look-up, we need to parse the final line
|
||||
|
@ -834,7 +831,6 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
}
|
||||
|
||||
private function getFileDataAtRevision($path, $revision) {
|
||||
|
||||
// NOTE: We don't want to just "git show {$revision}:{$path}" since if the
|
||||
// path was a directory at the given revision we'll get a list of its files
|
||||
// and treat it as though it as a file containing a list of other files,
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Interfaces with the Mercurial working copies.
|
||||
*
|
||||
* @group workingcopy
|
||||
*/
|
||||
final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
||||
|
||||
|
@ -15,7 +13,6 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
private $supportsPhases;
|
||||
|
||||
protected function buildLocalFuture(array $argv) {
|
||||
|
||||
// Mercurial has a "defaults" feature which basically breaks automation by
|
||||
// allowing the user to add random flags to any command. This feature is
|
||||
// "deprecated" and "a bad idea" that you should "forget ... existed"
|
||||
|
@ -82,8 +79,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
'{node}',
|
||||
$string);
|
||||
if (!$stdout) {
|
||||
throw new ArcanistUsageException("Cannot find the HG equivalent "
|
||||
."of {$revision_id} given.");
|
||||
throw new ArcanistUsageException(
|
||||
"Cannot find the HG equivalent of {$revision_id} given.");
|
||||
}
|
||||
return $stdout;
|
||||
}
|
||||
|
@ -94,8 +91,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
list($stdout) = $this->execxLocal(
|
||||
'log -r %s --template {svnrev}', $hash);
|
||||
if (!$stdout) {
|
||||
throw new ArcanistUsageException("Cannot find the SVN equivalent "
|
||||
."of {$hash} given.");
|
||||
throw new ArcanistUsageException(
|
||||
"Cannot find the SVN equivalent of {$hash} given.");
|
||||
}
|
||||
return $stdout;
|
||||
}
|
||||
|
@ -128,13 +125,14 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
hgsprintf('ancestor(%R,.)', $symbolic_commit));
|
||||
} catch (Exception $ex) {
|
||||
throw new ArcanistUsageException(
|
||||
"Commit '{$symbolic_commit}' is not a valid Mercurial commit ".
|
||||
"identifier.");
|
||||
"Commit '{$symbolic_commit}' is not a valid Mercurial commit ".
|
||||
"identifier.");
|
||||
}
|
||||
}
|
||||
|
||||
$this->setBaseCommitExplanation('it is the greatest common ancestor of '.
|
||||
'the working directory and the commit you specified explicitly.');
|
||||
$this->setBaseCommitExplanation(
|
||||
'it is the greatest common ancestor of the working directory '.
|
||||
'and the commit you specified explicitly.');
|
||||
return $commit;
|
||||
}
|
||||
|
||||
|
@ -161,7 +159,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
} else {
|
||||
list($err, $stdout) = $this->execManualLocal(
|
||||
'outgoing --branch %s --style default',
|
||||
$this->getBranchName());
|
||||
$this->getBranchName());
|
||||
}
|
||||
|
||||
if (!$err) {
|
||||
|
@ -464,7 +462,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
private function getBulkFileDataAtRevision($paths, $revision) {
|
||||
// Calling 'hg cat' on each file individually is slow (1 second per file
|
||||
// on a large repo) because mercurial has to decompress and parse the
|
||||
// entire manifest every time. Do it in one large batch instead.
|
||||
// entire manifest every time. Do it in one large batch instead.
|
||||
|
||||
// hg cat will write the file data to files in a temp directory
|
||||
$tmpdir = Filesystem::createTemporaryDirectory();
|
||||
|
@ -731,10 +729,10 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse the Mercurial author field
|
||||
* Parse the Mercurial author field.
|
||||
*
|
||||
* Not everyone enters their email address as a part of the username
|
||||
* field. Try to make it work when it's obvious
|
||||
* field. Try to make it work when it's obvious.
|
||||
*
|
||||
* @param string $full_author
|
||||
* @return array
|
||||
|
@ -762,9 +760,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
public function doCommit($message) {
|
||||
$tmp_file = new TempFile();
|
||||
Filesystem::writeFile($tmp_file, $message);
|
||||
$this->execxLocal(
|
||||
'commit -l %s',
|
||||
$tmp_file);
|
||||
$this->execxLocal('commit -l %s', $tmp_file);
|
||||
$this->reloadWorkingCopy();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* Interfaces with the VCS in the working copy.
|
||||
*
|
||||
* @task status Path Status
|
||||
* @group workingcopy
|
||||
*/
|
||||
abstract class ArcanistRepositoryAPI {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Interfaces with Subversion working copies.
|
||||
*
|
||||
* @group workingcopy
|
||||
*/
|
||||
final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
|
||||
|
||||
|
@ -25,7 +23,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
|
|||
static $svn_dir = null;
|
||||
if ($svn_dir === null) {
|
||||
// from svn 1.7, subversion keeps a single .svn directly under
|
||||
// the working copy root. However, we allow .arcconfigs that
|
||||
// the working copy root. However, we allow .arcconfigs that
|
||||
// aren't at the working copy root.
|
||||
foreach (Filesystem::walkToRoot($this->getPath()) as $parent) {
|
||||
$possible_svn_dir = Filesystem::resolvePath('.svn', $parent);
|
||||
|
@ -316,7 +314,6 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
|
|||
}
|
||||
|
||||
public function getSVNInfo($path) {
|
||||
|
||||
if (empty($this->svnInfo[$path])) {
|
||||
|
||||
if (empty($this->svnInfoRaw[$path])) {
|
||||
|
|
|
@ -120,5 +120,4 @@ final class ArcanistRepositoryAPIStateTestCase extends ArcanistTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* API while running in the context of a commit hook
|
||||
* API while running in the context of a commit hook.
|
||||
*/
|
||||
abstract class ArcanistHookAPI {
|
||||
abstract public function getCurrentFileData($path);
|
||||
|
|
|
@ -32,4 +32,5 @@ final class ArcanistSubversionHookAPI extends ArcanistHookAPI {
|
|||
$this->root."/$path");
|
||||
return ($err ? null : $file);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* provides low-level APIs for reading "hg" output.
|
||||
*
|
||||
* @task parse Parsing "hg" Output
|
||||
* @group workingcopy
|
||||
*/
|
||||
final class ArcanistMercurialParser {
|
||||
|
||||
|
|
|
@ -85,4 +85,5 @@ final class ArcanistMercurialParserTestCase extends ArcanistTestCase {
|
|||
throw new Exception("No test information for test data '{$name}'!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Represents the outcome of running a unit test.
|
||||
*
|
||||
* @group unit
|
||||
*/
|
||||
final class ArcanistUnitTestResult {
|
||||
|
||||
|
@ -78,8 +76,8 @@ final class ArcanistUnitTestResult {
|
|||
}
|
||||
|
||||
/**
|
||||
* "extra data" allows an implementation to store additional
|
||||
* key/value metadata along with the result of the test run.
|
||||
* "extra data" allows an implementation to store additional key/value
|
||||
* metadata along with the result of the test run.
|
||||
*/
|
||||
public function setExtraData(array $extra_data = null) {
|
||||
$this->extraData = $extra_data;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Abstract Base class for test result parsers
|
||||
* Abstract Base class for test result parsers.
|
||||
*/
|
||||
abstract class ArcanistBaseTestResultParser {
|
||||
|
||||
|
@ -12,25 +12,21 @@ abstract class ArcanistBaseTestResultParser {
|
|||
|
||||
public function setEnableCoverage($enable_coverage) {
|
||||
$this->enableCoverage = $enable_coverage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setProjectRoot($project_root) {
|
||||
$this->projectRoot = $project_root;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCoverageFile($coverage_file) {
|
||||
$this->coverageFile = $coverage_file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAffectedTests($affected_tests) {
|
||||
$this->affectedTests = $affected_tests;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -49,4 +45,5 @@ abstract class ArcanistBaseTestResultParser {
|
|||
* @return array ArcanistUnitTestResult
|
||||
*/
|
||||
abstract public function parseTestResults($path, $test_results);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Manages unit test execution.
|
||||
*
|
||||
* @group unit
|
||||
*/
|
||||
abstract class ArcanistBaseUnitTestEngine {
|
||||
|
||||
|
@ -105,12 +103,13 @@ abstract class ArcanistBaseUnitTestEngine {
|
|||
abstract public function run();
|
||||
|
||||
/**
|
||||
* Modify the return value of this function in the child class, if
|
||||
* you do not need to echo the test results after all the tests have
|
||||
* been run. This is the case for example when the child class
|
||||
* prints the tests results while the tests are running.
|
||||
* Modify the return value of this function in the child class, if you do
|
||||
* not need to echo the test results after all the tests have been run. This
|
||||
* is the case for example when the child class prints the tests results
|
||||
* while the tests are running.
|
||||
*/
|
||||
public function shouldEchoTestResults() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
|
||||
/**
|
||||
* Parser for JUnit, NUnit, etc results format - https://gist.github.com/959290
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
final class ArcanistXUnitTestResultParser {
|
||||
|
||||
/**
|
||||
* Parse test results from provided input and return an array
|
||||
* of ArcanistUnitTestResult
|
||||
* of @{class:ArcanistUnitTestResult}.
|
||||
*
|
||||
* @param string $test_results String containing test results
|
||||
*
|
||||
|
@ -42,7 +40,7 @@ final class ArcanistXUnitTestResultParser {
|
|||
$user_data = '';
|
||||
|
||||
// A skipped test is a test which was ignored using framework
|
||||
// mechanizms (e.g. @skip decorator)
|
||||
// mechanisms (e.g. @skip decorator)
|
||||
$skipped = $testcase->getElementsByTagName('skipped');
|
||||
if ($skipped->length > 0) {
|
||||
$status = ArcanistUnitTestResult::RESULT_SKIP;
|
||||
|
@ -55,7 +53,7 @@ final class ArcanistXUnitTestResultParser {
|
|||
}
|
||||
|
||||
// Failure is a test which the code has explicitly failed by using
|
||||
// the mechanizms for that purpose. e.g., via an assertEquals
|
||||
// the mechanisms for that purpose. e.g., via an assertEquals
|
||||
$failures = $testcase->getElementsByTagName('failure');
|
||||
if ($failures->length > 0) {
|
||||
$status = ArcanistUnitTestResult::RESULT_FAIL;
|
||||
|
@ -68,8 +66,7 @@ final class ArcanistXUnitTestResultParser {
|
|||
}
|
||||
|
||||
// An errored test is one that had an unanticipated problem. e.g., an
|
||||
// unchecked throwable, or a problem with an implementation of the
|
||||
// test.
|
||||
// unchecked throwable, or a problem with an implementation of the test.
|
||||
$errors = $testcase->getElementsByTagName('error');
|
||||
if ($errors->length > 0) {
|
||||
$status = ArcanistUnitTestResult::RESULT_BROKEN;
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
* This engine inherits from `XUnitTestEngine`, where xUnit is used to actually
|
||||
* run the unit tests and this class provides a thin layer on top to collect
|
||||
* code coverage data with a third-party tool.
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
|
||||
final class CSharpToolsTestEngine extends XUnitTestEngine {
|
||||
|
||||
private $cscoverHintPath;
|
||||
|
@ -19,19 +16,17 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
private $excludedFiles;
|
||||
|
||||
/**
|
||||
* Overridden version of `loadEnvironment` to support a different set
|
||||
* of configuration values and to pull in the cstools config for
|
||||
* code coverage.
|
||||
* Overridden version of `loadEnvironment` to support a different set of
|
||||
* configuration values and to pull in the cstools config for code coverage.
|
||||
*/
|
||||
protected function loadEnvironment() {
|
||||
|
||||
$config = $this->getConfigurationManager();
|
||||
$this->cscoverHintPath =
|
||||
$config->getConfigFromAnySource('unit.csharp.cscover.binary');
|
||||
$this->matchRegex =
|
||||
$config->getConfigFromAnySource('unit.csharp.coverage.match');
|
||||
$this->excludedFiles =
|
||||
$config->getConfigFromAnySource('unit.csharp.coverage.excluded');
|
||||
$this->cscoverHintPath = $config->getConfigFromAnySource(
|
||||
'unit.csharp.cscover.binary');
|
||||
$this->matchRegex = $config->getConfigFromAnySource(
|
||||
'unit.csharp.coverage.match');
|
||||
$this->excludedFiles = $config->getConfigFromAnySource(
|
||||
'unit.csharp.coverage.excluded');
|
||||
|
||||
parent::loadEnvironment();
|
||||
|
||||
|
@ -42,7 +37,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
// Determine coverage path.
|
||||
if ($this->cscoverHintPath === null) {
|
||||
throw new Exception(
|
||||
"Unable to locate cscover. Configure it with ".
|
||||
"Unable to locate cscover. Configure it with ".
|
||||
"the `unit.csharp.coverage.binary' option in .arcconfig");
|
||||
}
|
||||
$cscover = $this->projectRoot.DIRECTORY_SEPARATOR.$this->cscoverHintPath;
|
||||
|
@ -50,15 +45,13 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
$this->coverEngine = Filesystem::resolvePath($cscover);
|
||||
} else {
|
||||
throw new Exception(
|
||||
'Unable to locate cscover coverage runner '.
|
||||
'(have you built yet?)');
|
||||
'Unable to locate cscover coverage runner (have you built yet?)');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the specified assembly should be instrumented for
|
||||
* code coverage reporting. Checks the excluded file list and the
|
||||
* code coverage reporting. Checks the excluded file list and the
|
||||
* matching regex if they are configured.
|
||||
*
|
||||
* @return boolean Whether the assembly should be instrumented.
|
||||
|
@ -93,7 +86,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
}
|
||||
|
||||
// FIXME: Can't use TempFile here as xUnit doesn't like
|
||||
// UNIX-style full paths. It sees the leading / as the
|
||||
// UNIX-style full paths. It sees the leading / as the
|
||||
// start of an option flag, even when quoted.
|
||||
$xunit_temp = Filesystem::readRandomCharacters(10).'.results.xml';
|
||||
if (file_exists($xunit_temp)) {
|
||||
|
@ -158,7 +151,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the cached results for a coverage result file. The coverage
|
||||
* Retrieves the cached results for a coverage result file. The coverage
|
||||
* result file is XML and can be large depending on what has been instrumented
|
||||
* so we cache it in case it's requested again.
|
||||
*
|
||||
|
@ -189,7 +182,7 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a set of XML tags as code coverage results. We parse
|
||||
* Processes a set of XML tags as code coverage results. We parse
|
||||
* the `instrumented` and `executed` tags with this method so that
|
||||
* we can access the data multiple times without a performance hit.
|
||||
*
|
||||
|
@ -283,4 +276,5 @@ final class CSharpToolsTestEngine extends XUnitTestEngine {
|
|||
$this->addCachedResults($cover_file, $reports);
|
||||
return $reports;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,7 @@
|
|||
/**
|
||||
* Go Test Result Parsing utility
|
||||
*
|
||||
* Intended to enable custom unit engines derived
|
||||
* from Go's built-in test utility to reuse
|
||||
* common business logic related to parsing
|
||||
* Go test results.
|
||||
*
|
||||
* (To generate test output, run something like:
|
||||
* `go test -v`)
|
||||
* (To generate test output, run something like: `go test -v`)
|
||||
*/
|
||||
final class GoTestResultParser extends ArcanistBaseTestResultParser {
|
||||
|
||||
|
@ -23,7 +17,6 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
|
|||
* @return array
|
||||
*/
|
||||
public function parseTestResults($path, $test_results) {
|
||||
|
||||
$test_results = explode("\n", $test_results);
|
||||
|
||||
$results = array();
|
||||
|
@ -137,4 +130,5 @@ final class GoTestResultParser extends ArcanistBaseTestResultParser {
|
|||
|
||||
return $test_case_results;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,10 @@
|
|||
* Very basic 'nose' unit test engine wrapper.
|
||||
*
|
||||
* Requires nose 1.1.3 for code coverage.
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
|
||||
|
||||
public function run() {
|
||||
|
||||
$paths = $this->getPaths();
|
||||
|
||||
$affected_tests = array();
|
||||
|
@ -52,9 +49,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
$xunit_tmp = new TempFile();
|
||||
$cover_tmp = new TempFile();
|
||||
|
||||
$future = $this->buildTestFuture($test_path,
|
||||
$xunit_tmp,
|
||||
$cover_tmp);
|
||||
$future = $this->buildTestFuture($test_path, $xunit_tmp, $cover_tmp);
|
||||
|
||||
$futures[$test_path] = $future;
|
||||
$tmpfiles[$test_path] = array(
|
||||
|
@ -91,9 +86,9 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
$xunit_tmp);
|
||||
|
||||
if ($this->getEnableCoverage() !== false) {
|
||||
$cmd_line .= csprintf(' --with-coverage --cover-xml '.
|
||||
'--cover-xml-file=%s',
|
||||
$cover_tmp);
|
||||
$cmd_line .= csprintf(
|
||||
' --with-coverage --cover-xml --cover-xml-file=%s',
|
||||
$cover_tmp);
|
||||
}
|
||||
|
||||
return new ExecFuture('%C %s', $cmd_line, $path);
|
||||
|
|
|
@ -3,13 +3,8 @@
|
|||
/**
|
||||
* PHPUnit Result Parsing utility
|
||||
*
|
||||
* Intended to enable custom unit engines derived
|
||||
* from phpunit to reuse common business logic related
|
||||
* to parsing phpunit test results and reports
|
||||
*
|
||||
* For an example on how to integrate with your test
|
||||
* engine, see PhpunitTestEngine.
|
||||
*
|
||||
* For an example on how to integrate with your test engine, see
|
||||
* @{class:PhpunitTestEngine}.
|
||||
*/
|
||||
final class PhpunitResultParser extends ArcanistBaseTestResultParser {
|
||||
|
||||
|
@ -22,7 +17,6 @@ final class PhpunitResultParser extends ArcanistBaseTestResultParser {
|
|||
* @return array
|
||||
*/
|
||||
public function parseTestResults($path, $test_results) {
|
||||
|
||||
if (!$test_results) {
|
||||
$result = id(new ArcanistUnitTestResult())
|
||||
->setName($path)
|
||||
|
@ -163,7 +157,6 @@ final class PhpunitResultParser extends ArcanistBaseTestResultParser {
|
|||
* valid.
|
||||
*
|
||||
* @param string $json String containing JSON report
|
||||
*
|
||||
* @return array JSON decoded array
|
||||
*/
|
||||
private function getJsonReport($json) {
|
||||
|
@ -186,4 +179,5 @@ final class PhpunitResultParser extends ArcanistBaseTestResultParser {
|
|||
|
||||
return $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPUnit wrapper
|
||||
*
|
||||
* To use, set unit.engine in .arcconfig, or use --engine flag
|
||||
* with arc unit. Currently supports only class & test files
|
||||
* (no directory support).
|
||||
* To use custom phpunit configuration, set phpunit_config in
|
||||
* .arcconfig (e.g. app/phpunit.xml.dist).
|
||||
*
|
||||
* @group unitrun
|
||||
* PHPUnit wrapper.
|
||||
*/
|
||||
final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||
|
||||
|
@ -19,7 +11,6 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
private $projectRoot;
|
||||
|
||||
public function run() {
|
||||
|
||||
$this->projectRoot = $this->getWorkingCopy()->getProjectRoot();
|
||||
$this->affectedTests = array();
|
||||
foreach ($this->getPaths() as $path) {
|
||||
|
@ -79,8 +70,6 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
'json' => $json_tmp,
|
||||
'clover' => $clover_tmp,
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
@ -99,7 +88,7 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse test results from phpunit json report
|
||||
* Parse test results from phpunit json report.
|
||||
*
|
||||
* @param string $path Path to test
|
||||
* @param string $json_tmp Path to phpunit json report
|
||||
|
@ -257,8 +246,8 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tries to find and update phpunit configuration file
|
||||
* based on phpunit_config option in .arcconfig
|
||||
* Tries to find and update phpunit configuration file based on
|
||||
* `phpunit_config` option in `.arcconfig`.
|
||||
*/
|
||||
private function prepareConfigFile() {
|
||||
$project_root = $this->projectRoot.DIRECTORY_SEPARATOR;
|
||||
|
@ -284,4 +273,5 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Very basic unit test engine which runs libphutil tests.
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Very basic 'py.test' unit test engine wrapper.
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
|
||||
|
||||
|
@ -27,12 +25,13 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
public function buildTestFuture($junit_tmp, $cover_tmp) {
|
||||
$paths = $this->getPaths();
|
||||
|
||||
$cmd_line = csprintf('py.test --junitxml %s',
|
||||
$junit_tmp);
|
||||
$cmd_line = csprintf('py.test --junitxml %s', $junit_tmp);
|
||||
|
||||
if ($this->getEnableCoverage() !== false) {
|
||||
$cmd_line = csprintf('coverage run --source %s -m %C',
|
||||
$this->project_root, $cmd_line);
|
||||
if ($this->getEnableCoverage() !== false) {
|
||||
$cmd_line = csprintf(
|
||||
'coverage run --source %s -m %C',
|
||||
$this->project_root,
|
||||
$cmd_line);
|
||||
}
|
||||
|
||||
return new ExecFuture('%C', $cmd_line);
|
||||
|
@ -132,4 +131,5 @@ final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
|
||||
return $reports;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* that the test assembly that verifies the functionality of `SomeAssembly` is
|
||||
* located at `SomeAssembly.Tests`.
|
||||
*
|
||||
* @group unitrun
|
||||
* @concrete-extensible
|
||||
*/
|
||||
class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||
|
@ -27,10 +26,10 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Determines what executables and test paths to use. Between platforms
|
||||
* this also changes whether the test engine is run under .NET or Mono. It
|
||||
* also ensures that all of the required binaries are available for the tests
|
||||
* to run successfully.
|
||||
* Determines what executables and test paths to use. Between platforms this
|
||||
* also changes whether the test engine is run under .NET or Mono. It also
|
||||
* ensures that all of the required binaries are available for the tests to
|
||||
* run successfully.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -78,14 +77,14 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
$this->testEngine = 'xunit.console.clr4.exe';
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Unable to locate xUnit console runner. Configure ".
|
||||
"Unable to locate xUnit console runner. Configure ".
|
||||
"it with the `unit.csharp.xunit.binary' option in .arcconfig");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entry point for the test engine. Determines what assemblies to
|
||||
* build and test based on the files that have changed.
|
||||
* Main entry point for the test engine. Determines what assemblies to build
|
||||
* and test based on the files that have changed.
|
||||
*
|
||||
* @return array Array of test results.
|
||||
*/
|
||||
|
@ -137,7 +136,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
if (!$exists) {
|
||||
$results[] = array(
|
||||
'project' => $project,
|
||||
'assembly' => $assembly);
|
||||
'assembly' => $assembly,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
|
||||
/**
|
||||
* If the `Build` directory exists, we assume that this is a multi-platform
|
||||
* project that requires generation of C# project files. Because we want to
|
||||
* project that requires generation of C# project files. Because we want to
|
||||
* test that the generation and subsequent build is whole, we need to
|
||||
* regenerate any projects in case the developer has added files through an
|
||||
* IDE and then forgotten to add them to the respective `.definitions` file.
|
||||
|
@ -202,7 +202,6 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
* @return array Array of test results.
|
||||
*/
|
||||
private function generateProjects() {
|
||||
|
||||
// No "Build" directory; so skip generation of projects.
|
||||
if (!is_dir(Filesystem::resolvePath($this->projectRoot.'/Build'))) {
|
||||
return array();
|
||||
|
@ -255,7 +254,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
|
||||
/**
|
||||
* Build the projects relevant for the specified test assemblies and return
|
||||
* the results of the builds as test results. This build also passes the
|
||||
* the results of the builds as test results. This build also passes the
|
||||
* "SkipTestsOnBuild" parameter when building the projects, so that MSBuild
|
||||
* conditionals can be used to prevent any tests running as part of the
|
||||
* build itself (since the unit tester is about to run each of the tests
|
||||
|
@ -302,9 +301,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
}
|
||||
|
||||
/**
|
||||
* Build the future for running a unit test. This can be
|
||||
* overridden to enable support for code coverage via
|
||||
* another tool
|
||||
* Build the future for running a unit test. This can be overridden to enable
|
||||
* support for code coverage via another tool.
|
||||
*
|
||||
* @param string Name of the test assembly.
|
||||
* @return array The future, output filename and coverage filename
|
||||
|
@ -312,7 +310,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
*/
|
||||
protected function buildTestFuture($test_assembly) {
|
||||
// FIXME: Can't use TempFile here as xUnit doesn't like
|
||||
// UNIX-style full paths. It sees the leading / as the
|
||||
// UNIX-style full paths. It sees the leading / as the
|
||||
// start of an option flag, even when quoted.
|
||||
$xunit_temp = Filesystem::readRandomCharacters(10).'.results.xml';
|
||||
if (file_exists($xunit_temp)) {
|
||||
|
@ -340,7 +338,6 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
* @return array Array of test results.
|
||||
*/
|
||||
private function testAssemblies(array $test_assemblies) {
|
||||
|
||||
$results = array();
|
||||
|
||||
// Build the futures for running the tests.
|
||||
|
@ -368,13 +365,12 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
} else {
|
||||
// FIXME: There's a bug in Mono which causes a segmentation fault
|
||||
// when xUnit.NET runs; this causes the XML file to not appear
|
||||
// (depending on when the segmentation fault occurs). See
|
||||
// (depending on when the segmentation fault occurs). See
|
||||
// https://bugzilla.xamarin.com/show_bug.cgi?id=16379
|
||||
// for more information.
|
||||
|
||||
// Since it's not possible for the user to correct this error, we
|
||||
// ignore the fact the tests didn't run here.
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,8 +379,8 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
|
||||
/**
|
||||
* Returns null for this implementation as xUnit does not support code
|
||||
* coverage directly. Override this method in another class to provide
|
||||
* code coverage information (also see `CSharpToolsUnitEngine`).
|
||||
* coverage directly. Override this method in another class to provide code
|
||||
* coverage information (also see @{class:CSharpToolsUnitEngine}).
|
||||
*
|
||||
* @param string The name of the coverage file if one was provided by
|
||||
* `buildTestFuture`.
|
||||
|
@ -399,7 +395,7 @@ class XUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
*
|
||||
* @param string The name of the xUnit results file.
|
||||
* @param string The name of the coverage file if one was provided by
|
||||
* `buildTestFuture`. This is passed through to
|
||||
* `buildTestFuture`. This is passed through to
|
||||
* `parseCoverageResult`.
|
||||
* @return array Test results.
|
||||
*/
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
/**
|
||||
* Test for @{class:GoTestResultParser}.
|
||||
*
|
||||
* (putting tests in your tests so you can test
|
||||
* while you test)
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class GoTestResultParserTestCase extends ArcanistTestCase {
|
||||
|
||||
|
@ -107,4 +102,5 @@ final class GoTestResultParserTestCase extends ArcanistTestCase {
|
|||
$result->getResult());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,13 +2,10 @@
|
|||
|
||||
/**
|
||||
* Tests for @{class:PHPUnitTestEngine}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class PHPUnitTestEngineTestCase extends ArcanistTestCase {
|
||||
|
||||
public function testSearchLocations() {
|
||||
|
||||
$path = '/path/to/some/file/X.php';
|
||||
|
||||
$this->assertEqual(
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Very meta test for @{class:PhutilUnitTestEngine}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class PhutilUnitTestEngineTestCase extends ArcanistTestCase {
|
||||
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
/**
|
||||
* Test for @{class:ArcanistXUnitTestResultParser}.
|
||||
*
|
||||
* (putting tests in your tests so you can test
|
||||
* while you test)
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class XUnitTestResultParserTestCase extends ArcanistTestCase {
|
||||
|
||||
|
|
|
@ -388,9 +388,7 @@ abstract class ArcanistPhutilTestCase {
|
|||
*
|
||||
* @task internal
|
||||
*/
|
||||
final public function __construct() {
|
||||
|
||||
}
|
||||
final public function __construct() {}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Test for @{class:PhutilUnitTestEngineTestCase}.
|
||||
*
|
||||
* @group testcase
|
||||
*/
|
||||
final class ArcanistPhutilTestCaseTestCase extends ArcanistPhutilTestCase {
|
||||
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
/**
|
||||
* Thrown to skip test execution.
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
final class ArcanistPhutilTestSkippedException extends Exception {}
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
/**
|
||||
* Thrown to prematurely end test execution.
|
||||
*
|
||||
* @group unitrun
|
||||
*/
|
||||
final class ArcanistPhutilTestTerminatedException extends Exception {}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
final class ArcanistUnitConsoleRenderer extends ArcanistUnitRenderer {
|
||||
|
||||
public function renderUnitResult(ArcanistUnitTestResult $result) {
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
abstract class ArcanistUnitRenderer {
|
||||
|
||||
abstract public function renderUnitResult(ArcanistUnitTestResult $result);
|
||||
abstract public function renderPostponedResult($count);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Manages aliases for commands with options.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistAliasWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistAnoidWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
public function getWorkflowName() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* Runs git revert and assigns hi pri task to original author
|
||||
* @group workflow
|
||||
*/
|
||||
|
||||
/**
|
||||
* Runs git revert and assigns a high priority task to original author.
|
||||
*/
|
||||
final class ArcanistBackoutWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
private $console;
|
||||
private $conduit;
|
||||
private $revision;
|
||||
|
@ -49,7 +49,9 @@ EOTEXT
|
|||
return true;
|
||||
}
|
||||
|
||||
// Given a differential revision ID, fetches the commit ID
|
||||
/**
|
||||
* Given a differential revision ID, fetches the commit ID.
|
||||
*/
|
||||
private function getCommitIDFromRevisionID($revision_id) {
|
||||
$conduit = $this->getConduit();
|
||||
$revisions = $conduit->callMethodSynchronous(
|
||||
|
@ -81,8 +83,10 @@ EOTEXT
|
|||
return $commit_id;
|
||||
}
|
||||
|
||||
// Fetches an array of commit info provided a Commit_id
|
||||
// in the form of rE123456 (not local commit hash)
|
||||
/**
|
||||
* Fetches an array of commit info provided a Commit_id in the form of
|
||||
* rE123456 (not local commit hash).
|
||||
*/
|
||||
private function getDiffusionCommit($commit_id) {
|
||||
$result = $this->getConduit()->callMethodSynchronous(
|
||||
'diffusion.getcommits',
|
||||
|
@ -97,15 +101,18 @@ EOTEXT
|
|||
return $commit;
|
||||
}
|
||||
|
||||
// Retrieves default template from differential and prefills info
|
||||
/**
|
||||
* Retrieves default template from differential and pre-fills info.
|
||||
*/
|
||||
private function buildCommitMessage($commit_hash) {
|
||||
$conduit = $this->getConduit();
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
|
||||
$summary = $repository_api->getBackoutMessage($commit_hash);
|
||||
$fields = array('summary' => $summary,
|
||||
'testPlan' => 'revert-hammer',
|
||||
);
|
||||
$fields = array(
|
||||
'summary' => $summary,
|
||||
'testPlan' => 'revert-hammer',
|
||||
);
|
||||
$template = $conduit->callMethodSynchronous(
|
||||
'differential.getcommitmessage',
|
||||
array(
|
||||
|
@ -119,7 +126,9 @@ EOTEXT
|
|||
return $template;
|
||||
}
|
||||
|
||||
// Performs the backout/revert of a revision and creates a commit
|
||||
/**
|
||||
* Performs the backout/revert of a revision and creates a commit.
|
||||
*/
|
||||
public function run() {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$conduit = $this->getConduit();
|
||||
|
@ -128,7 +137,7 @@ EOTEXT
|
|||
$is_git_svn = $repository_api instanceof ArcanistGitAPI &&
|
||||
$repository_api->isGitSubversionRepo();
|
||||
$is_hg_svn = $repository_api instanceof ArcanistMercurialAPI &&
|
||||
$repository_api->isHgSubversionRepo();
|
||||
$repository_api->isHgSubversionRepo();
|
||||
$revision_id = null;
|
||||
|
||||
if (!($repository_api instanceof ArcanistGitAPI) &&
|
||||
|
@ -163,8 +172,8 @@ EOTEXT
|
|||
$commit_hash = $input[0];
|
||||
}
|
||||
if (!$repository_api->hasLocalCommit($commit_hash)) {
|
||||
throw new ArcanistUsageException('Invalid commit provided or does not'.
|
||||
'exist in the working copy!');
|
||||
throw new ArcanistUsageException(
|
||||
'Invalid commit provided or does not exist in the working copy!');
|
||||
}
|
||||
|
||||
// Run 'backout'.
|
||||
|
@ -177,6 +186,6 @@ EOTEXT
|
|||
$message = $this->buildCommitMessage($commit_hash);
|
||||
$repository_api->doCommit($message);
|
||||
$console->writeOut("Double-check the commit and push when ready\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,9 +76,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
|
|||
private $changeCache = array();
|
||||
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
|
||||
abstract public function run();
|
||||
|
@ -320,12 +318,14 @@ abstract class ArcanistBaseWorkflow extends Phobject {
|
|||
}
|
||||
|
||||
if (empty($credentials['user'])) {
|
||||
throw new ConduitClientException('ERR-INVALID-USER',
|
||||
'Empty user in credentials.');
|
||||
throw new ConduitClientException(
|
||||
'ERR-INVALID-USER',
|
||||
'Empty user in credentials.');
|
||||
}
|
||||
if (empty($credentials['certificate'])) {
|
||||
throw new ConduitClientException('ERR-NO-CERTIFICATE',
|
||||
'Empty certificate in credentials.');
|
||||
throw new ConduitClientException(
|
||||
'ERR-NO-CERTIFICATE',
|
||||
'Empty certificate in credentials.');
|
||||
}
|
||||
|
||||
$description = idx($credentials, 'description', '');
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Alias for arc feature
|
||||
*
|
||||
* @group workflow
|
||||
* Alias for `arc feature`.
|
||||
*/
|
||||
final class ArcanistBookmarkWorkflow extends ArcanistFeatureWorkflow {
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Alias for arc feature
|
||||
*
|
||||
* @group workflow
|
||||
* Alias for `arc feature`.
|
||||
*/
|
||||
final class ArcanistBranchWorkflow extends ArcanistFeatureWorkflow {
|
||||
|
||||
|
|
|
@ -137,4 +137,5 @@ EOTEXT
|
|||
"Unable to find a browser command to run. Set 'browser' in your ".
|
||||
"arc config to specify one."));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Provides command-line access to the Conduit API.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistCallConduitWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -91,4 +89,5 @@ EOTEXT
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Explicitly closes Differential revisions.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistCloseRevisionWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -151,4 +149,5 @@ EOTEXT
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Close a task
|
||||
*
|
||||
* @group workflow
|
||||
* Close a task.
|
||||
*/
|
||||
final class ArcanistCloseWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -73,8 +71,9 @@ EOTEXT
|
|||
'status' => array(
|
||||
'param' => 'status',
|
||||
'short' => 's',
|
||||
'help' => pht('Specify a new status. Valid status options can be '.
|
||||
'seen with the `list-statuses` argument.'),
|
||||
'help' => pht(
|
||||
'Specify a new status. Valid status options can be '.
|
||||
'seen with the `list-statuses` argument.'),
|
||||
),
|
||||
'list-statuses' => array(
|
||||
'help' => 'Show available status options and exit.',
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Executes "svn commit" once a revision has been "Accepted".
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistCommitWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -336,5 +334,4 @@ EOTEXT
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Covers your professional reputation by blaming changes to locate reviewers.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistCoverWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -63,7 +61,6 @@ EOTEXT
|
|||
}
|
||||
|
||||
public function run() {
|
||||
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
|
||||
$in_paths = $this->getArgument('paths');
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* @task message Commit and Update Messages
|
||||
* @task diffspec Diff Specification
|
||||
* @task diffprop Diff Properties
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistDiffWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Download a file from Phabricator.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistDownloadWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -36,8 +34,9 @@ EOTEXT
|
|||
return array(
|
||||
'show' => array(
|
||||
'conflicts' => array(
|
||||
'as' => 'Use --show to direct the file to stdout, or --as to direct '.
|
||||
'it to a named location.',
|
||||
'as' =>
|
||||
'Use --show to direct the file to stdout, or --as to direct '.
|
||||
'it to a named location.',
|
||||
),
|
||||
'help' => 'Write file to stdout instead of to disk.',
|
||||
),
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
/**
|
||||
* Exports changes from Differential or the working copy to a file.
|
||||
*
|
||||
* @group workflow
|
||||
*/
|
||||
final class ArcanistExportWorkflow extends ArcanistBaseWorkflow {
|
||||
|
||||
|
@ -84,7 +82,6 @@ EOTEXT
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
protected function didParseArguments() {
|
||||
$source = self::SOURCE_LOCAL;
|
||||
$requested = 0;
|
||||
|
@ -105,11 +102,10 @@ EOTEXT
|
|||
|
||||
if ($requested > 1) {
|
||||
throw new ArcanistUsageException(
|
||||
"Options '--revision' and '--diff' are not compatible. Choose exactly ".
|
||||
"one change source.");
|
||||
"Options '--revision' and '--diff' are not compatible. Choose exactly ".
|
||||
"one change source.");
|
||||
}
|
||||
|
||||
|
||||
$format = null;
|
||||
$requested = 0;
|
||||
if ($this->getArgument('git')) {
|
||||
|
@ -167,7 +163,6 @@ EOTEXT
|
|||
}
|
||||
|
||||
public function run() {
|
||||
|
||||
$source = $this->getSource();
|
||||
|
||||
switch ($source) {
|
||||
|
@ -218,7 +213,7 @@ EOTEXT
|
|||
$bundle->setProjectID($this->getWorkingCopy()->getProjectID());
|
||||
$bundle->setBaseRevision(
|
||||
$repository_api->getSourceControlBaseRevision());
|
||||
// note we can't get a revision ID for SOURCE_LOCAL
|
||||
// NOTE: we can't get a revision ID for SOURCE_LOCAL
|
||||
|
||||
$parser = new PhutilEmailAddress($author);
|
||||
$bundle->setAuthorName($parser->getDisplayName());
|
||||
|
@ -273,4 +268,5 @@ EOTEXT
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue