]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
11 years agoAdd a linter rule for incorrect use of parent scope
Joshua Spence [Thu, 14 May 2015 08:01:43 +0000 (18:01 +1000)]
Add a linter rule for incorrect use of parent scope

Summary:
The following code is invalid:

```
final class MyClass {
  public function __construct() {
    parent::__construct(null);
  }
}

$x = new MyClass();
```

Running the above code will produce a fatal error:

```
PHP Fatal error:  Cannot access parent:: when current class scope has no parent
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12420

11 years agoModernize `ArcanistPylintLinter`
Joshua Spence [Thu, 14 May 2015 07:49:24 +0000 (17:49 +1000)]
Modernize `ArcanistPylintLinter`

Summary:
Ref T2039. Convert the `ArcanistPylintLinter` to an `ArcanistExternalLinter` and make it compatible with `.arclint`. In doing so, it was necessary to drop support of older versions of `pylint` by setting the minimum version to be 1.0.0. I think that dropping support for older versions is reasonable because version 1.0.0 was released ~18 months ago. In the case than an incompatible version is detected, an `ArcanistMissingLinterException` is thrown.

One caveat here is that support for `lint.pylint.codes.(error|warning|advice)` is dropped. Any installs that are relying on this configuration will need to migrate to using the `.arclint` file for specifying linter severity. We could potentially continue to support this deprecated configuration, but I'm not sure if this is worthwhile.

Test Plan: Wrote and executed unit tests with `arc unit`. I ran the unit tests on all `pylint` releases after (and including) 1.0.0. Specifically, the tests were run on v1.0.0, v1.1.0, v1.2.0, v1.3.0 and v1.4.0.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9109

11 years agoUse `__CLASS__` instead of hardcoding class names
Joshua Spence [Wed, 13 May 2015 21:09:53 +0000 (07:09 +1000)]
Use `__CLASS__` instead of hardcoding class names

Summary: Use `__CLASS__` instead of hardcoding class names. Depends on D12804.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12805

11 years agoAdd a linter rule for useless overriding methods
Joshua Spence [Wed, 13 May 2015 11:03:39 +0000 (21:03 +1000)]
Add a linter rule for useless overriding methods

Summary: Ref T7409. Adds `ArcanistXHPASTLinter::LINT_USELESS_OVERRIDING_METHOD` for detecting method which only call their parent method. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php | Generic_Sniffs_CodeAnalysis_UselessOverridingMethodSniff]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12419

11 years ago`pht` all the things
Joshua Spence [Wed, 13 May 2015 08:05:15 +0000 (18:05 +1000)]
`pht` all the things

Summary: `pht`ize almost all strings in rARC.

Test Plan: ¯\_(ツ)_/¯

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12607

11 years agoAdd a linter rule to prevent hardcoded class names
Joshua Spence [Tue, 12 May 2015 20:50:30 +0000 (06:50 +1000)]
Add a linter rule to prevent hardcoded class names

Summary: Add a linter rule to advise against the use of hardcoded class names. Hardcoded class names make the code harder to refactor and it is generally preferable to use the `__CLASS__` magic constant instead.

Test Plan: This works, but needs some polish.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12605

11 years agoAllow Arcanist to parse bare revision IDs from "Differential Revisions:" field
epriestley [Thu, 7 May 2015 18:10:08 +0000 (11:10 -0700)]
Allow Arcanist to parse bare revision IDs from "Differential Revisions:" field

Summary: Ref T8087. Prepares for eventually making these optional after T6030. See also T7443.

Test Plan:
  - See the next change for the server-side part of this.
  - With both patches applied, rigged the server to return `D123`.
  - Created a revision, saw bare `D123`.
  - Updated it with bare `D123`, things worked properly.
  - Created this revision with full URIs.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: cburroughs, epriestley

Maniphest Tasks: T8087

Differential Revision: https://secure.phabricator.com/D12748

11 years agoMake --conduit-token work without requiring .arcrc
epriestley [Thu, 7 May 2015 18:09:58 +0000 (11:09 -0700)]
Make --conduit-token work without requiring .arcrc

Summary:
Ref T5955. This logic is a little cleaner than the previous version.

Don't require `~/.arcrc` to exist if the caller provides `--conduit-token`.

Test Plan:
  - Made calls with `--conduit-token` and no `~/.arcrc`.
  - Made calls with `--conduit-token` and a normal `~/.arcrc`.
  - Made calls with normal `arc`.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: mbishopim3, epriestley

Maniphest Tasks: T5955

Differential Revision: https://secure.phabricator.com/D12750

11 years agoFix broken ArcanistPhpunitTestResultParser
Sascha Egerer [Thu, 7 May 2015 15:41:28 +0000 (08:41 -0700)]
Fix broken ArcanistPhpunitTestResultParser

Summary:
The ArcanistPhpunitTestResultParser has been changed
to use phutil_json_decode instead of json_decode in
rARCa4d33ef117aa8702181154b60ce1ce52bcfc119b
That has broken the functionality as json_decode has returned
an object before but phutil_json_decode does return an array.
The code has now been adopted to work with the array result
instead of an object.

Test Plan: Run a phpunit test case

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, epriestley

Differential Revision: https://secure.phabricator.com/D12751

11 years agoFix linter config check
Aviv Eyal [Tue, 5 May 2015 21:03:01 +0000 (14:03 -0700)]
Fix linter config check

Summary: Fixes T6311 and T5124 by returning all configured linters from `buildLinter()`, and making `ArcanistExternalLinter::checkBinaryConfiguration()` not crash if there's no executable to run.

Test Plan: `arc linters` in rP shows "Configured" and "ERROR" as appropriate; Adding a broken linter to `.arclint` in rARC doesn't invoke it's not actually needed, and prints error if it is.

Reviewers: joshuaspence, epriestley, #blessed_reviewers

Reviewed By: joshuaspence, epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T6311

Differential Revision: https://secure.phabricator.com/D10773

11 years agoAdd a --conduit-token parameter to `arc`
epriestley [Tue, 5 May 2015 21:02:54 +0000 (14:02 -0700)]
Add a --conduit-token parameter to `arc`

Summary: Ref T5955. This makes it easier to write scripts which call Conduit via `arc call-conduit`.

Test Plan: Used `arc --conduit-token ... call-conduit user.whoami` to make calls as various users.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: mbishopim3, epriestley

Maniphest Tasks: T5955

Differential Revision: https://secure.phabricator.com/D12717

11 years agoRemove hook functionality
Joshua Spence [Tue, 5 May 2015 10:57:23 +0000 (20:57 +1000)]
Remove hook functionality

Summary: Fixes T7674. Remove remaining commit hook functionality.

Test Plan: Unit tests still pass?

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12698

11 years agoModernize Script-and-Regex linter for ConfigurationDriven
Aviv Eyal [Tue, 5 May 2015 10:50:19 +0000 (03:50 -0700)]
Modernize Script-and-Regex linter for ConfigurationDriven

Summary: Support and prefer configuration from .arclint over Configuration Manager

Test Plan: arc lint with several combinations of values in .arcconfig and .arclint.

Reviewers: joshuaspence, epriestley, #blessed_reviewers

Reviewed By: joshuaspence, epriestley, #blessed_reviewers

Subscribers: vrusinov, jpoehls, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10704

11 years agoRemove commit linter
Joshua Spence [Tue, 5 May 2015 10:56:45 +0000 (20:56 +1000)]
Remove commit linter

Summary: Ref T7674. This linter doesn't make sense without commit hooks.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12697

11 years agoRemove support for passing data via STDIN
Joshua Spence [Tue, 5 May 2015 10:55:49 +0000 (20:55 +1000)]
Remove support for passing data via STDIN

Summary: Ref T7674. Remove support for passing data to linters via `STDIN`. This functionality exists primarily for pre-receive workflows (which don't have a working copy to act on), but these workflows are going away soon.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12696

11 years agoFix a failing XML unit test
Joshua Spence [Tue, 5 May 2015 08:47:19 +0000 (18:47 +1000)]
Fix a failing XML unit test

Summary: Ref T7215. This test case is consistently failing locally (with a `LIBXML_VERSION` of `20902`).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7215

Differential Revision: https://secure.phabricator.com/D12706

11 years agoRemove pre-commit hooks
Joshua Spence [Mon, 4 May 2015 21:22:26 +0000 (07:22 +1000)]
Remove pre-commit hooks

Summary: Ref T7674. The `arc git-hook-pre-receive` and `arc svn-hook-pre-commit` workflows are being removed.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12690

11 years agoFix a typo
Joshua Spence [Mon, 4 May 2015 21:14:40 +0000 (07:14 +1000)]
Fix a typo

Summary: This variable is misnamed.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12695

11 years agoUse phutil_json_decode instead of json_decode
Joshua Spence [Mon, 4 May 2015 12:28:21 +0000 (22:28 +1000)]
Use phutil_json_decode instead of json_decode

Summary: Generally, `phutil_json_decode` should be preferred over `json_decode`.

Test Plan: Eyeballed.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12678

11 years agoRemove unused ArcanistUncommittedChangesException class
Joshua Spence [Sun, 3 May 2015 00:07:15 +0000 (10:07 +1000)]
Remove unused ArcanistUncommittedChangesException class

Summary: Remove the `ArcanistUncommittedChangesException` class which is unused after D11843.

Test Plan: `grep`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12515

11 years agoMove the getSuperGlobalNames method to ArcanistBaseXHPASTLinter
Joshua Spence [Sun, 3 May 2015 00:05:35 +0000 (10:05 +1000)]
Move the getSuperGlobalNames method to ArcanistBaseXHPASTLinter

Summary: Move the `getSuperGlobalNames` method to `ArcanistBaseXHPASTLinter` so that it can be used within subclasses.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: virendra20888, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12473

11 years agoMemoize paths
Joshua Spence [Mon, 27 Apr 2015 13:20:31 +0000 (23:20 +1000)]
Memoize paths

Summary: Ref T7892. Memoize paths returned from `ARcanistLinter::getPaths()` to improve runtime performance.

Test Plan: Wiped ~0.5 seconds off the total time to lint rARC.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7892

Differential Revision: https://secure.phabricator.com/D12520

11 years agoRemove vqueryfx from linters
Joshua Spence [Mon, 27 Apr 2015 11:19:38 +0000 (21:19 +1000)]
Remove vqueryfx from linters

Summary: These methods are gone. Depends on D12566.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12567

11 years agoImprove performance of LINT_UNNECESSARY_SEMICOLON
Joshua Spence [Thu, 23 Apr 2015 10:15:00 +0000 (20:15 +1000)]
Improve performance of LINT_UNNECESSARY_SEMICOLON

Summary: Ref T7892. Improve the performance of `ArcanistXHPASTLinter::LINT_UNNECESSARY_SEMICOLON`.

Test Plan: Wiped 6 seconds off the total time to lint rARC.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7892

Differential Revision: https://secure.phabricator.com/D12519

11 years agoMemoize PHP compatibility info
Joshua Spence [Thu, 23 Apr 2015 10:14:46 +0000 (20:14 +1000)]
Memoize PHP compatibility info

Summary: Ref T7892. Avoid reading the PHP compatibility information for every file being linted.

Test Plan:
```name=Before
real    1m24.327s
user    1m19.571s
sys 0m5.239s
```

```lang=After
real    1m12.029s
user    1m5.756s
sys 0m5.502s
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7892

Differential Revision: https://secure.phabricator.com/D12518

11 years agoSplit large path lists into blocks when linting
epriestley [Wed, 22 Apr 2015 12:15:57 +0000 (05:15 -0700)]
Split large path lists into blocks when linting

Summary:
Fixes T5097. When linting a large list of paths (e.g., with `--everything`), do this internally:

  $chunks = array_chunk($paths, 32);
  foreach ($chunks as $chunk) {
    $this->lintChunk($chunk);
  }

This keeps the advantages of parallelism and artifact sharing for future-based linters, without having memory usage grow in an unbounded way.

These callbacks changed:

  - `willLintPath()`: Useless, no meaningful implementations. Internalized the required side effect and broke the hook.
  - `didRunLinters()`: Now useless, with no meaningful implementations. Broke the hook.
  - `didLintPaths()`: New hook which executes opposite `willLintPaths()`.
  - `lintPath()`: Linters no longer need to implement this method.

XHPAST now has an explicit way to release shared futures.

These minor changes also happened:

  - Formalized the "linter ID", which is a semi-durable identifier for the cache.
  - Removed linter -> exception explicit mapping, which was unused. We now just collect exceptions.
  - We do the `canRun()` checks first (and separately) now.
  - Share more service call profiling code.
  - Fix an issue where the test harness would use the path on disk, even if configuration set a different path.

Test Plan:
  - Ran `arc lint --everything` in `arcanist/`.
    - With no chunking, saw **unstable** memory usage with a peak at 941 MB.
    - With chunk size 32, saw **stable** memory usage with a peak at 269 MB.
    - With chunk size 8, saw **stable** memory usage with a peak at 180 MB.
  - Ran with `--trace` and saw profiling information.
  - Created this diff.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5097

Differential Revision: https://secure.phabricator.com/D12501

11 years agoAdd a linter rule for lowercase function names
Joshua Spence [Wed, 22 Apr 2015 12:02:09 +0000 (22:02 +1000)]
Add a linter rule for lowercase function names

Summary: Ref T7409. Adds `ArcanistXHPASTLinter::LINT_LOWERCASE_FUNCTIONS` to ensure that builtin PHP functions are lowercased. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/PHP/LowercasePHPFunctionsSniff.php | Squiz_Sniffs_PHP_LowercasePHPFunctionsSniff]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12377

11 years agoallow either (<time> seconds) or (<time>s) format for test result time
ArtemTitoulenko [Tue, 21 Apr 2015 19:02:32 +0000 (12:02 -0700)]
allow either (<time> seconds) or (<time>s) format for test result time

Summary: The default Go Test Parser stopped showing the test function name at the end of the package after some Go upgrade. We fixed it locally and wanted to share it upstream.

Test Plan: We ran it on our test suite using go1.4.2 darwin/amd64. We have version-dependent code which cannot be compiled with earlier versions of Go, unfortunately.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: avivey, Korvin, epriestley

Maniphest Tasks: T7845

Differential Revision: https://secure.phabricator.com/D12436

11 years agoAdd a linter rule for default parameters
Joshua Spence [Mon, 20 Apr 2015 09:23:23 +0000 (19:23 +1000)]
Add a linter rule for default parameters

Summary: Ref T7409. Adds `ArcanistXHPASTLinter::LINT_DEFAULT_PARAMETERS` for ensuring function/method parameters with a default value are declared after those without a default value. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/PEAR/Sniffs/Functions/ValidDefaultValueSniff.php | PEAR_Sniffs_Functions_ValidDefaultValueSniff]].

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12418

11 years agoMinor tidying of `ArcanistXHPASTLinter`
Joshua Spence [Mon, 13 Apr 2015 20:30:59 +0000 (06:30 +1000)]
Minor tidying of `ArcanistXHPASTLinter`

Summary: Modernizing a couple of linter rules.

Test Plan: Unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12393

11 years ago`pht`ize a bunch of strings
Joshua Spence [Mon, 13 Apr 2015 20:30:13 +0000 (06:30 +1000)]
`pht`ize a bunch of strings

Summary: `pht`ize a bunch of strings in `ArcanistXHPASTLinter`.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12392

11 years agoMinor improvement to self member reference linter rule
Joshua Spence [Mon, 13 Apr 2015 20:29:58 +0000 (06:29 +1000)]
Minor improvement to self member reference linter rule

Summary: Ref T7409. If `::` is surrounded by whitespace tokens and the whitespace token contains a newline character, allow it.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12391

11 years agoAdd a linter rule for declaring nested functions
Joshua Spence [Mon, 13 Apr 2015 20:29:44 +0000 (06:29 +1000)]
Add a linter rule for declaring nested functions

Summary: Ref T7409. Adds `ArcanistXHPASTLinter::LINT_INNER_FUNCTION` to advise against declaring PHP functions within an outer function. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/PHP/InnerFunctionsSniff.php | Squiz_Sniffs_PHP_InnerFunctionsSniff]].

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12389

11 years agoVarious linter fixes
Joshua Spence [Mon, 13 Apr 2015 20:29:07 +0000 (06:29 +1000)]
Various linter fixes

Summary: Apply various linter fixes.

Test Plan: Unit tests + eyeballing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12388

11 years agoImprovements to "self member reference" linter rule
Joshua Spence [Mon, 13 Apr 2015 20:27:17 +0000 (06:27 +1000)]
Improvements to "self member reference" linter rule

Summary: Ref T7409. A few fixes and improvements to `ArcanistXHPASTLinter::LINT_SELF_MEMBER_REFERENCE`.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12385

11 years agoMove README to Markdown
Chad Little [Mon, 13 Apr 2015 20:01:16 +0000 (13:01 -0700)]
Move README to Markdown

Summary: n/a

Test Plan: Markdown editor

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12400

11 years agoAdd a linter rule for logical operators
Joshua Spence [Sun, 12 Apr 2015 21:34:17 +0000 (07:34 +1000)]
Add a linter rule for logical operators

Summary:
Ref T7409. Adds `ArcanistXHPASTLinter::LINT_LOGICAL_OPERATORS` for advising:

  - `&&` in favor of `and`.
  - `||` in favor of `or`.

Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/Operators/ValidLogicalOperatorsSniff.php | Squiz_Sniffs_Operators_ValidLogicalOperatorsSniff]].

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12376

11 years agoAdd a linter rule for self member references
Joshua Spence [Sun, 12 Apr 2015 21:27:45 +0000 (07:27 +1000)]
Add a linter rule for self member references

Summary:
Ref T7409. Adds a linter rule for the following:

  - `self::` is used instead of `Self::`.
  - `self::` is used for local static member reference.
  - `self::` is used instead of `self ::`.

Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php | Squiz_Sniffs_Classes_SelfMemberReferenceSniff]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12370

11 years agoFurther improvements to keyword casing linter rule
Joshua Spence [Sun, 12 Apr 2015 21:27:20 +0000 (07:27 +1000)]
Further improvements to keyword casing linter rule

Summary: Ref T7409. Improve the `ArcanistXHPASTLinter::LINT_KEYWORD_CASING` linter rule to check that magic constants are uppercase.

Test Plan: Added unit test.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12368

11 years agoImprove `LINT_KEYWORD_CASING` linter rule
Joshua Spence [Sun, 12 Apr 2015 21:25:54 +0000 (07:25 +1000)]
Improve `LINT_KEYWORD_CASING` linter rule

Summary: Ref T7409. Improve `ArcanistXHPASTLinter::LINT_KEYWORD_CASING` to include additional token types. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php | Generic_Sniffs_PHP_LowerCaseKeywordSniff]].

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12367

11 years agoAdd a linter rule for uppercase constant definitions
Joshua Spence [Sun, 12 Apr 2015 21:21:39 +0000 (07:21 +1000)]
Add a linter rule for uppercase constant definitions

Summary: Ref T7409. Adds a linter rule to ensure that constant are defined as being uppercase. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php | Generic_Sniffs_NamingConventions_UpperCaseConstantNameSniff]].

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12366

11 years agoTrim trailing whitespace from diff hints
Joshua Spence [Sun, 12 Apr 2015 21:21:07 +0000 (07:21 +1000)]
Trim trailing whitespace from diff hints

Summary: Although these don't do any harm, they show up in my editor which is configured to highlight trailing whitespace.

Test Plan: Submitted this diff... saw no trailing whitespace.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12369

11 years agoFix a failing unit test
Joshua Spence [Sun, 12 Apr 2015 08:46:55 +0000 (18:46 +1000)]
Fix a failing unit test

Summary: D11640 incorrectly changed the line endings in this file.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12322

11 years agoFix text lint issues
Joshua Spence [Tue, 7 Apr 2015 08:09:26 +0000 (18:09 +1000)]
Fix text lint issues

Summary: Ref T5105. This is a proof-of-concept for D11458.

Test Plan: `arc lint --everything`

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5105

Differential Revision: https://secure.phabricator.com/D11640

11 years agoImprove array comma rule
Joshua Spence [Mon, 6 Apr 2015 21:51:52 +0000 (07:51 +1000)]
Improve array comma rule

Summary: Improve `ArcanistXHPASTLinter::LINT_ARRAY_SEPARATOR` in handling multi-line arrays, see D12280 and D12281 for example.  Depends on D12295.

Test Plan: Updated unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12296

11 years agoDon't pass data to `jshint` via STDIN
Joshua Spence [Mon, 6 Apr 2015 21:26:09 +0000 (07:26 +1000)]
Don't pass data to `jshint` via STDIN

Summary: Fixes T7464. JSHint is unable to exclude files from linting (via the `jshintignore` file) if the data is piped through `STDIN`. An alternative would be to pass `$options[] = '--filename='.$this->getActivePath()`, but `$this->getActivePath()` is not set when the command arguments are constructed.

Test Plan: Created a file and linted it with `ArcanistJSHintLinter`. Was able to exclude the file from linting with a `jshintignore` file.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7464

Differential Revision: https://secure.phabricator.com/D12298

11 years agoFix parsing of PHP compatibility info
Joshua Spence [Mon, 6 Apr 2015 21:25:58 +0000 (07:25 +1000)]
Fix parsing of PHP compatibility info

Summary: The format of this file has changed. Depends on D12278.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12279

11 years agoAdd a linter rule to detect unnecessary semicolons
Joshua Spence [Mon, 6 Apr 2015 21:24:20 +0000 (07:24 +1000)]
Add a linter rule to detect unnecessary semicolons

Summary:
Ref T7409. Adds a rule to detect unnecessary semicolons. The most common scenario I've seen in the wild is the use of semicolons after a class definition:

```lang=php
class MyClass {
  // ...
};
```

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12139

11 years agoRemove deprecated `ComprehensiveLintEngine` class
Joshua Spence [Mon, 6 Apr 2015 21:22:59 +0000 (07:22 +1000)]
Remove deprecated `ComprehensiveLintEngine` class

Summary: Ref T5655. This class was deprecated in D11673.

Test Plan: Wait a few months.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D11740

11 years agoAdded RuboCop linter
cburroughs [Mon, 6 Apr 2015 16:11:06 +0000 (09:11 -0700)]
Added RuboCop linter

Test Plan:
Add the following JSON to your `.arclint`:

```lang=json
"rubocop": {
  "type": "rubocop",
  "include": "(\\.rb$)"
}
```

Then, add a ruby file with errors, for instance:

```lang=ruby
def hello()
  puts 'world'
end
```

Run `arc lint`. It should come up with something along the line of: "Omit the parentheses in defs when the method doesn't accept any arguments."

Reviewers: joshuaspence, remon, #blessed_reviewers, epriestley

Reviewed By: joshuaspence, #blessed_reviewers, epriestley

Subscribers: reu, calfzhou, jjooss, cburroughs, chad, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10738

11 years agoFix an odd looking array
Joshua Spence [Sun, 5 Apr 2015 12:27:52 +0000 (22:27 +1000)]
Fix an odd looking array

Summary: This array looks a little odd, most likely due to the autofix applied by `ArcanistXHPASTLinter::LINT_ARRAY_SEPARATOR`. See D12296 in which I attempt to improve the autocorrection from this linter rule.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12280

11 years agoPrompt users to ignore or abort on untracked files
epriestley [Thu, 2 Apr 2015 20:40:14 +0000 (13:40 -0700)]
Prompt users to ignore or abort on untracked files

Summary:
Fixes T7521. This separates things into two prompts and doesn't try to automatically add untracked files.

This also fixes T7512, or at least I can't reproduce it after this change.

Test Plan:
  - Ran `arc diff` in a `git` directory with untracked files.
  - Ran `arc diff` in a `svn` directory with untracked files.
  - Ran `arc diff` in a `hg` directory with untracked files.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7512, T7521

Differential Revision: https://secure.phabricator.com/D12258

11 years agoAdd a linter rule for unnecessary use of the `final` modifier
Joshua Spence [Mon, 23 Mar 2015 13:11:19 +0000 (00:11 +1100)]
Add a linter rule for unnecessary use of the `final` modifier

Summary: Ref T7409. This was based on rhttps://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnnecessaryFinalModifierSniff.php.

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12135

11 years agoFix a few edge cases for call-time pass-by-reference linting
Joshua Spence [Mon, 23 Mar 2015 12:21:18 +0000 (23:21 +1100)]
Fix a few edge cases for call-time pass-by-reference linting

Summary: Fix a few false positives.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12134

11 years agoFix chunk upload fallback behavior
epriestley [Thu, 19 Mar 2015 02:06:27 +0000 (19:06 -0700)]
Fix chunk upload fallback behavior

Summary:
Ref T7594. Currently, if a chunk upload fails, we incorrectly swallow the failure and fall back to single-file upload, which will often fail by hitting size limits. This also silences the original error.

Instead, do chunk uploads outside the block so that any exceptions escape, and we don't try to fall back to single-file upload.

Mostly just trying to get more info about what's going wrong on @joshuaspence's install.

Test Plan: Faked an exception in chunk upload, ran `arc upload` on a big file, saw the exception displayed on the console.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley, joshuaspence

Maniphest Tasks: T7594

Differential Revision: https://secure.phabricator.com/D12111

11 years agoExplicitly draw progress bar when resuming file uploads in `arc upload`
epriestley [Sun, 15 Mar 2015 18:31:56 +0000 (11:31 -0700)]
Explicitly draw progress bar when resuming file uploads in `arc upload`

Summary: Ref T7149. Make sure we sit at "Resuming: 60%" or whatever while uploading the first chunk.

Test Plan: Ran `arc upload` on a large file, cancelled it, resumed it, got sensible progress bar.

Reviewers: chad, btrahan

Reviewed By: chad, btrahan

Subscribers: epriestley

Maniphest Tasks: T7149

Differential Revision: https://secure.phabricator.com/D12082

11 years agoRemove "force chunking" code from Arcanist
epriestley [Sun, 15 Mar 2015 18:31:41 +0000 (11:31 -0700)]
Remove "force chunking" code from Arcanist

Summary: Ref T7149. This was just for testing and is no longer required.

Test Plan: `grep`

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7149

Differential Revision: https://secure.phabricator.com/D12077

11 years agoMake "arc upload" chunk-aware
epriestley [Fri, 13 Mar 2015 18:30:50 +0000 (11:30 -0700)]
Make "arc upload" chunk-aware

Summary: Ref T7149. This makes the client try to use the new `file.allocate` API before falling back to the old stuff.

Test Plan: Used `arc upload` to upload files. With chunking forced, uploaded chunked files.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T7149

Differential Revision: https://secure.phabricator.com/D12061

11 years agoAdd a space in the translation when a error message is printed.
Yomi [Thu, 12 Mar 2015 22:23:37 +0000 (15:23 -0700)]
Add a space in the translation when a error message is printed.

Summary: Change 'themto' to 'them to'.

Test Plan: Check message printed...

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12057

11 years agoAdd untracked files to commit using prompt
nevogd [Fri, 6 Mar 2015 12:41:00 +0000 (04:41 -0800)]
Add untracked files to commit using prompt

Summary:
Refs D11990. When using `arc diff` with untracked files in the working
copy, add the untracked file(s) to the commit (as they weren't stashed or
ignored). Add the untracked paths to the list of changes in the editor
template, indicating that the files were added to the commit.

This doesn't add a separate prompt to add untracked files as per the
behaviour prior to D11843.

Test Plan:
Ran `arc diff` with only untracked files, answered yes to the 'create
new commit' prompt. Saw the commit-message with the updated changes
including untracked files. Completed the arc template, and got commit
containing uncommitted, unstaged and untracked files.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11995

11 years agoCheck for untracked files in order to fire untracked file prompt
epriestley [Thu, 5 Mar 2015 22:44:59 +0000 (14:44 -0800)]
Check for untracked files in order to fire untracked file prompt

Summary: Fixes T7465. I think I just missed this when untangling the old logic.

Test Plan: Ran `arc diff` with //only// untrakced files, saw warning.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7465

Differential Revision: https://secure.phabricator.com/D11990

11 years agoFix a newline issue in "arc" workflows
epriestley [Mon, 2 Mar 2015 16:34:46 +0000 (08:34 -0800)]
Fix a newline issue in "arc" workflows

Summary:
We end up with one too few newline here in some workflows, like `arc land` with unstaged changes.

Root issue here is that `phutil_console_prompt|confirm` lead with too much whitespace but that's a harder fix.

Test Plan: Saw reasonable whitespace.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11927

11 years agoMake "arc which --show-base" work as expected
epriestley [Wed, 25 Feb 2015 21:09:00 +0000 (13:09 -0800)]
Make "arc which --show-base" work as expected

Summary: This is supposed to just print out the base revision, but actually prints out the repository section first.

Test Plan: Ran `arc which`, `arc which --show-base`.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11888

11 years agoUse $EDITOR to prompt users when creating a new commit out of dirty working copy...
epriestley [Sat, 21 Feb 2015 10:37:58 +0000 (02:37 -0800)]
Use $EDITOR to prompt users when creating a new commit out of dirty working copy changes

Summary:
Fixes T7344.
Currently, we use `phutil_console_prompt()`, which isn't a very good editor. Use the real $EDITOR instead.

100% of the logic here was also a gigantic mess. Clean it up.

Test Plan: Will update in a second with console output from this run.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7344

Differential Revision: https://secure.phabricator.com/D11843

11 years agoUpdate arcanist to work with more modular translations
epriestley [Wed, 11 Feb 2015 21:02:11 +0000 (13:02 -0800)]
Update arcanist to work with more modular translations

Summary:
Ref T7152. Ref T1139.

  - Tweak API.
  - Move translations out of __init__ file.

Test Plan:
  - Ran `arc`.
  - Added a goofy translation and made sure it was working.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7152, T1139

Differential Revision: https://secure.phabricator.com/D11746

11 years agoFix `xsprintf` callback
Joshua Spence [Wed, 11 Feb 2015 07:29:12 +0000 (18:29 +1100)]
Fix `xsprintf` callback

Summary: After all that, I forgot to change this back.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11735

11 years agolosen pep8 version check
cburroughs [Tue, 10 Feb 2015 14:17:25 +0000 (06:17 -0800)]
losen pep8 version check

Summary:
pep8 has used both 2 (`1.2`) and 3 (`1.2.1`) digit versions.  Losen
the version check to allow for both.

NOTE: This is the same regex as flake8.

Test Plan: `arc unit` with a 2 and 3 digit pep8 version on `$PATH`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: joshuaspence, epriestley

Differential Revision: https://secure.phabricator.com/D11728

11 years agoFix `pht` method calls
Joshua Spence [Tue, 10 Feb 2015 07:45:30 +0000 (18:45 +1100)]
Fix `pht` method calls

Summary: Ref T7046. This is mainly a proof-of-concept for D11661.

Test Plan: `arc lint`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7046

Differential Revision: https://secure.phabricator.com/D11683

11 years agoAdd a linter rule to detect mismatched parameters for formatted strings
Joshua Spence [Tue, 10 Feb 2015 07:40:15 +0000 (18:40 +1100)]
Add a linter rule to detect mismatched parameters for formatted strings

Summary: Fixes T7046. Adds a linter rule to detect mismatched parameters for formatted strings. Originally I had considered putting this rule in `ArcanistPhutilXHPASTLinter`, but I later decided to move it to `ArcanistXHPASTLinter` as I think that it is general enough to be more widely useful.

Test Plan: This seems to work but needs some polish.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7046

Differential Revision: https://secure.phabricator.com/D11661

11 years agoRename `ComprehensiveLintEngine` class for consistency
Joshua Spence [Mon, 9 Feb 2015 19:57:17 +0000 (06:57 +1100)]
Rename `ComprehensiveLintEngine` class for consistency

Summary: Ref T5655.

Test Plan: Ran `arc lint` with `lint.engine` set to `ComprehensiveLintEngine` and saw a deprecation notice.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D11673

11 years agoRename `ArcanistCompilerLikeLintRenderer`
Joshua Spence [Mon, 9 Feb 2015 19:57:10 +0000 (06:57 +1100)]
Rename `ArcanistCompilerLikeLintRenderer`

Summary: Ref T5655. "Compiler-like" seems a bit odd to me.

Test Plan: `arc lint` + `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D11670

11 years agoRemove deprecated support for specifying flags as a string
Joshua Spence [Mon, 9 Feb 2015 19:55:27 +0000 (06:55 +1100)]
Remove deprecated support for specifying flags as a string

Summary: It should be safe to remove this now.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11714

11 years agoRename `ArcanistXHPASTLintTestSwitchHook` class
Joshua Spence [Mon, 9 Feb 2015 19:55:03 +0000 (06:55 +1100)]
Rename `ArcanistXHPASTLintTestSwitchHook` class

Summary: Ref T5655.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D11712

11 years agoChange a method name
Joshua Spence [Mon, 9 Feb 2015 19:53:53 +0000 (06:53 +1100)]
Change a method name

Summary: Ref T5655.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D11713

11 years ago`pht`ize some strings in `ArcanistPhutilTestCaseTestCase`
Joshua Spence [Wed, 4 Feb 2015 20:22:00 +0000 (07:22 +1100)]
`pht`ize some strings in `ArcanistPhutilTestCaseTestCase`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11671

11 years agoRemove the `ArcanistArcanistLinterTestCase`
Joshua Spence [Wed, 4 Feb 2015 20:21:00 +0000 (07:21 +1100)]
Remove the `ArcanistArcanistLinterTestCase`

Summary: I don't think that this provides too much value. I think that we should rework this to be inferred from the `.arcconfig` file perhaps?

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11662

11 years agoArcanist / Conduit - stop using deprecated diffusion.getcommits
Bob Trahan [Tue, 3 Feb 2015 22:33:06 +0000 (14:33 -0800)]
Arcanist / Conduit - stop using deprecated diffusion.getcommits

Summary: Fixes T7113. This one was a bit trickier than others as the API output changed a bit. In particular, there is no "errors" emitted so much as the result set just doesn't include the answer if things are garbage. Ergo, check the "identifier map" to either check for diff existence or to lookup the phid to grab the actual diff data from the "data" part of the result.

Test Plan: called `arc backout D11665` and got some working output...!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7113

Differential Revision: https://secure.phabricator.com/D11667

11 years agoArcanist / Conduit - stop using deprecated differential.getdiff API
Bob Trahan [Tue, 3 Feb 2015 22:18:10 +0000 (14:18 -0800)]
Arcanist / Conduit - stop using deprecated differential.getdiff API

Summary: Fixes T7112. Nothing too difficult here.

Test Plan:
meta - submitting this with the new arcanist code
used conduit API to verify the difference between getdiff (just the latest diff) and querydiffs (all diffs that match, with the latest diff first in the set)

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7112

Differential Revision: https://secure.phabricator.com/D11665

11 years agoMake "no working copy" a more explicit "arc" VCS
epriestley [Tue, 3 Feb 2015 20:32:46 +0000 (12:32 -0800)]
Make "no working copy" a more explicit "arc" VCS

Summary:
Some commands (like `get-config`) do not require a working copy at all. Recent changes prevented these commands from running outside a VCS working copy.

Let `null` mean "no working copy".

See also <https://github.com/phacility/phabricator/issues/800>.

Test Plan:
  - Ran `arc get-config` from outside a working copy.
  - Ran `arc list` from outside a working copy, got an error.
  - Ran `arc commit` in a Git working copy, got an error.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11643

11 years agoOnly allow `arc branch` to be used under `git`
Joshua Spence [Tue, 3 Feb 2015 19:58:53 +0000 (06:58 +1100)]
Only allow `arc branch` to be used under `git`

Summary: Explicitly declare that the `arc branch` command is only supported under `git`.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11552

11 years agoIndicate relevant VCS for `arc feature`
Joshua Spence [Tue, 3 Feb 2015 19:54:07 +0000 (06:54 +1100)]
Indicate relevant VCS for `arc feature`

Summary: This workflow only works on git + mercurial.

Test Plan: I don't even subversion.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11626

11 years agoList supported VCS for `arc backout`
Joshua Spence [Tue, 3 Feb 2015 19:53:58 +0000 (06:53 +1100)]
List supported VCS for `arc backout`

Summary: This workflow does not work on subversion.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11625

11 years agoMark `git-hook-pre-receive` as git only
Joshua Spence [Tue, 3 Feb 2015 19:53:47 +0000 (06:53 +1100)]
Mark `git-hook-pre-receive` as git only

Summary: It doesn't make any sense to run this command on another VCS.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11624

11 years agoMark `arc svn-hook-pre-commit` for subversion only
Joshua Spence [Tue, 3 Feb 2015 19:53:41 +0000 (06:53 +1100)]
Mark `arc svn-hook-pre-commit` for subversion only

Summary: It doesn't make any sense to run this command on any other VCS.

Test Plan: Ran `arc svn-hook-pre-commit` and hit the usage exception.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11623

11 years agoAllow `ArcanistPhutilLibraryLinter` to run with an out-of-date XHPAST binary
Joshua Spence [Mon, 2 Feb 2015 21:01:11 +0000 (08:01 +1100)]
Allow `ArcanistPhutilLibraryLinter` to run with an out-of-date XHPAST binary

Summary: There is no need to check if the XHPAST binary is available here because this linter does not actually parse PHP, it only considers the library map.

Test Plan: Removed the XHPAST binary and ran `arc lint` on a bunch of files.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11528

11 years agoUse `PhutilXHPASTBinary` methods
Joshua Spence [Mon, 2 Feb 2015 19:58:33 +0000 (06:58 +1100)]
Use `PhutilXHPASTBinary` methods

Summary: Use `PhutilXHPASTBinary` methods instead of `xhpast_parse` functions. Depends on D11517.

Test Plan: N/A, this is a direct swap.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11613

11 years agoUse XHPAST version instead of checksum as cache version
Joshua Spence [Mon, 2 Feb 2015 19:56:35 +0000 (06:56 +1100)]
Use XHPAST version instead of checksum as cache version

Summary: Rely on the output of `xhpast --version` when determing the lint cache key.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11611

11 years ago`pht`ize strings in `ArcanistSettings`
Joshua Spence [Mon, 2 Feb 2015 19:54:46 +0000 (06:54 +1100)]
`pht`ize strings in `ArcanistSettings`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11610

11 years agoExplicitly check for supported VCS
Joshua Spence [Mon, 2 Feb 2015 19:54:22 +0000 (06:54 +1100)]
Explicitly check for supported VCS

Summary: Instead of having an `ArcanistWorkflow` subclass explicitly throw an exception when run in an unsupported VCS, consolidate this code and move it to `arcanist.php`. In doing so, we lose some specificity in some of the error messages, but this otherwise feels cleaner. We could consider adding a `getUnsupportedRevisionControlSystemMessage()` method to provide a more tailored error message. Depends on D11604.

Test Plan:
Ran `arc bookmark` in a `git` working copy:

```
Usage Exception: `arc bookmark` is only supported under hg.
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11550

11 years agoModernize `ArcanistPhpcsLinter`
Joshua Spence [Mon, 2 Feb 2015 19:43:54 +0000 (06:43 +1100)]
Modernize `ArcanistPhpcsLinter`

Summary: Allow `--severity` to be specified using `.arclint`.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11511

11 years agoChange "any" to explicitly list revision control systems
Joshua Spence [Mon, 2 Feb 2015 07:18:36 +0000 (18:18 +1100)]
Change "any" to explicitly list revision control systems

Summary: Using `array('any')` to represent `array('git', 'hg', 'svn')` is a bit magical and leads to a lot of special-casing.

Test Plan: Verified that tab completion (ala `ArcanistShellCompleteWorkflow`) still worked.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11604

11 years agoMinor tidying of `ArcanistPasteWorkflow`
Joshua Spence [Sun, 1 Feb 2015 10:57:49 +0000 (21:57 +1100)]
Minor tidying of `ArcanistPasteWorkflow`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11566

11 years agoMinor tidying of `ArcanistRevertWorkflow`
Joshua Spence [Sun, 1 Feb 2015 10:56:28 +0000 (21:56 +1100)]
Minor tidying of `ArcanistRevertWorkflow`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11557

11 years agoMinor tidying of `ArcanistUploadWorkflow`
Joshua Spence [Sun, 1 Feb 2015 10:51:12 +0000 (21:51 +1100)]
Minor tidying of `ArcanistUploadWorkflow`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11556

11 years agoMinor tidying of `ArcanistPhrequentWorkflow` classes
Joshua Spence [Sun, 1 Feb 2015 00:58:18 +0000 (11:58 +1100)]
Minor tidying of `ArcanistPhrequentWorkflow` classes

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11555

11 years agoMinor tidying of `ArcanistCallConduitWorkflow`
Joshua Spence [Sun, 1 Feb 2015 00:05:27 +0000 (11:05 +1100)]
Minor tidying of `ArcanistCallConduitWorkflow`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11567

11 years agoMinor tidying of `ArcanistUpgradeWorkflow`
Joshua Spence [Sun, 1 Feb 2015 00:00:36 +0000 (11:00 +1100)]
Minor tidying of `ArcanistUpgradeWorkflow`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11554

11 years agoMinor tidying of `ArcanistVersionWorkflow`
Joshua Spence [Thu, 29 Jan 2015 20:15:05 +0000 (07:15 +1100)]
Minor tidying of `ArcanistVersionWorkflow`

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11553

11 years agoFix `ArcanistJscsLinter` unit tests
Joshua Spence [Tue, 27 Jan 2015 19:49:02 +0000 (06:49 +1100)]
Fix `ArcanistJscsLinter` unit tests

Summary: These tests are failing with the latest version of `jscs` (v1.10.0).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11520

11 years agoFix failing unit tests for `ArcanistLesscLinter`
Joshua Spence [Tue, 27 Jan 2015 19:48:49 +0000 (06:48 +1100)]
Fix failing unit tests for `ArcanistLesscLinter`

Summary: A bunch of unit tests are failing with the latest version of `lessc` (v2.3.0). I decided to delete a bunch of test cases for this linter as we have far too many at the moment.

Test Plan: `arc unit`

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11521