]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
11 years agoDelete another problematic XML test file
Joshua Spence [Wed, 2 Sep 2015 08:34:55 +0000 (18:34 +1000)]
Delete another problematic XML test file

Summary: Ref T7215. This test is occasionally failing for me locally. Remove it as per D13992.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T7215

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

11 years agoRemove errant in arcanist.php
Mike Riley [Tue, 1 Sep 2015 15:46:17 +0000 (08:46 -0700)]
Remove errant  in arcanist.php

Summary: This causes `49` to be printed out preceding the start of my next terminal line every time there is an exception thrown.

Test Plan: did not see `49` printed out when exceptions were thrown

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

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

11 years agoAdd a linter rule for detecting empty files
Joshua Spence [Tue, 1 Sep 2015 09:20:11 +0000 (19:20 +1000)]
Add a linter rule for detecting empty files

Summary: Adds two different linter rules (one general purpose and another PHP specific) to prevent empty files from being added to a repository. For some unknown reason, people seem to like to do this.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: avivey, cburroughs, Korvin

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

11 years agoAdd a linter rule for newlines after PHP open tags
Joshua Spence [Sun, 30 Aug 2015 20:49:29 +0000 (06:49 +1000)]
Add a linter rule for newlines after PHP open tags

Summary: `<?php\n\n...` is much easier to read than `<?php\n...`. Depends on D13889 and D13890.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

11 years agoRemove leftover code for "postponed" lint and unit status
Joshua Spence [Sun, 30 Aug 2015 11:52:34 +0000 (21:52 +1000)]
Remove leftover code for "postponed" lint and unit status

Summary: Ref T9134. It looks like this functionality was removed in D13848. Depends on D13869.

Test Plan: Ran `arc diff`, `arc lint` and `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9134

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

11 years agoarc linters: Filter by name, make display one-line
Aviv Eyal [Fri, 28 Aug 2015 10:26:29 +0000 (03:26 -0700)]
arc linters: Filter by name, make display one-line

Summary: allow searching/filtering linters displayed by name.

Test Plan:
`$ arc linters --verbose --search JSon --search ruby` (Lots of text about many linters)
`$ arc linters --search JSon ruby` (error message)
`$ arc linters python` (no results, "try --search").
`$ arc linters ruby` (Verbose text about the "ruby" linter).

Reviewers: joshuaspence, #blessed_reviewers, epriestley

Reviewed By: joshuaspence, #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoFix linter rule after XHPAST change
Joshua Spence [Thu, 27 Aug 2015 12:08:49 +0000 (22:08 +1000)]
Fix linter rule after XHPAST change

Summary: Depends on D13959.

Test Plan: Ran unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

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

11 years agoUse 'remote.origin.url' fallback for git < 1.7.5
Javier Arteaga [Wed, 26 Aug 2015 22:59:03 +0000 (15:59 -0700)]
Use 'remote.origin.url' fallback for git < 1.7.5

Summary:
'git ls-remote --get-url' is more correct, but younger and less
supported. This commit tempers previous optimism about its availability,
improving support for users of older git packages.

Test Plan:
* Set `git config url.xttps.insteadOf https` rewrite rule.
* Ran `arc which` with git 1.7.5 in `$PATH`, saw rewritten configured remote.
* Ran `arc which` with git 1.7.4 in `$PATH`, saw configured remote.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoUse 'git blame --porcelain' for git blame info
Javier Arteaga [Tue, 25 Aug 2015 16:36:15 +0000 (09:36 -0700)]
Use 'git blame --porcelain' for git blame info

Summary:
This guards against stability issues with the output format of 'git
blame' (such as git config, localization (ref T5554) or future changes).

For example, `git config blame.blankboundary true` breaks `arc cover`
before this patch.

Test Plan:
* Set `git config blame.blankboundary true` on a test repo.
* Ran `arc cover`. It failed with an exception ("Bad blame?").
* Applied this patch.
* `arc cover` works.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T5554

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

11 years agoRecover from PyLint raising messages at character "-1"
epriestley [Tue, 25 Aug 2015 04:11:54 +0000 (21:11 -0700)]
Recover from PyLint raising messages at character "-1"

Summary: Fixes T9257. For some messages, PyLint can raise at "character -1", which we don't allow since we don't consider it to make sense.

Test Plan:
  - Added failing unit test from T9257.
  - Applied patch.
  - Test now passes.

Reviewers: joshuaspence, chad

Reviewed By: joshuaspence, chad

Maniphest Tasks: T9257

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

11 years agoRemove two problematic XML linter unit tests
epriestley [Tue, 25 Aug 2015 04:07:28 +0000 (21:07 -0700)]
Remove two problematic XML linter unit tests

Summary:
Fixes T7215. See D13991. These test cases have been failing intermittently for a while.

I think the XML stuff (which we don't control) changed where it raises these warnings: an old version raised them at the end of the attribute, while the new version raises them at the beginning of the attribute. Not totally 100% sure about this since installing multiple versions is fairly inconvenient, but as far as I know both versions raise the warnings, just at different character offsets.

We could do various things to fix these tests (allow the warning to raise at any character, skip the tests based on versions, etc) but I think it's easier to just remove the tests. They don't seem valuable.

Test Plan: Tests failed prior to change; now pass.

Reviewers: chad, joshuaspence

Reviewed By: joshuaspence

Maniphest Tasks: T7215

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

11 years agoMinimize reliance on 'git branch' output format
Javier Arteaga [Tue, 25 Aug 2015 00:57:41 +0000 (17:57 -0700)]
Minimize reliance on 'git branch' output format

Summary:
Ref T5554. Both the current branch name (if on a branch), as well as the
list of all local branches, can be retrieved without having to parse the
output from "git branch".

Unfortunately, there seems to be no git plumbing for "get list of
branches containing this commit" yet.
(see http://marc.info/?l=git&m=141408477614635&w=2)

For that case, this commit whitelists the output from "git branch" using
the known valid branch names from "git for-each-ref".

Test Plan:
Set up a test repo with this structure:
```
|   *  Commit B1, on branch "subfeature"
|  /
| *    Commit A1, on branch "feature"
|/
*      Commit M1, on branch "master"
|
```

In `subfeature`, I tried:
* `arc which --base 'git:branch-unique(master)'`
* `arc feature`
After that, I detached my HEAD (don't worry, I got better) and tried again.

Nothing looked broken.

(Tested with git 1.7.2.5 and 2.5.0.)

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T5554

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

11 years agoAvoid parsing git "remote show" using "ls-remote"
Javier Arteaga [Mon, 24 Aug 2015 11:51:03 +0000 (04:51 -0700)]
Avoid parsing git "remote show" using "ls-remote"

Summary:
Ref T5554. This makes git remote URL detection locale-agnostic.

The previously suggested `git config remote.origin.url` command does
almost the same, but does not support the URL rewriting features in
git-config (`url.<base>.insteadOf`).

This one does, although it has the unintuitive behavior of just printing
the passed remote name when the remote does not exist, or even when
called outside a git repo.

Test Plan:
* Switched to non-english locale in which git has a translation.
* Ran `arc which` on the Arcanist repo. It could not determine the remote URI.
* Applied patch, `arc which` found the URI.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: johnny-bit, Korvin

Maniphest Tasks: T5554

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

11 years agoExclude variables used in strings inside closures when checking for undeclared variables
Joshua Spence [Thu, 20 Aug 2015 21:26:52 +0000 (07:26 +1000)]
Exclude variables used in strings inside closures when checking for undeclared variables

Summary:
Improves upon D13795 to correctly handle variables within strings. Specifically, the  following code currently (incorrectly) warns about `$x` being undeclared:

```lang=php
function some_func() {
  return function ($x) {
    echo "$x";
  };
}
```

It's worth noting that the situation would be improved if XHPAST properly parsed strings (see T8049).

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoAdd a call to `assert_instances_of`
Joshua Spence [Thu, 20 Aug 2015 12:44:52 +0000 (22:44 +1000)]
Add a call to `assert_instances_of`

Summary: This was taken from D13569.

Test Plan: `arc lint` still works.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoFix wrong plural of an `arc land` message
Javier Arteaga [Thu, 20 Aug 2015 11:19:22 +0000 (04:19 -0700)]
Fix wrong plural of an `arc land` message

Summary:
"Branch" was pluralized as "branchs".

Fixes T9225.

Test Plan:
* Created test repo with two revisions on a feature branch.
* Saw old message, frowned a little.
* Applied patch.
* No longer frowning.

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: avivey, Korvin

Maniphest Tasks: T9225

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

11 years agoArcanistPyLintLinter fix to getMandatoryFlags msg-template
ealbright [Wed, 19 Aug 2015 12:45:46 +0000 (05:45 -0700)]
ArcanistPyLintLinter fix to getMandatoryFlags msg-template

Summary: Removed excess quotations on the `--msg-template` option as it was interfering with the string-int coercion

Test Plan: Unsure

Reviewers: joshuaspence, epriestley, #blessed_reviewers

Reviewed By: joshuaspence, epriestley, #blessed_reviewers

Subscribers: joshuaspence, e-m-albright, Korvin

Maniphest Tasks: T9214

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

11 years agoAdd a Composer linter
Joshua Spence [Wed, 19 Aug 2015 11:39:11 +0000 (21:39 +1000)]
Add a Composer linter

Summary: Adds a basic linter for ensuring that `composer.lock` files are up-to-date.

Test Plan: We have been using this in a private project for around a month.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: johnny-bit, Korvin

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

11 years agoImprove linter handling of short array syntax
Joshua Spence [Wed, 19 Aug 2015 05:35:16 +0000 (15:35 +1000)]
Improve linter handling of short array syntax

Summary: Currently, linting PHP short array syntax (i.e. `[...]`) throws an exception ("Expected open parentheses"). This diff relaxes some restrictions which prevent short array syntax from linting with `ArcanistParenthesesSpacingXHPASTLinterRule`.

Test Plan: Modified test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: agenticarus, Korvin

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

11 years agoImprove the "inline HTML" linter rule
Joshua Spence [Wed, 19 Aug 2015 05:34:43 +0000 (15:34 +1000)]
Improve the "inline HTML" linter rule

Summary: Improve `ArcanistInlineHTMLXHPASTLinterRule` such that it doesn't raise duplicate warnings. Also be a bit more lax with whitespace.

Test Plan: Unit tests now pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

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

11 years agoAdd a linter rule for the use of `parse_str`
Joshua Spence [Thu, 13 Aug 2015 21:44:19 +0000 (07:44 +1000)]
Add a linter rule for the use of `parse_str`

Summary: The use of the [[http://php.net/manual/en/function.parse-str.php | parse_str]] method (when called without sepcifying a second parameter) hinders static analysis. Specifically, the `parse_str('...')` behaves similarly to [[http://php.net/manual/en/function.extract.php | extract]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoAdd a linter rule for inline HTML
Joshua Spence [Thu, 13 Aug 2015 21:41:41 +0000 (07:41 +1000)]
Add a linter rule for inline HTML

Summary: Ref T7409. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php | InlineHTMLSniff]].

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9140, T7409

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

11 years agoAdd a linter rule for global variables
Joshua Spence [Thu, 13 Aug 2015 21:37:48 +0000 (07:37 +1000)]
Add a linter rule for global variables

Summary: Ref T7409. Global variables are gross and should be avoided like the plague.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T7409

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

11 years agoAdd a linter rule for list assignments
Joshua Spence [Wed, 12 Aug 2015 03:22:37 +0000 (13:22 +1000)]
Add a linter rule for list assignments

Summary: Add a linter rule to prevent trailing commas in a list assignment. `list($x, $y,)` is equivalent to `list($x, $y)`, but the latter is cleaner and should be preferred.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoRestore default "yes" behavior for lint patch
Aiden Scandella [Tue, 11 Aug 2015 21:49:48 +0000 (14:49 -0700)]
Restore default "yes" behavior for lint patch

Summary:
Fixes T9029

See T9029 for more details, but basically at some point phutil_console_confirm
(which takes a `$default_no` parameter) was refactored to `$console->confirm()`
which takes a `$default` parameter with semantics negated..

Test Plan:
Run `arc lint` on a repository where patch is suggested. Default
option should be "[Y/n]" to accept the patch.

Reviewers: joshuaspence, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T9029

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

11 years agoMove a test file
Joshua Spence [Tue, 11 Aug 2015 12:50:57 +0000 (22:50 +1000)]
Move a test file

Summary: This is a test case for `ArcanistXHPASTLinter`, not `ArcanistPhutilXHPASTLinter`.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoFix `arc unit --everything`
Joshua Spence [Tue, 11 Aug 2015 12:37:28 +0000 (22:37 +1000)]
Fix `arc unit --everything`

Summary: This was broken in D13573.

Test Plan: Ran `arc unit --everything` in rPHU.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

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

11 years agoVarious linter fixes
Joshua Spence [Tue, 11 Aug 2015 12:35:40 +0000 (22:35 +1000)]
Various linter fixes

Summary: Self explanatory.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

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

11 years agoImprove linter rules for array formatting
Joshua Spence [Tue, 11 Aug 2015 12:34:38 +0000 (22:34 +1000)]
Improve linter rules for array formatting

Summary: Modify `ArcanistParenthesesSpacingXHPASTLinterRule` and `ArcanistCallParenthesesXHPASTLinterRule` to apply to `array()` and `list()` as well. Depends on D13858.

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoFix failing JSHint linter test
Joshua Spence [Tue, 11 Aug 2015 12:33:12 +0000 (22:33 +1000)]
Fix failing JSHint linter test

Summary: This test case is failing on JSHint v2.8.0.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoPreserve more information when merging coverage
epriestley [Mon, 10 Aug 2015 22:35:15 +0000 (15:35 -0700)]
Preserve more information when merging coverage

Summary:
Ref T8096. Each test reports coverage information, which we sometimes merge into a combined coverage report.

Usually, each test will report results for every line in the file, so if the file is 30 lines long, coverage is usually 30 characters long.

However, for whatever reason, tests might report results for only the first part of the file. This is allowed and we handle it properly.

Right now, if one test reports 10 lines of results and another reports 30 lines of results, we only use the first 10 lines of results. Instead, extend the merged coverage to include the extra 20 lines of results.

(This is an uncommon case which I only hit because I was manually banging on my keyboard to generate test data, but there's no reason not to handle it better.)

Test Plan: Used web UI, added + executed unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8096

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

11 years agoAutomatically use the configuration driven unit test engine
Joshua Spence [Mon, 10 Aug 2015 21:55:38 +0000 (07:55 +1000)]
Automatically use the configuration driven unit test engine

Summary: Ref T5568. Use the `ArcanistConfigurationDrivenUnitTestEngine` automatically, if an `.arcunit` file exists. This behavior mimics the auto-detection for the configuration driven lint engine.

Test Plan:
Ran through the following scenarios:

  - Ran `arc unit` and saw unit tests execute.
  - Ran `arc unit --engine PhutilUnitTestEngine`
  - Remove the `.arcunit` file and ran `arc unit`... got an exception.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T5568

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

11 years agoMinor improvement for array value linter rule
Joshua Spence [Mon, 10 Aug 2015 21:55:11 +0000 (07:55 +1000)]
Minor improvement for array value linter rule

Summary:
This linter rule fails on multi-line arrays with no whitespace before the first array value. Specifically, the following exception is thrown:

```
Fatal error: Call to a member function isAnyWhitespace() on boolean in arcanist/src/lint/linter/xhpast/rules/ArcanistArrayValueXHPASTLinterRule.php on line 40
```

Test Plan: Added another test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoAdd a linter rule for array elements
Joshua Spence [Mon, 10 Aug 2015 20:58:28 +0000 (06:58 +1000)]
Add a linter rule for array elements

Summary: Add a linter rule to ensure that array elements occupy a single line each.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoRough version of configuration driven unit test engine
Joshua Spence [Mon, 10 Aug 2015 20:54:15 +0000 (06:54 +1000)]
Rough version of configuration driven unit test engine

Summary: Ref T5568. As discussed in IRC. This is very rough and not widely useable, but represents a solid first step.

Test Plan: Ran `arc unit` with a bunch of flags.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: rfreebern, aripringle, jaydiablo, BYK, tycho.tatitscheff, epriestley, Korvin

Maniphest Tasks: T5568

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

11 years agoUse PhutilClassMapQuery instead of PhutilSymbolLoader
Joshua Spence [Mon, 10 Aug 2015 20:50:47 +0000 (06:50 +1000)]
Use PhutilClassMapQuery instead of PhutilSymbolLoader

Summary: Use `PhutilClassMapQuery` instead of `PhutilSymbolLoader`, mainly for consistency. Depends on D13572.

Test Plan: This hasn't been tested very comphrehensively as of yet.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoFix self member reference rule for PHP 5.3
Joshua Spence [Mon, 10 Aug 2015 20:49:54 +0000 (06:49 +1000)]
Fix self member reference rule for PHP 5.3

Summary:
Fixes T8674. Currently, `ArcanistSelfMemberReferenceXHPASTLinterRule` warns if a fully-qualified class name is used in place of `self`. This is fine in most cases, but in some specific scenarios fails for PHP 5.3 because `self` (and also `$this`) cannot be used in an anonymous closure (see [[http://php.net/manual/en/functions.anonymous.php | anonymous functions]] and [[https://wiki.php.net/rfc/closures/removal-of-this | removal of `$this` in closures]]).

In order to do this, I also had to modify the manner in which configuration was passed to individual linter rule. Previously, it was only possible or an individual linter rule to be set with a configuration value. Once the linter rule had set this value, there was no means by which to allow this value to be shared amongst linter rules.

Depends on D13819.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T8674

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

11 years agoImprove useless overriding method linter rule
Joshua Spence [Mon, 10 Aug 2015 20:49:20 +0000 (06:49 +1000)]
Improve useless overriding method linter rule

Summary:
Improve `ArcanistUselessOverridingMethodXHPASTLinterRule` by allowing overriding methods which set default values. For example, the following scenario is perfectly valid:

```lang=php

class SomeClass {
  public function __construct($x) {}
}

class SomeOtherClass extends Class {
  public function __construct($x = null) {
    parent::__construct($x);
  }
}
```

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoImprove PHP compatibility linter
Joshua Spence [Mon, 10 Aug 2015 20:48:56 +0000 (06:48 +1000)]
Improve PHP compatibility linter

Summary: Ref T8674. Adds to `ArcanistPHPCompatibilityXHPASTLinterRule` such that an error is raised whenever `self` or `$this` is used in an anonymous closure prior to PHP 5.4.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T8674

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

11 years agoImprove declaration formatting linter rule for anonymous functions
Joshua Spence [Sat, 8 Aug 2015 13:30:24 +0000 (23:30 +1000)]
Improve declaration formatting linter rule for anonymous functions

Summary: Ref T8742. Anonymous functions should have a space after the `function` keyword. Additionally, ensure that there is a space before and after the `use` token.

Test Plan: Modified existing test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T8742

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

11 years agoMinor linter fix
Joshua Spence [Sat, 8 Aug 2015 00:18:59 +0000 (10:18 +1000)]
Minor linter fix

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

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

11 years agoAdd a linter rule for unary postfix expression spacing
Joshua Spence [Thu, 6 Aug 2015 01:38:14 +0000 (11:38 +1000)]
Add a linter rule for unary postfix expression spacing

Summary: Unary postfix expressions should not have a space before the operator.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoAdd a linter rule for object operator spacing
Joshua Spence [Wed, 5 Aug 2015 21:14:38 +0000 (07:14 +1000)]
Add a linter rule for object operator spacing

Summary: Add a linter rule to check that there is no whitespace surrounding the object operator, `->`.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoAdd a linter rule for unary prefix expression spacing
Joshua Spence [Wed, 5 Aug 2015 21:00:32 +0000 (07:00 +1000)]
Add a linter rule for unary prefix expression spacing

Summary: Add a linter rule to ensure that there is no space between the operator and the operand in a unary prefix expression.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

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

11 years agoAdd a linter rule for spacing before opening parenthesis in function calls
Joshua Spence [Wed, 5 Aug 2015 20:57:46 +0000 (06:57 +1000)]
Add a linter rule for spacing before opening parenthesis in function calls

Summary: Repurpose `ArcanistClosingCallParenthesesXHPASTLinterRule` (and rename it to `ArcanistCallParenthesesXHPASTLinterRule`) to ensure that there is no spacing before opening parenthesis in function calls.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

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

11 years agoImprove undeclared variables linter rule
Joshua Spence [Wed, 5 Aug 2015 20:57:16 +0000 (06:57 +1000)]
Improve undeclared variables linter rule

Summary: Currently `ArcanistUndeclaredVariableXHPASTLinterRule` does not properly handle anonymous closures.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: johnny-bit, Korvin

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

11 years agoAllow closing tags in files containing HTML
Joshua Spence [Wed, 5 Aug 2015 20:56:26 +0000 (06:56 +1000)]
Allow closing tags in files containing HTML

Summary: Ref T8742. PHP files which contain inline HTML should be allowed to use PHP closing tags (`?>`). This is in accordance with [[https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md | PSR-2 guidelines]].

Test Plan: Updated unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T8742

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

11 years agoAdd more information about Harbormaster/Unit result codes to Arcanist
epriestley [Tue, 4 Aug 2015 20:05:38 +0000 (13:05 -0700)]
Add more information about Harbormaster/Unit result codes to Arcanist

Summary: Ref T7419. This makes it easier to render helpful documentation in the next diff without having to copy/paste things.

Test Plan:
In next diff:

{F688894}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7419

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

11 years agoFix some failing unit tests
Joshua Spence [Sun, 2 Aug 2015 20:47:47 +0000 (06:47 +1000)]
Fix some failing unit tests

Summary: I somehow missed these.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoFix an undeclared property
Joshua Spence [Sun, 2 Aug 2015 20:47:20 +0000 (06:47 +1000)]
Fix an undeclared property

Summary: `NoseTestEngine::$parser` is undefined.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoAlso coerce "char" for lint messages
epriestley [Tue, 28 Jul 2015 23:31:03 +0000 (16:31 -0700)]
Also coerce "char" for lint messages

Summary: Ref T8921. See similar change in D13695. This expands the scope to also coerce `setChar()`.

Test Plan: `arc unit --everything`

Reviewers: btrahan

Subscribers: epriestley

Maniphest Tasks: T8921

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

11 years agoAdd $projectRoot to PytestTestEngine
Lukas Sparrow [Fri, 24 Jul 2015 12:11:32 +0000 (05:11 -0700)]
Add $projectRoot to PytestTestEngine

Summary:
Fixes T8912. Property `$project_root` was missing in `PytestTestEngine` class, resulting in
broken py.test wrapper. Also renaming the property so the linter is happy.

Test Plan: `arc unit --everything`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: kparal, epriestley, Korvin

Maniphest Tasks: T8912

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

11 years agoImprove strictness around `setLine()` types in ArcanistLintMessage
epriestley [Thu, 23 Jul 2015 20:19:53 +0000 (13:19 -0700)]
Improve strictness around `setLine()` types in ArcanistLintMessage

Summary: Fixes T8921. Harbormaster is strict about types it accepts, but `ArcanistLintMessage` is more liberal. Push the strictness barrier down to the linter level, while maintaining reasonable flexibility in the API.

Test Plan: `arc unit --everything`

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8921

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

11 years agoFix checkstyle severities
Joshua Spence [Wed, 22 Jul 2015 23:09:33 +0000 (09:09 +1000)]
Fix checkstyle severities

Summary: "Advice" is not a valid severity for Checkstyle... valid severities are `ignore`, `info`, `warning` and `error`.

Test Plan: Read the [[http://checkstyle.sourceforge.net/property_types.html | documentation]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoImprove the declaration parentheses linting
Joshua Spence [Wed, 22 Jul 2015 20:43:35 +0000 (06:43 +1000)]
Improve the declaration parentheses linting

Summary: Improve `ArcanistClosingDeclarationParenthesesXHPASTLinterRule` (and rename it to `ArcanistDeclarationParenthesesXHPASTLinterRule`) to ensure that there is no whitespace before the opening parenthesis of a function/method declaration.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoFix typo. Closes T8915.
Yomi [Tue, 21 Jul 2015 18:14:39 +0000 (11:14 -0700)]
Fix typo. Closes T8915.

Summary:
From 'or' to 'are'.
Closes T8915.

Test Plan: Wait 30 seconds.

Reviewers: joshuaspence, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8915

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

11 years agoFix brace formatting linter rule
Joshua Spence [Fri, 17 Jul 2015 06:40:45 +0000 (16:40 +1000)]
Fix brace formatting linter rule

Summary: Fixes T8847.

Test Plan:
Ran `arc lint` on a test file:

```lang=php
<?php

if ($x) {
  echo 'foo';
}else {
  echo 'bar';
}
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8847

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

11 years agoFix unitialized variable in ArcanistPhpunitTestResultParser
Sebastian Szulc [Thu, 16 Jul 2015 20:40:04 +0000 (13:40 -0700)]
Fix unitialized variable in ArcanistPhpunitTestResultParser

Summary:
This is to fix `arc unit` when running a test file with no test results (e.g. skipped)
```
EXCEPTION: (RuntimeException) Undefined variable: last_test_finished at [<phutil>/src/error/PhutilErrorHandler.php:210]
arcanist(head=master, ref.master=d54cb072facd), deviantart(), phutil(head=master, ref.master=75f675747648)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/unit/parser/ArcanistPhpunitTestResultParser.php:95]
  #1 ArcanistPhpunitTestResultParser::parseTestResults(string, string) called at [<deviantart>/unit/DaUnitEngine.php:150]
  #2 DaUnitEngine::parseTestResults(string, TempFile, string, string) called at [<deviantart>/unit/DaUnitEngine.php:82]
  #3 DaUnitEngine::run() called at [<arcanist>/src/workflow/ArcanistUnitWorkflow.php:186]
  #4 ArcanistUnitWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
```

Test Plan: Create a test file with skipped tests. Run `arc unit`. Make sure the exception is not thrown.

Reviewers: joshuaspence, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

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

11 years agoMake test result parsing stricter about duration formats
epriestley [Wed, 15 Jul 2015 20:26:15 +0000 (13:26 -0700)]
Make test result parsing stricter about duration formats

Summary: Fixes T8805. Explicitly require int/float for duration. Adjust XUnit/Go parsers to provide one.

Test Plan: Ran unit tests.

Reviewers: btrahan, joshuaspence, chad

Reviewed By: chad

Subscribers: jsotuyod, champo, epriestley

Maniphest Tasks: T8805

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

11 years agoOutput lint XML results to a file
Joshua Spence [Tue, 14 Jul 2015 20:57:39 +0000 (06:57 +1000)]
Output lint XML results to a file

Summary:
Ref T8332. I find it really odd that I need to run `arc lint --everything --output xml > checkstyle.xml` and feel that it would be much more intuitive to just run `arc lint --everything --output xml` and have the output written to `checkstyle.xml`.

To provide context, we are running `arc lint --everything` in a CI job and parsing the results.

Test Plan: Ran `arc lint --everything --output xml` and saw the output written to file.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8332

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

11 years agoRemove verbose output from `arc lint --trace`
Joshua Spence [Wed, 8 Jul 2015 10:03:00 +0000 (20:03 +1000)]
Remove verbose output from `arc lint --trace`

Summary: I think that this output was used during the early stage of `ArcanistConfigurationDrivenLintEngine`, but I question it's value nowadays. In particular, I find that this output makes the output of `arc lint --trace` significantly less useful.

Test Plan: Ran `./bin/arc lint --trace` and saw useful output.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoMinor performance optimization
Joshua Spence [Wed, 8 Jul 2015 08:32:08 +0000 (18:32 +1000)]
Minor performance optimization

Summary: Avoid using `idx` in `PhutilTestCase::endCoverage`.

Test Plan: Compared [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-tgmc6ci74daivtankuck/?symbol=idx | before]] and [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-nd77mled6xnezyxidd6m/?symbol=idx | after]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoUpdate references to "www.phabricator.com" in Arcanist
epriestley [Tue, 7 Jul 2015 20:34:56 +0000 (13:34 -0700)]
Update references to "www.phabricator.com" in Arcanist

Summary: This host is no longer in service.

Test Plan: `git grep -i www.phabricator.com`

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

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

11 years agoUse PhutilClassMapQuery
Joshua Spence [Tue, 7 Jul 2015 09:22:12 +0000 (19:22 +1000)]
Use PhutilClassMapQuery

Summary: Use `PhutilClassMapQuery` where appropriate.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoLinter performance optimization
Joshua Spence [Tue, 7 Jul 2015 07:56:12 +0000 (17:56 +1000)]
Linter performance optimization

Summary: Optimize `ArcanistXHPASTLinterRule::getLintID`.

Test Plan: Compare [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-wwgi4xzupt4z2fvbyff3/?symbol=mpull | before]] and [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-rn2ialomtr2apnkzisb3/?symbol=mpull | after]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoRaise a more tailored error message when a third-party test engine returns bad results
epriestley [Wed, 1 Jul 2015 11:48:52 +0000 (04:48 -0700)]
Raise a more tailored error message when a third-party test engine returns bad results

Summary: Fixes T8714. When a test engine isn't returning the correct result type, shift suspicion onto it.

Test Plan: Faked error, got exception blaming test engine.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8714

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

11 years agoDon't fail lint builds for "advice"; make lint/unit upload failures louder
epriestley [Thu, 25 Jun 2015 17:05:54 +0000 (10:05 -0700)]
Don't fail lint builds for "advice"; make lint/unit upload failures louder

Summary:
Ref T8670. Ref T8657.

  - When lint only has advice (no warnings/errors), consider it a "passing" build.
  - Be a little louder about `sendmessage` calls failing because this stuff is not totally broken and that makes T8670-related things easier to catch/fix.

Test Plan: Created this revision.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8657, T8670

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

11 years agoReturn `$this` from setter methods
Joshua Spence [Thu, 25 Jun 2015 12:30:33 +0000 (22:30 +1000)]
Return `$this` from setter methods

Summary: Return `$this` from a bunch of setter methods for consistency. See also D13422.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

11 years agoEnsure that a space is used after a catch token
Joshua Spence [Wed, 24 Jun 2015 21:09:17 +0000 (07:09 +1000)]
Ensure that a space is used after a catch token

Summary: For consistency, a single space should separate `catch` and the following parenthetical expression.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoTry to ship lint and unit results to Harbormaster autotargets
epriestley [Tue, 23 Jun 2015 17:22:57 +0000 (10:22 -0700)]
Try to ship lint and unit results to Harbormaster autotargets

Summary:
Ref T8095. Before uploading lint/unit results in the old way, try to ship them to autotargets.

If we can query and upload data to autotargets, do so, and then skip the older style uploads.

Test Plan: Used `arc diff` to ship data up via Harbormaster.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8095

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

11 years agoFix arcanist shell completion
Joshua Spence [Fri, 19 Jun 2015 03:15:43 +0000 (13:15 +1000)]
Fix arcanist shell completion

Summary: Fixes T8560.

Test Plan: Ran `arc shell-complete` outside of a working copy.

Reviewers: avivey, #blessed_reviewers, epriestley

Reviewed By: avivey, #blessed_reviewers, epriestley

Subscribers: avivey, epriestley, Korvin

Maniphest Tasks: T8560

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

11 years agoUse PhutilInvalidStateException
Joshua Spence [Thu, 18 Jun 2015 12:41:29 +0000 (22:41 +1000)]
Use PhutilInvalidStateException

Summary: Use `PhutilInvalidStateException` where appropriate.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoFix missing property on ArcanistTestResultParser
epriestley [Mon, 15 Jun 2015 20:59:54 +0000 (13:59 -0700)]
Fix missing property on ArcanistTestResultParser

Fixes T8554 (properly, this time).

Auditors: joshuaspence

11 years agoFix missing property in ArcanistPhpunitTestResultParser
epriestley [Mon, 15 Jun 2015 20:39:00 +0000 (13:39 -0700)]
Fix missing property in ArcanistPhpunitTestResultParser

Fixes T8554.

Auditors: joshuaspence

11 years agoAdd some tests for subclasses
Joshua Spence [Mon, 15 Jun 2015 10:00:54 +0000 (20:00 +1000)]
Add some tests for subclasses

Summary: Add some tests to ensure that `ArcanistXHPASTLinterRule` subclasses are properly implemented. This should catch issues such as two linter rules having the same `ID` value. See D13272 for a similar change.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

11 years agoExtend from Phobject
Joshua Spence [Mon, 15 Jun 2015 05:45:13 +0000 (15:45 +1000)]
Extend from Phobject

Summary: All base classes should extend from `Phobject` or some other classes. See D13275 for some explanation.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

11 years agoAdd a linter rule for extending Phobject
Joshua Spence [Mon, 15 Jun 2015 05:44:00 +0000 (15:44 +1000)]
Add a linter rule for extending Phobject

Summary: If I understand correctly, all classes should extend from `Phobject`?

Test Plan: This needs some further work

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

11 years agoRemove "@stable" annotation
Joshua Spence [Sun, 14 Jun 2015 21:51:43 +0000 (07:51 +1000)]
Remove "@stable" annotation

Summary: I don't believe that `@stable` is useful anymore?

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoFurther improvements to test discovery
Joshua Spence [Sun, 14 Jun 2015 21:23:17 +0000 (07:23 +1000)]
Further improvements to test discovery

Summary: I found another issue with T8042... it seems that tests from the root directory (i.e. `src/__tests__` are not being discovered properly). The handling of this case (`$library_path` being the library root directory) can probably be improved, and I am open to suggestions. Depends on D13202.

Test Plan: Added to existing test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoMark some strings for translation
Joshua Spence [Mon, 8 Jun 2015 21:17:39 +0000 (07:17 +1000)]
Mark some strings for translation

Summary: Add some more `pht`izations.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoMinor documentation improvements
Joshua Spence [Mon, 8 Jun 2015 01:31:35 +0000 (11:31 +1000)]
Minor documentation improvements

Summary: Minor tidying of documentation and adding some groups.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoImprove test discovery with PhutilUnitTestEngine
Joshua Spence [Wed, 3 Jun 2015 11:07:17 +0000 (21:07 +1000)]
Improve test discovery with PhutilUnitTestEngine

Summary:
Ref T8042. Tests were not being discovered in two different scenarios:

  # Files modified at the same level as the library root directory.
  # "Normal" directories like `src/unit/engine`.

This regression was caused by D12689.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8042

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

11 years agoLinter fixes
Joshua Spence [Tue, 2 Jun 2015 12:13:21 +0000 (22:13 +1000)]
Linter fixes

Summary: Apply various minor linter fixes.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

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

11 years agoFix a translation ("to ignore these changes...")
epriestley [Mon, 1 Jun 2015 13:50:46 +0000 (06:50 -0700)]
Fix a translation ("to ignore these changes...")

Summary: Fixes T8374.

Test Plan:
```
$ arc diff
You have untracked files in this working copy.

  Working copy: /Users/epriestley/dev/core/lib/arcanist/

  Untracked changes in working copy:
  (To ignore this change, add it to ".git/info/exclude".)
    derp

    Ignore this untracked file and continue? [y/N] ^C
```

Reviewers: btrahan, joshuaspence, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8374

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

11 years agoSplit the `ArcanistXHPASTLinter` into modular rules
Joshua Spence [Mon, 1 Jun 2015 05:49:16 +0000 (15:49 +1000)]
Split the `ArcanistXHPASTLinter` into modular rules

Summary:
The `ArcanistXHPASTLinter` class is becoming quite bloated. This diff separates the class into one-class-per-rule, which makes everything much more modular. One downside to this decoupling is that code reuse between linter rules is much more difficult, although this only affects a very small number of linter rules.

There is still some further work that could be done here, but I defer this until a later diff:

  - Rewrite `ArcanistPhutilXHPASTLinter` using `ArcanistXHPASTLinterRule`.
  - Change the unit tests so that they are truly only testing a single linter rule.
  - Maybe improve the way in which linter configuration options are handled.
  - Make it easier to keep track of the linter rule IDs (see T6859).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: johnny-bit, epriestley, Korvin

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

11 years agoAlways return an array from ArcanistWorkflow->loadProjectRepository()
epriestley [Thu, 28 May 2015 23:10:59 +0000 (16:10 -0700)]
Always return an array from ArcanistWorkflow->loadProjectRepository()

Summary: Fixes T8344. Prior to D12971, this always returned `array()`. It may now sometimes return `null`. Switch the behavior to be more similar to the old behavior.

Test Plan: Inspection.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T8344

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

11 years agoAllow PhutilUnitTestEngine to execute tests from a single path
Joshua Spence [Thu, 28 May 2015 08:25:56 +0000 (18:25 +1000)]
Allow PhutilUnitTestEngine to execute tests from a single path

Summary: Fixes T8042. Changes the way that `PhutilUnitTestEngine` discovers unit tests. In particular, if you only modify a single test case then there is no reason to run all other test cases within the same directory (which is the current behavior).

Test Plan: Added some unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8042

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

11 years agoSend arcanist error output to STDERR
Joshua Spence [Wed, 27 May 2015 23:10:32 +0000 (09:10 +1000)]
Send arcanist error output to STDERR

Summary: Currently, arcanist error output is sent to `STDOUT` instead of `STDOUT`. This is annoying because I am running `arc lint --everything --never-apply-patches --output=xml > checkstyle.xml` and the `checkstyle.xml` file is not valid XML.

Test Plan: Forced a linter to throw an exception and ran `arc lint >/dev/null`... saw error output.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoPush to staging areas when running "arc diff"
epriestley [Wed, 27 May 2015 17:27:03 +0000 (10:27 -0700)]
Push to staging areas when running "arc diff"

Summary: Ref T8238. If a staging area is configured for a repository (see D13019), push a copy of changes to it after creating a diff.

Test Plan: Ran `arc diff` with various options, saw applicable changes get pushed to staging.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: cburroughs, epriestley

Maniphest Tasks: T8238

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

11 years agoProvide more documentation for Arcanist upload stuff
epriestley [Wed, 27 May 2015 17:26:27 +0000 (10:26 -0700)]
Provide more documentation for Arcanist upload stuff

Summary: Ref T8259. Make some highly-ambiguous methods like `setData()` more clear.

Test Plan: reading

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8259

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

11 years agoUse file.allocate to upload large files from `arc diff`
epriestley [Wed, 27 May 2015 17:26:12 +0000 (10:26 -0700)]
Use file.allocate to upload large files from `arc diff`

Summary: Fixes T8259. Depends on D13016. Use modern logic to support large file uploads.

Test Plan:
  - Diffed with some images, saw them show up in the diff.
  - Diffed with a 12MB binary, saw it upload in chunks.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8259

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

11 years agoMove Conduit file upload logic into a separate class
epriestley [Wed, 27 May 2015 17:25:53 +0000 (10:25 -0700)]
Move Conduit file upload logic into a separate class

Summary:
Ref T8259. Currently, `arc upload` uses new logic but `arc diff` uses older logic internally. This prevents `arc diff` from uploading files larger than 4MB to newer servers.

Split the upload logic apart so the two upload pathways can share it. Callers now build a list of FileDataRefs and hand them to an Uploader for upload.

Test Plan:
Ran `arc upload` on:

  - One file.
  - Several files.
  - Small files.
  - Big files.
  - Directories.
  - Unreadable files.
  - Files full of random data.
  - The same file over and over again.
  - The same big file over and over again.
  - Artificially broke `file.allocate` and redid some of the simple cases (large/chunked aren't expected to work in this case).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T8259

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

11 years agoFix invalid parameter in phutil_console_wrap()
Nevogd [Tue, 26 May 2015 13:07:02 +0000 (06:07 -0700)]
Fix invalid parameter in phutil_console_wrap()

Summary:
Fixes T8314. Change the phutil_console_wrap() call to only have a single
string parameter.

Test Plan:
Ran `arc diff` added text into the title, summary and test plan fields,
but did not specify any reviewers. When prompted to continue, clicked 'No' and
saw the '(Message saved to commit message.)' string.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T8314

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

11 years agoRemove arcanist projects from working copy code
Joshua Spence [Mon, 25 May 2015 21:08:56 +0000 (07:08 +1000)]
Remove arcanist projects from working copy code

Summary: Ref T7604. Remove "arcanist projects" from `ArcanistWorkingCopy` and a few other callsites. Depends on D12999.

Test Plan: Can't really think of how to test this.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T7604

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

11 years agoRemove "project.name" from `.arcconfig"
Joshua Spence [Mon, 25 May 2015 12:42:31 +0000 (22:42 +1000)]
Remove "project.name" from `.arcconfig"

Summary: Ref T7604. Remove the `project.name` configuration from `.arcconfig`. Depends on D12999.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

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

11 years agoRemove reentrant code
Joshua Spence [Mon, 25 May 2015 12:41:22 +0000 (22:41 +1000)]
Remove reentrant code

Summary: Ref T7604. Remove the `reenter_if_this_is_arcanist_or_libphutil` function. Some discussion in D12945.

Test Plan: Ran `./bin/arc --trace help` and saw things happen as expected.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

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

11 years agoRemove call to "arcanist.projectinfo" from ArcanistWorkflow
Joshua Spence [Mon, 25 May 2015 12:04:50 +0000 (22:04 +1000)]
Remove call to "arcanist.projectinfo" from ArcanistWorkflow

Summary: Ref T7604. Remove call to the `arcanist.projectinfo` #conduit endpoint from `ArcanistWorkflow`. Depends on D12992.

Test Plan: Ran `arc which` and verified that repository information was present.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Maniphest Tasks: T7604

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

11 years agoFix some format strings
Joshua Spence [Mon, 25 May 2015 11:20:43 +0000 (21:20 +1000)]
Fix some format strings

Summary: These `pht` calls use `%d` instead of `%s`.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoFix sanity checks for patch workflow
Joshua Spence [Mon, 25 May 2015 08:38:55 +0000 (18:38 +1000)]
Fix sanity checks for patch workflow

Summary:
Ref T7604. Ref T8307. This was broken in D12962 because I only tested `arc patch --arcbundle`. Furthermore, this particular sanity check doesn't actually do anything now (see T8307).

Test Plan:
Ran `arc patch --nobranch D12971` successfully.

Auditors: epriestley

11 years agoRemove call to "arcanist.projectinfo" from `arc export`
Joshua Spence [Mon, 25 May 2015 08:31:09 +0000 (18:31 +1000)]
Remove call to "arcanist.projectinfo" from `arc export`

Summary:
Ref T7604. Remove a call to `arcanist.projectinfo` from `arc export`. This Conduit call was only used to detect the repository encoding, which we should be able to do locally anyway.

I was considering removing the `$projectName` from `ArcanistBundle` as well, but I'm not convinved that this is a good idea. Specifically, doing so would make it difficult to issue the "This patch is for the 'X' project, but the working copy belongs to the 'Y' project" error. We could potentially use the repository callsign for this purposes, but this isn't portable across installs.

Test Plan: I'm not quite sure how to test this. I suspect that this functionality isn't widely used anyway.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

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