1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-12 18:02:39 +01:00
Commit graph

1910 commits

Author SHA1 Message Date
Alex Vandiver
ad3087e5e1 Correctly parse git status --porcelain=2 output with filenames with spaces
Summary:
Filenames are last in `git status --porcelain=2` lines; they
are not escaped in any way, despite the fields being
whitespace-delimited.  `explode` thus happily chops apart filenames
with spaces in them, causing later git operations to operate only on
the filename up to the first space.

Split the lines into the right number of elements -- in all cases,
this is one more than the index we're using, since filenames come last.

Test Plan:
Altering a file with a space in its path, and running `arc diff -a`.

Added tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D19389
2018-04-19 19:17:16 -07:00
epriestley
73f5afd441 Remove "very large change" warning from Arcanist
Summary: Ref T13110. We now degrade very large changes and I'm not convinced any user ever entered "n" at this prompt.

Test Plan: Ran `arc diff` to create this very revision.

Maniphest Tasks: T13110

Differential Revision: https://secure.phabricator.com/D19299
2018-04-05 06:50:57 -07:00
epriestley
e44a2d3ac0 Improve argument parsing for "arc patch --revision Dxxx"
Summary: See PHI527. Ref T13116. The `--revision` flag currently fails if the argument is in the form `D123` instead of `123`. Normalize monogram arguments.

Test Plan: Ran `arc patch --revision Dxxx`, `arc patch --revision xxx`, `arc patch --revision xxx --diff yyy`, `arc patch`; got good behavior on the good ones and sensible error messages on the other ones.

Maniphest Tasks: T13116

Differential Revision: https://secure.phabricator.com/D19292
2018-04-03 10:56:46 -07:00
epriestley
b8c9c385a7 Survive extra "obsolete:" log output from the Mercurial evolve extension
Summary: See PHI502; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1448137>.

Test Plan: I spent all of three minutes trying to install the `evolve` extension without success and gave up, but this probably does the right thing based on the example output in the Bugzilla issue.

Differential Revision: https://secure.phabricator.com/D19262
2018-03-26 14:12:15 -07:00
Alex Vandiver
bf3d32e34e Remove accidental sprintf injection in error reporting
Summary:
STDERR output with `%`s in it could cause:

```
ERROR 2: fprintf(): Too few arguments at [/usr/local/arcanist/src/workflow/ArcanistFeatureWorkflow.php:170]
```

Test Plan: Untested.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D19261
2018-03-26 13:56:50 -07:00
Nathan LeClaire
dcd7ef66d0 Add support for Go 1.10 (cached) output
Summary:
In Go 1.10 the output for tests was changed to have also a "(cached)" mode in
addition to the normal timing info printed. This is on by default. This adds
support for parsing these lines instead of erroring out on the regex.

Test Plan: Have a unit test included, and will continue to poke at it locally.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19161
2018-03-02 16:34:25 -08:00
epriestley
be1dd7e2ba Robustly fuse files together with arc weld
Summary: Fixes T8236. I played around with a lot of variations of this but in the end it felt like the simple version was best.

Test Plan: Ran `arc weld a.txt b.txt`, observed very robust fusion of materials.

Maniphest Tasks: T8236

Differential Revision: https://secure.phabricator.com/D19081
2018-02-13 15:15:36 -08:00
epriestley
349109426c Clarify what "--everything" means in "arc lint" and "arc unit"
Summary:
Fixes T13061. Both `arc lint` and `arc unit` accept an `--everything` flag, but the documentation isn't quite clear about what these flags do.

They act as though every //tracked// file in the repository (`git ls-files`, `hg manifest`, or `svn list -R`) is included in the argument list.

They do not lint/test ignored files (and I think almost all users would be very surprised if they did).

They also don't lint/test untracked files (files you have not yet used `git add`, `svn add`, or `hg add` on). This is slightly more contentious but we have good reasons for doing it (e.g., `git ls-files` often outperforms `find .` by a large margin) and I believe users very rarely use `--everything` in a situation where they have untracked files. The only real exception I can come up with is linter configuration/development, as in PHI343, and it seems okay to have a slightly surprising behvaior here.

Make the documentation more clear about what is in scope.

We could also rename these to `--nearly-everything` or whatever, but I think the name is probably clear enough given current information about how confusing this is (specifically: only rarely, in unusual cases).

Test Plan:
  - Grepped for documentation about these flags.
  - Ran `arc help lint`, `arc help unit`, `arc unit --everything x`, `arc lint --everything x` and read all the new messages.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13061

Differential Revision: https://secure.phabricator.com/D18989
2018-02-05 12:26:41 -08:00
epriestley
2e02332216 Add trailing tabs when generating synthetic Git diffs for files with spaces
Summary:
Fixes T8768. See PHI294. See that task for more details.

Git, Mercurial, `diff`, and `patch` have conspired to make things weird. To correctly handle files with spaces in the way everything else does and expects, we need to emit semantic trailing whitespace literals.

Test Plan:
- Created a file with spaces in it in a Mercurial repositroy, committed it, diffed it into a revision.
- Used `arc patch` to apply the change to a clean copy of the repository.
- Before patch: Mercurial incorrectly creates a file named `X`, not a file named `X Y.txt`.
- After patch: `arc patch` commit is identical to genuine commit.
- Also added test coverage. The other general behaviors here are fairly well covered already.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T8768

Differential Revision: https://secure.phabricator.com/D18869
2018-01-16 13:57:27 -08:00
epriestley
3d06bd4c56 Fix a minor 'buildableStatus' error in "arc land"
See D18837. I made a mistake here with rigging this for testing; this line was
changed incorrectly.
2017-12-26 08:33:35 -08:00
Alex Vandiver
9144658e69 Accelerate working tree operations in git
Summary:
Currently, `arc` on `git` uses the following commands to examine the
state of the working tree and history; example times for a no-op diff in a
165k-file working tree are also shown:

```
1)  git diff --no-ext-diff --no-textconv --submodule=short --raw 'fb062d4ecce5d9c1786b7bfc8a0dedf6b11fdd96' --
  = 1,722,514 us

2a) git diff --no-ext-diff --no-textconv --submodule=short --raw 'HEAD' --
  = 1,715,507 us

2b) git ls-files --others --exclude-standard
  = 2,359,202 us

3)  git diff-files --name-only
  = 1,333,274 us
```

Steps (2a) and (2b) are run concurrently; this results in a total elapsed
wallclock time of approximately 5.4 seconds.  This is inefficient -- all four of
the above steps must both load the index and examine the working copy, which may
be slow operations when large repositories are used.  Additionally, none of the
effort of those stat calls on the working tree, or load time of the index, is
shared across the processes.

Step (1) is called from `getCommitRangeStatus`, which was split out in D4095; it
is currently never called on its own, only ever from `getWorkingCopyStatus`,
where it it combined with `getUncommittedStatus`.  The current behavior of the
method is to return the set of changes //either// in local commits //or//
uncommitted in the working tree, which duplicates work that
`getUncommittedStatus` is intended to do.  Changing the behavior of this method
(in Git, and other VCSes) to only examine _committed_ status seems both inline
with the name of the method and the original description of it in D4095 -- and
also serves to make it much faster, as it is an operation that need not inspect
the working tree at all.

Steps (2a), (2b), and (3) attempt to gather the state of the working copy, and
as such are all I/O bound but must examine nearly identical data.  For git
2.11.0 and higher, we can instead rely on the machine-parseable `git status
--porcelain=2` format, which provides the information from all of these commands
at once.  It also allows additional performance improvements, as `git status`
has been the focus of several optimizations in the latest versions of git (the
untracked cache and fsmonitor services, for instance), which are not available
in the lower-level `diff`, `ls-files`, and `diff-files` commands.

This has the added benefit of fixing a bug noticed in T9455, in that uncommitted
or unstaged changes in modules can now be detected, regardless of if they also
have changed their base commit.  It further resolves a bug where `.gitmodules`
appeared to have unstaged changes, when in reality the unstaged changes were in
submodules elsewhere in the tree.

For backwards compatibility with versions of git < 2.11.0, the old code is left
in place.  It is possible that the simpler output from v1 of `git status
--porcelain` would also suffice for some of the above benefits, but the payoff
of parsing yet another format is deemed insufficient; users wishing improved
performance should simply upgrade `git`.

Alltogether, these result in the following, for a no-op diff in a
165k-working-file tree:

```
1) git diff --no-ext-diff --no-textconv --submodule=short --raw 'fb062d4ecce5d9c1786b7bfc8a0dedf6b11fdd96' HEAD --
 = 9,227 us
2) git status --porcelain=2 -z
 = 739,964 us
```

...for a total of 749ms, an improvement of 4.7s.

Depends on D18841.

Test Plan: Existing tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D18842
2017-12-23 20:12:50 -08:00
Alex Vandiver
f34467914c Add tests for git submodules, based on current behavior
Summary:
This adds tests that detail the current behavior of `arc` in
the presence of `git` submodules.

Test Plan: No behavior change; wrote the tests such that they pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D18841
2017-12-23 20:01:20 -08:00
epriestley
c784b56920 Make "arc land" accommodate a minor API change in Harbormaster build statuses
Summary:
See PHI261. Currently "arc land" shows every build staus (passed, failed, building, etc) as yellow. Intended behavior is that passed builds are green, failed builds are red, and so on.

This is because of an unintended API change a while ago in D16356. Since the only impact was a cosmetic color issue, this escaped notice until now.

Additionally, try to use the modern `harbormaster.build.search` if it is available.

Test Plan:
  - Ran `arc land` with running builds, got reasonable coloration.
  - Faked the new method not being available, still got sensible behavior from the old method.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18837
2017-12-23 11:39:19 -08:00
Alex Vandiver
249f3a80fe Default the prompt for "Amend HEAD with these patches" to true
Summary:
Most users, if they have gone through the trouble of
accepting the auto-fixes, are most likely going to want to take those
changes and attempt to land with them.  Assuming "Y" for this prompt
streamlines for the more likely flow.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D18824
2017-12-12 01:43:16 -08:00
epriestley
f4c80a114d Make "arc land" prompt on "Changes Planned" revisions more explicit
Summary: Fixes T10233. See PHI231. Users sometimes believe this warning is a bug and/or don't understand how they're supposed to resolve it.

Test Plan: Ran `arc land` on a revision in "Changes Planned", got a sensible prompt. Ran `arc land` on a revision in another non-accepted state, got more or less the old prompt.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T10233

Differential Revision: https://secure.phabricator.com/D18807
2017-11-30 13:51:50 -08:00
epriestley
9054604214 Fix some lint rendering issues when lines prior to other identical lines are removed
Summary: See PHI191. This is a rehash of an earlier fix, but we didn't have a test case for this half yet.

Test Plan:
  - Added a failing test, made it pass.
  - Added a linter like the one in PHI191, ran it, got a valid lint result instead of an exception.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18759
2017-11-01 17:18:59 -07:00
epriestley
0989343a4e Correct some lint console renderer issues with files missing trailing newlines
Summary:
See PHI162. This corrects a couple more bugs:

  - If the old file didn't end in a newline, we could end up printing two lines next to each other in the output.
  - If the patch targeted "Line 6, character 1" instead of "line 5, character 3" in a file "1\n2\n3\n4\n5\n", we would fail to figure out what that meant when computing an offset because the last line has 0 characters on it.

Test Plan: Added failing unit tests, made them pass. Also tested with some fake linters similar to the ones described in PHI162.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18716
2017-10-20 10:49:07 -07:00
epriestley
617c2e46d6 Make "line" and "char" strictly optional in ArcanistLintMessage
Summary: See PHI136. These are already optional on the server side in `HarbormasterBuildLintMessage`, and effectively mean "file-level issue", which is a bit niche but not unreasonable.

Test Plan: Checked that `HarbormasterBuildLintMessage` doesn't care if these keys exist, created this revision.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18711
2017-10-17 14:30:31 -07:00
epriestley
76b54ce0a9 Fix parsing of Git branches with common and useful name "0"
Summary: See <https://discourse.phabricator-community.org/t/arc-has-a-spurious-failure-on-arc-diff/521>. Oh, PHP!

Test Plan: Created a branch named "0", ran `arc diff`. Before: fatal. After: this beautiful revision.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18678
2017-10-04 10:20:48 -07:00
Alex Vandiver
c804c50260 Don't show a blank line if there is no user data
Summary:
SKIP lines, for instance, often have no UserData; there is no
reason to display a content-less blank line.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D18632
2017-09-20 17:54:40 -07:00
epriestley
b836557b12 Correct lint rendering when patching trailing whitespace in files
Summary: Ref PHI48. If a patch removes all of the lines at the end of a file, we can get some array index errors.

Test Plan: Added failing test, made it pass.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18631
2017-09-20 12:07:41 -07:00
Austin McKinley
df81d79d77 Add explicit limits to unit test/lint error names
Summary:
Fixes T12981.

See new `arc lint` output: P2071

See new `arc unit` output: P2072

Test Plan: Ran `arc unit/lint/diff` and observed new error instead of a Conduit error

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12981

Differential Revision: https://secure.phabricator.com/D18603
2017-09-14 12:12:08 -07:00
epriestley
cbc785ddce Fix a similar lint rendering issue when trimming identical lines out of patches
Summary: Ref T9846. See PHI48. See D18538 for a similar fix. We can contract the suffix lines too much if, e.g, a newline after another newline is removed. Prevent contraction to fewer than 0 lines.

Test Plan: Added a failing test, made it pass.

Reviewers: chad

Reviewed By: chad

Subscribers: alexmv

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18541
2017-09-05 17:12:23 -07:00
epriestley
7371277d20 Fix a prefix/suffix counting issue in Arcanist lint rendering
Summary: Ref T9846. See PHI48. For replacing text in the form "ABC" with "ABBC", the trimmer had a bug.

Test Plan: Added failing tests, fixed 'em.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18538
2017-09-05 13:09:46 -07:00
epriestley
d9cb5b18fb Cheat our way through arc version on Windows for the moment
Summary: Fixes T8291. See PHI52. This is papering over the real issue (T8298) but it's a 10-second patch so just improve things slightly for now.

Test Plan: Ran `arc version` locally; patch confirmed on a Windows system by an affected user.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8291

Differential Revision: https://secure.phabricator.com/D18518
2017-09-01 18:06:00 -07:00
epriestley
ad8214456a Restore ANSI highlighting of lint sections to lint output
Summary: Fixes T9846. This restores the last missing feature, ANSI highlighting of diff sections.

Test Plan:
Added a mode so we can actually test this stuff, activated that mode, wrote unit tests.

Did a bunch of actual lint locally too and looked at it, all seemed sane.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18512
2017-08-31 13:29:18 -07:00
epriestley
213ed3ff15 Restore the caret pointer ("^") for lint lines which only have a character offset
Summary: Ref T9846. This was dropped when I refactored how things are rendered; restore it.

Test Plan: Added unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18511
2017-08-31 13:28:47 -07:00
epriestley
86779b1526 Render lint patches which have newlines in a less misleading way
Summary:
Ref T9846. This rewrites the rendering algorithm in a mostly-compatible way and fixes the major issue.

  - Includes test coverage for removing a newline, from T12765.
  - Includes test coverage for mangling an XML tag, from T9846.

This omits two features, which I'll port forward separately:

  - For one-line patches, highlighting the patched section.
  - For zero-line patches, putting a little caret ("^") under the character where the warning occurred.

I'll restore these features in a followup change.

Test Plan: Ran unit tests, linted a few things.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18510
2017-08-31 13:28:31 -07:00
epriestley
be67df6118 Extract and cover the logic for "trimming" a lint message
Summary:
Ref T9846. Sometimes, a lint message says to replace "the big bad wolf" with "the huge bad wolf": that is, the original and replacement text are the same at the beginning, or the end, or both.

To make this easier for humans to understand, we want to just show that "big" is being replaced with "huge", not that the entire phrase is being replaced.

This logic currently happens inline in console rendering. Pull it out and cover it so a future change can simplify console rendering.

Test Plan: Ran unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18509
2017-08-31 13:28:01 -07:00
epriestley
ab0d81bca2 Add basic test coverage for lint console rendering
Summary: Ref T9846. The algorithm here is fairly invovled, so lay down some test coverage before breaking it.

Test Plan: Ran tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18508
2017-08-31 13:27:44 -07:00
Alex Vandiver
5eda40337b Fix missing whitespace in arc linters --help message
Test Plan: Ran `arc linters --help`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D18344
2017-08-04 13:12:59 -07:00
Asher Baker
836768bdcc Fix ArcanistPHPCloseTagXHPASTLinterRule always bailing out
Summary:
D13794 changed ArcanistPHPCloseTagXHPASTLinterRule to ignore inline HTML blocks, but selectDescendantsOfType returns an AASTNodeList (which always exists).

Instead, check that the count() of the node list is > 0.

empty.lint-test had to be changed, it wouldn't have been accepted had this rule not been broken before it was commited.

Added tests to cover ArcanistPHPCloseTagXHPASTLinterRule in the future.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D18271
2017-07-22 03:48:37 +01:00
Stephanie Ren
165df12046 Consistently use phutil_console_confirm().
Summary:
`PhutilConsole->confirm()` is vestigial as noted in efcd70c, as
`PhutilConsole` may be deprecated sometime in the future. `PhutilConsole`
was developed as a tool for T4281 but the feature has been removed
since.

Replace existing occurences of the `PhutilConsole->confirm()` pattern with
`phutil_console_confirm()`. There should be no change in functionality
since the two functions are interchangeable.

Test Plan: Manually tested by running `bin/arc lint`, `bin/arc diff --preview`, `bin/arc land --preview`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, alexmv

Differential Revision: https://secure.phabricator.com/D18185
2017-07-06 16:27:36 -07:00
epriestley
c04f141ab0 Remove obsolete "arc land" flags: --update-with-merge/rebase, --delete-remote
Summary:
Fixes T12815. During the last update to "arc land", some flags were disabled but remained in place in case we needed to retain them.

It now seems reasonably clear that we do not. The "rebase" and "merge" strategies for landing were replaced by a better "headless" strategy which seems to avoid the original issues, so these flags no longer do anything or reasonably could do anything.

`--delete-remote` is slightly more ambiguous (e.g., see T12650 and maybe others) but the only real use case is "git push = save changes".

Test Plan:
Ran `arc land --update-with-rebase`, was told the flag does not exist.
Grepped for affected flags/symbols.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12815

Differential Revision: https://secure.phabricator.com/D18108
2017-06-09 08:12:37 -07:00
Alex Vandiver
129d51fa09 If the base commit for arc patch does not exist locally, try to fetch it
Summary:
If the commit does not exist locally, aborting still leaves
the user checked out on the branch.  In nearly all cases, all that is
necessary is a fetch -- but the branch must also be cleaned up.  This
leads to the pattern of:
```
arc patch D12345
[...base commit does not exist...]
^C
git checkout master
git branch -D arcpatch-D12345
git fetch
arc patch D12345
```

Solve this common problem by simply trying to fetch once if the commit does not
exist locally.

Test Plan: Ran `arc patch` on a recent diff.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17949
2017-05-18 13:13:22 -04:00
Hubert Kowalski
3c4735795a Detect trailing spaces and tabs
Summary: Ref T12655 - this change properly detects trailing spaces or tabs (or combinations of thereof) on end of lines.

Test Plan: Use Text lint with trailing whitespace rule on files with spaces, tabs or combinations of thereof. Should properly detect and fix all those.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, Itms

Maniphest Tasks: T12655

Differential Revision: https://secure.phabricator.com/D17814
2017-05-03 03:29:14 -07:00
epriestley
27b51e6192 Fix two minor issues with "arc download"
Summary:
Ref T12651. Ran into these during D17799:

  - Use `getStatusCode()` to put the actual status code into the message.
  - If we fail but wrote an empty file to reserve the filename, clean it up.

Test Plan:
  - Faked the error, `phlog()`'d the exception.
  - Saw sensible exception message.
  - Saw empty file get cleaned up.

Reviewers: chad, amckinley

Reviewed By: chad

Maniphest Tasks: T12651

Differential Revision: https://secure.phabricator.com/D17800
2017-04-28 07:45:25 -07:00
Austin McKinley
5d0f5afca8 Add ArcanistRaggedClassTreeEdgeXHPASTLinterRule to Phutil linter map
Summary: Fixes T12555.

Test Plan:
Added this class to the codebase and ran `arc liberate`:
```
<?php

class FooBar {
    public static function doTheFoo() {
        return 'foobar';
    }
}
```

Ran `arc lint` and observed this warning:
```
   Warning  (XHP87) Class Not `abstract` Or `final`
    This class is neither `final` nor `abstract`, and does not have a
    docblock marking it `@concrete-extensible`.

               1 <?php
               2
    >>>        3 class FooBar {
               4     public static function doTheFoo() {
               5         return "foobar";
               6     }
```

Added a `final` modifier to `FooBar`'s declaration and observed the warning went away.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12555

Differential Revision: https://secure.phabricator.com/D17787
2017-04-25 10:58:21 -07:00
epriestley
a59cfca5f1 Upgrade "arc upload" to use SHA256
Summary: Fixes T12464. Moves "arc upload" to SHA256 where applicable.

Test Plan: Ran `arc upload` against a server with D17620 twice, saw it skip the actual upload the second time.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12464

Differential Revision: https://secure.phabricator.com/D17622
2017-04-04 16:56:35 -07:00
epriestley
c4e84550fc Allow "arc upload" to work correctly if it can not hash content
Summary:
Ref T12464. This is similar to D17619 and prepares us to move to SHA256 in the client.

Note that it's fine if `arc` and Phabricator disagree about hashing algorithms. We don't really trust the client anyway, so if things are mismatched clients will just end up transferring a bit more data instead of getting to cheat when Phabricator already has copies of data.

Test Plan: Ran `arc upload`, got a clean upload.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12464

Differential Revision: https://secure.phabricator.com/D17621
2017-04-04 16:24:27 -07:00
epriestley
82b7cd778a Make "arc download" use "file.search" if available
Summary: Fixes T8348. Just use normal HTTP GET to download files if the server is sufficiently modern.

Test Plan: Downloaded various files with `--as`, `--show`, large files, small files, old server, new server.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8348

Differential Revision: https://secure.phabricator.com/D17614
2017-04-04 16:16:11 -07:00
Jon Parise
d1db9a72b5 Improve the flake8 line-matching regex
Summary:
Because the character offset group is optional, the logic for dealing
with the previous index-based match object was more complex than it
needs to be. Switching to named groups makes this clearer.

As an example of how this was causing a problem, when the character
group *was* present (at index 3), it was being appending to the linter's
name in the call to ->setName(), resulting in confusing linter output.
We may have also been setting the character offset to the error code's
string, too, which is further nonsense.

Because we reliably capture the flake8 error code, I don't think there's
a need to append it to the linter's name at all now, so I removed that
part (so it's always just `flake8`), but it's not a problem to restore.

Lastly, I hoisted `$regex` out of the loop because it's a constant and
de-indenting it gave me enough room to continuing writing it all on one
line.

Test Plan: Tested primarily with flake8 3.3.0

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17552
2017-03-24 09:19:06 -07:00
Jakub Vrana
3b6b523c2b Fix errors found by PHPStan
Test Plan: None.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17376
2017-02-18 09:24:19 +00:00
Jakub Vrana
d0353d2381 Fix errors found by PHPStan
Test Plan:
Ran `phpstan analyze -a autoload.php arcanist/src` with `autoload.php` containing:

  <?php
  require_once 'libphutil/src/__phutil_library_init__.php';
  require_once 'arcanist/src/__phutil_library_init__.php';

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17367
2017-02-16 13:54:43 +00:00
epriestley
460b0e46ee Fix a property name collision in ArcanistHgServerChannel
Summary:
See D2665. Here, `channel` is the Mercurial wire protocol channel name ("o" = "output", "e" = "error", etc), not the underlying channel from `PhutilProxyChannel`.

Rename the property so there's no collision.

Test Plan:
```
$ ../../core/lib/arcanist/scripts/hgdaemon/hgdaemon_client.php . --trace --skip-hello
array(3) {
  [0]=>
  int(0)
  [1]=>
  string(103) "capabilities: getencoding runcommand
encoding: UTF-8
pid: 73263e20cf21273d50f1f66cab6e0f7c74f4864e67f0f"
  [2]=>
  string(0) ""
}

Executed in 30647 us.
```

Reviewers: vrana, chad

Reviewed By: vrana

Differential Revision: https://secure.phabricator.com/D17366
2017-02-16 05:44:10 -08:00
Aviv Eyal
13596cd10f Add back pht()s and tsprintf()s to arg set-config
Summary: See D17357

Test Plan: invoke and still see output in English?

Reviewers: #blessed_reviewers, joshuaspence, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17362
2017-02-16 11:08:45 +00:00
Aviv Eyal
bc9b70508e arc set-config: warn about unknown keys
Summary: See T12266. Warn when the user tries to set a value we will probably not read.

Test Plan: `arc set-config foo bar`, see fancy warning.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D17357
2017-02-15 13:38:57 +00:00
Alex Vandiver
f3037bf216 [git] Override diff.submodule so git diff output is always parseable
Test Plan:
Removed a submodule with `diff.submodule` set to `log`, saw
`arc diff` error; with this change, it no longer does.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T10881

Differential Revision: https://secure.phabricator.com/D17327
2017-02-13 17:40:26 -08:00
Josh Cox
224986af63 Provide a better error message when an invalid ID is given to arc patch
Summary:
Fixes T8937. Previously when running `arc patch D9999999999` or `arc export --revision 99999999` with a non-existent diff or revision ID you would get a rather unhelpful error message. Now you'll get a slightly more helpful error message:
```
$ arc patch D99999999
Exception
Couldn't find a revision or diff that matches the given ID
(Run with `--trace` for a full exception trace.)
```

Test Plan: Ran arc patch with a valid revision and saw it patch successfully. Ran again with an invalid revision, saw the error message.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley, yelirekim

Maniphest Tasks: T8937

Differential Revision: https://secure.phabricator.com/D17325
2017-02-08 04:53:41 -05:00
epriestley
ade25facfd Fix a bad interaction between "arc diff --reviewers" and "the first line of a message is always a title"
Summary:
Fixes T12069. We implement "arc diff --reviewers" (and "--cc") by parsing a faux message with "Reviewers: ...".

After D17122, the first line of the message is always interpreted as a title, so the text ends up in the message body.

Instead, use a placeholder title so these fields are never initial fields.

Test Plan: Ran `arc diff --reviewers dog`, got only one "Reviewers" field.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12069

Differential Revision: https://secure.phabricator.com/D17147
2017-01-05 14:35:39 -08:00
Chris Burroughs
c243cbbd9f tighten remote URI error handling with idiosyncratic remote names
Summary:
`git ls-remote` has an unusual way to indicate a URL was not
found: echoing back user input
```
$ git ls-remote --get-url does_not_exist
does_not_exist
$ echo $?
0

```

`getRemoteURI` handles checking for remotes other than 'origin', but
the error handling always matched against the string 'origin'
regardless of remote name.

Test Plan:
With a git config along the lines of:
```
[remote "my_special_name"]
        url = ssh://secure@secure.phabricator.com/diffusion/ARC/arcanist.git
        fetch = +refs/heads/*:refs/remotes/my_special_name/*
[branch "master"]
        remote = github
        merge = refs/heads/master
[remote "github"]
         # url = git@github.com:phacility/arcanist.git
         fetch = +refs/heads/*:refs/remotes/github/*
```

and running in a branch tracking `master` (github).  `arc which` would
(without this diff) show:
```
The remote URI for this working copy is "github".
```
With this diff, `arc which` correctly shows:
```
Unable to determine the remote URI for this repository.
```

When diffing against a tracking branch with a propertly configured
remote (the happy path), `arc which` still correctly identifies the
remote URI:
```
The remote URI for this working copy is
"ssh://secure@secure.phabricator.com/diffusion/ARC/arcanist.git".
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, chad, epriestley

Differential Revision: https://secure.phabricator.com/D17110
2016-12-29 10:35:59 -05:00
epriestley
fad8584431 Make "aliases" show up in "arc get-config" help
Summary: Fixes T11758. This was one some spooky magic but is more-or-less a normal config setting now.

Test Plan:
  - Ran `arc get-config`, saw help about "aliases".
  - Ran `arc set-config aliases`, saw guidance about using `arc alias`.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11758

Differential Revision: https://secure.phabricator.com/D16745
2016-10-21 16:08:45 -07:00
Mukunda Modell
2962504855 Fix an DOMDocument error with NoseTestEngine running on PHP 7
Summary:
In php 7, DOMDocument::loadXML emits an error when supplied with
an empty string as input. For example, I got this error:

  ERROR 2: DOMDocument::loadXML(): Empty string supplied as input

This change simply checks for empty and returns an empty array
rather than attempting to parse an empty xml document.

Test Plan: ran `arc diff` on a repo that uses nosetestengine

Reviewers: #blessed_reviewers!

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D16672
2016-10-09 16:28:51 -05:00
epriestley
2ad15c499a Don't compute intraline diffs if the input fails a coarse check for being huge
Summary:
Fixes T11744. Because intraline diffs are expensive to generate, we already bail out and decline to generate them for very long lines.

However, we currently split the inputs into lists of characters first, then check how long they are and make a decision to bail. For //huge// inputs (e.g., 1MB+), this is too late: just splitting them has a large CPU/RAM cost.

(These inputs are rare in normal source, but can appear in, e.g., JSON files written without newlines.)

Instead, add an extra "are the inputs really huge?" check first, and bail early if they are.

Test Plan:
  - Generated a 1MB "change a file full of Q to a file full of R" diff.
  - Before change: purged changeset cache; took about 7 seconds to load.
  - After change: purged changeset cache; took about 1 second to load.
  - Viewed some normal diffs to make sure intraline edits still displayed correctly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11744

Differential Revision: https://secure.phabricator.com/D16683
2016-10-07 07:42:19 -07:00
Alex Vandiver
483e985d08 Check both UNIX- and Windows-style paths from linter output
Summary:
Paths are passed into linters using UNIX-style slashes (/), as returned from the version control system; however,
`Filesystem::readablePath` swaps them to Windows-style (\) on
Windows when storing the names of the files with lint messages.  This causes no lint message's path to match the set of
changed files, and thus no lint warnings are ever produced.

If a lint message's file is not found using the provided filename, also try looking up the UNIX-style filename, on Windows when determining if a lint mesage is "relevant."

Fixes T11248.

Test Plan: Ran `arc lint` on Windows.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Maniphest Tasks: T11248

Differential Revision: https://secure.phabricator.com/D16579
2016-09-21 14:29:42 -07:00
Josh Cox
9e82ef979e Added a warning prompt if the user tries to use an API cert instead of a CLI cert
Summary: Fixes T9692. Instead of disallowing API tokens entirely, we're going to just warn the user that they might not want to do that. After that, they can proceed if they want to.

Test Plan:
Run arc install-certificate.
Manually go to `Settings → Conduit API Tokens` in the web UI.
Generate an API token explicitly, which should have the form api-******.
Paste that into the prompt on the CLI.
It will give you a warning prompt then ask if you'd like to proceed anyway (defaults to No).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T9692

Differential Revision: https://secure.phabricator.com/D16448
2016-08-25 11:34:34 -04:00
Alex Vandiver
89e8b48523 Update documentation for changed splitGitDiffPaths function
Summary:
The behavior (and name) of this function was changed in
D16405, but the documentation was not updated to reflect the new
contract.

Test Plan: Untested; pure doc changes.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16425
2016-08-19 14:55:33 -07:00
Luke081515
3ae0cc8d41 Avoid double [y/N] when updating a not owned revision
Summary:
Since 737f5c0df9 arcanist shows [y/N] two times, when arcanist asks you, if you want to proceed, if you want to update a not owned revision. Ths patch fixes
that, so that Arcanist shows [y/N] only once, like at other situations, when Arcanist asks you a question.
Ref T11489

Test Plan: Updated a not owned revision.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Tags: #arcanist

Maniphest Tasks: T11489

Differential Revision: https://secure.phabricator.com/D16415
2016-08-17 10:36:16 -07:00
epriestley
6507be27ae Fix handling of View Policy in CLI upload workflow for small, unique files
Summary:
Ref T7148. When uploading files from the CLI with a particular view policy, we may not respect it if the file is unique (so the data isn't already known) and small (so it doesn't invoke the chunker).

This is rare (and may never have happened outside of testing) because:

  - production dumps are always larger than the minimum chunk size;
  - only cluster stuff uses `setViewPolicy()`;
  - the default policy is "Administrators" anyway, which is safe.

However, I caught it in local testing, so fix it up.

Test Plan: Used `bin/host upload --file ...` to upload a small, unique file. Verified it uploaded with the correct custom view policy ("No One") rather than the default view policy ("Administrators").

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7148

Differential Revision: https://secure.phabricator.com/D16408
2016-08-17 09:04:01 -07:00
Alex Vandiver
d0957c3441 Parse git renames with inconsistent quoting or custom prefixes
Summary:
The previous parser failed when only one of the old/new filenames was
quoted, as with a rename of a Unicode filename to a non-Unicode
filename, or vice versa.  It also incorrectly parsed custom prefixes,
even going to far as to encode this logic in the tests: a diff of
"src/file dst/file" which is not a rename should not be recorded as
changing "src/file", but rather "file".

Switch to using the "rename from" / "rename to" as the source of truth
for old and current filenames when complex renames are done.  This
matches the logic that git itself uses to parse patches; the contents
of the `diff --git` line are merely viewed as a simplest-case
prediction, with renames handled later should it not match.

The diff parser already had logic to parse "rename from" / "rename to"
lines and extract their information.  As such, this diff consists
primarily of removing logic from the `splitGitDiffPaths` method, and
allowing it to quietly fail.

This resolves two ambiguity mentioned in comments and tests: in
renaming "old file old" to "file", as well as the renaming of
"old file with spaces" to "new file with spaces" when neither are
quoted.

Test Plan:
`arc unit`.  Many of the existing test cases no longer
applied to the `splitGitDiffPaths` method; they were moved into a new
test method which also supplies values for "rename from" and "rename
to" lines.

As noted in the summary, this alters one of the expected values of an
existing test.  Specifically, the following diff is a file addition of
`file` with custom prefixes, and not the addition of "dst/file":

```
diff --git src/file dst/file
new file mode 100644
index 0000000..1269488
--- /dev/null
+++ dst/file
@@ -0,0 +1 @@
+data
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D16405
2016-08-16 17:45:51 -07:00
Alex Vandiver
ee6357386d Correctly parse file renames and copies from git diff --raw
Summary:
`parseGitRawDiff` dealt with the `A`, `M`, and `D` status flags from
`git diff --raw`, for file additions, modifications, and deletions
respectively.  However, it failed to cope with `C` and `R` flags, for
copies and renames.  Git version 2.9 and above default to resolving
renames, even in `git diff --raw` output, making this lack of support
only salient now (though users with Git's `diff.rename` set
encountered it previously).

Those two flags differ from the other three in that they offer both the
source and destination filename, separated by a tab.  As
`parseGitRawDiff` was not aware of this property, it returned a
"filename" of `"oldfile\tnewfile"`.  This is surfaced in several
places, including as passed to linters as a filename to check.
Needless to say, this file is nearly guaranteed to never exist on
disk.

Detect both the `C` and `R` flag types, and generate either a file
addition, or a pair of addition/deletion entries.

Test Plan:
Renamed a file, with a linter that printed each file it was
called with.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: jboning, Korvin

Differential Revision: https://secure.phabricator.com/D16387
2016-08-16 17:27:20 -07:00
epriestley
e5be662d15 Use --no-ext-diff in arc land call to git diff
Summary:
Fixes T11435. This isn't a perfect solution since there's a little code duplication, but a perfect solution is probably a bit more involved.

See T11435 for some discussion. In particular, most `git diff` commands already get this flag via `ArcanistGitAPI->getDiffBaseOptions()`.

Test Plan: Will land this change.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11435

Differential Revision: https://secure.phabricator.com/D16375
2016-08-06 09:00:01 -07:00
epriestley
f20d4b15c7 Add a lint error about use of PHP short array syntax ('[...]')
Summary: Ref T11409. Add lint to detect using `[...]` to define arrays. This doesn't work in PHP 5.2/5.3, which some of our users run.

Test Plan:
  - Ran `arc unit`.
  - Ran `arc lint src/applications/harbormaster/conduit/HarbormasterQueryBuildsConduitAPIMethod.php` to detect the issue in T11409.

Reviewers: yelirekim, chad

Reviewed By: chad

Maniphest Tasks: T11409

Differential Revision: https://secure.phabricator.com/D16357
2016-08-01 10:45:09 -07:00
epriestley
06c641f92c Remove command spelling correction from Arcanist
Summary: Fixes T7489. Depends on D16332, which moved this code to libphutil.

Test Plan:
```
$ arc banch --bystatus
(Assuming 'banch' is the British spelling of 'branch'.)
(Assuming '--bystatus' is the British spelling of '--by-status'.)
...
```

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7489

Differential Revision: https://secure.phabricator.com/D16333
2016-07-27 09:35:28 -07:00
Rabah Meradi
1bedfdccd7 Fixes help message for stop command
Test Plan: arc help stop will display 'Stop tracking work...'

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: avivey, chad, epriestley

Differential Revision: https://secure.phabricator.com/D16310
2016-07-27 05:42:07 -07:00
Alex Vandiver
8f69a5c378 Use phutil functions to copy/move files
Summary:
The `cp` and `mv` commands, when run from a Windows
environment, error out.  Use library functions from `Filesystem`
for cross-platform compatibility.

Test Plan:
Ran `arc lint` with auto-fix lint errors on both Linux and
Windows.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Spies: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D16273
2016-07-12 10:21:58 -07:00
epriestley
4d4d16f259 Validate Arcanist install-certificate URIs more carefully
Summary: Fixes T11222. This was lazy-future-proofed for Conduit SSH support, but users are boundlessly creative. Check protocols explicitly.

Test Plan:
```
$ arc install-certificate a.b:1/
Usage Exception: Server URI "a.b:1/" must include the "http" or "https" protocol. It should be in the form "https://phabricator.example.com/".
```

  - Also went through a successful workflow with a URI in the form provided in the example.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11222

Differential Revision: https://secure.phabricator.com/D16188
2016-06-28 15:20:06 -07:00
epriestley
2374403e8f Remove the "you have not specified reviewers" prompt from the arc client
Summary:
Ref T4631. Ref T10939. I don't have any good solutions here; this is perhaps the least-bad one.

  - This prompt is misleading/confusing in the presence of Herald/Owners.
  - This prompt is likely of very little value for experienced reviewers.
  - When it works, this prompt may be of some value for new reviewers, but getting it wrong is probably more confusing than getting it right is helpful, and there is a more accurate version of the warning in the web UI that new users are likely to see.
  - In the long run, this code should not live in the client.

Test Plan: Created this revision without specifying reviewers, probably didn't get prompted.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4631, T10939

Differential Revision: https://secure.phabricator.com/D16139
2016-06-17 08:04:08 -07:00
epriestley
c13e5a6295 Use an HTTPEngineExtension to implement "https.blindly-trust-domains" in Arcanist
Summary: Ref T10227. This converts weird hard-codey magic to the new HTTPEngineExtension.

Test Plan: See D16090.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10227

Differential Revision: https://secure.phabricator.com/D16091
2016-06-09 12:02:15 -07:00
epriestley
c75b671b22 Use "internal" smoothing for code diffs in Arcanist
Summary: Ref T7643. This moves the prefix/suffix smoothing behavior back to the old one, which seems better for code diffs.

Test Plan: `arc unit --everything`

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7643

Differential Revision: https://secure.phabricator.com/D16074
2016-06-07 14:15:20 -07:00
epriestley
41e8e30e8c Use EditDistanceMatrix diff smoothing in Arcanist
Summary:
Ref T7643. We've done the smoothing from D16068 for a long time, it just wasn't part of EditDistanceMatrix.

Since it now is, call it instead of keeping a copy of the logic around.

Previously, the unit tests were testing un-smoothed diffs. Just have them test smoothed diffs instead, since nothing actually uses unsmoothed diffs.

Test Plan: Pasted a raw diff into the web UI, got a sensible inline diff for it.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7643

Differential Revision: https://secure.phabricator.com/D16069
2016-06-07 09:13:34 -07:00
Aviv Eyal
ca33240942 Don't specify size 0 for deleted files
Summary: See D15828 - arc is reporting file size as `0` for unexisting files - make it stop.

Test Plan: `arc diff` with empty, deleted, added files - see size reported as `null` when appropriate.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: chad, Korvin

Differential Revision: https://secure.phabricator.com/D16059
2016-06-06 20:51:16 +00:00
epriestley
7891df6f25 Read arc aliases from all available configuration files
Summary: Fixes T10431. Updates the getAliases() method to read every `arc` configuration file.

Test Plan:
Added an `arc duck` alias to `/etc/arcconfig`, ran `arc duck`, saw "quack".

Added an `arc pig` alias to `~/.arcrc` via `arc alias`, ran `arc pig`, saw "oink oink".

Reviewers: nevogd, chad, #blessed_reviewers

Reviewed By: chad, #blessed_reviewers

Subscribers: eadler, epriestley

Tags: #twitter

Maniphest Tasks: T10431

Differential Revision: https://secure.phabricator.com/D15342
2016-06-06 13:15:59 -07:00
Allan Jude
19608cffe6 SVN buildSyntheticAdditionDiff: exit sooner if path is a directory
Summary:
When doing svn copy, or svn mv, a SynthenticAdditionDiff is generated.

If the path is a directory, an error will occur when checking the
mime-type of the directory. Immediately after the properties check,
the function returns null if the path is a directory. Move this
check to before the properties check to avoid exiting with an error.

```
Command failed with error #1!
COMMAND
svn propget 'svn:mime-type' '/home/trasz/svn/ports/cad/py-pycam'@

STDOUT
(empty)

STDERR
svn: warning: W200017: Property 'svn:mime-type' not found on '/home/trasz/svn/ports/cad/py-pycam@'
svn: E200000: A problem occurred; see other errors for details

(Run with `--trace` for a full exception trace.)
```

Test Plan: Created differentials of changes with `svn copy` and `svn mv`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Tags: #subversion

Differential Revision: https://secure.phabricator.com/D15985
2016-06-05 15:12:46 -07:00
epriestley
2234c8cacc Fix arc which for svn repos
Summary:
`arc which` is currently broken for svn repos.

Fixes T6635

(I think I independently wrote an identical change to yours)

Test Plan: `∴../../p/arcanist/bin/arc which` on a svn repo.

Reviewers: aik099, epriestley, #blessed_reviewers

Reviewed By: aik099, epriestley, #blessed_reviewers

Subscribers: aik099, Korvin

Maniphest Tasks: T6635

Differential Revision: https://secure.phabricator.com/D15922
2016-05-16 12:54:37 +00:00
Eitan Adler
c58f1b9a25 Prefer pip to easy_install
Summary:
Prefer pip to easy_install
also fixes incorrect install instructions for closure linters

Fixes T10892
Ref T10038

Test Plan: inspection

Reviewers: avivey, #blessed_reviewers, epriestley, tjstum

Reviewed By: avivey, #blessed_reviewers, epriestley, tjstum

Subscribers: avivey, Korvin

Maniphest Tasks: T10038, T10892

Differential Revision: https://secure.phabricator.com/D15818
2016-04-29 15:45:11 +00:00
epriestley
768e1a56bc When running XHPAST unit tests, include the "syntax error" lint rule
Summary:
See rARC3ffed59bd7. Currently, when a unit test includes a syntax error, it is raised in an unclear way ("error at line 10, char 1: XHP1 Unknown lint message!").

This is because each test case only activates rules it wants to test, so we lose the ID/name for the syntax message. However, we always want to test this and the lint engine can always raise it.

To get a better error message, include it unconditionally. So a test for rule `X` really tests two rules: syntax, and `X`.

Test Plan:
Ran `arc unit` at HEAD, got a better test failure:

```
   FAIL  ArcanistCallTimePassByReferenceXHPASTLinterRuleTestCase::testLinter
In 'call-time-pass-by-reference.lint-test', expected lint to raise error on line 10 at char 8, but no error was raised. Actually raised:
  error at line 10, char 1: XHP1 PHP Syntax Error!
```

NOTE: This doesn't pass tests yet, it just makes the test failure easier to understand. I'll see about fixing the test in the next change.

Reviewers: chad, richardvanvelzen

Reviewed By: richardvanvelzen

Differential Revision: https://secure.phabricator.com/D15819
2016-04-29 06:30:04 -07:00
Richard van Velzen
3ffed59bd7 Update xhpast linter rules for new function AST format
Summary: See D15678. A node containing a return type hint is added right before the statement body node. This updates all relevant linter rules to now retrieve the body from the correct index.

Test Plan: Ran `arc unit --everything`, inspected every single message to make sure all xhpast test cases succeeded. Also grepped for `getChildByIndex(5` and `getChildOfType(5`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15814
2016-04-29 14:38:10 +02:00
Joshua Spence
ea6fc77892 Fix incorrect variable for linter standards
Summary: It is currently not possible to apply multiple linter standards because `$value` was used instead of `$standard`.

Test Plan: Was able to apply multiple linter standards.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: eadler, thaiphv, Korvin

Differential Revision: https://secure.phabricator.com/D15212
2016-04-29 08:00:07 +00:00
Jon Parise
9b07d1c480 Recognize error codes from Flake8 extensions
Summary:
Flake8 extensions are allowed to use their own letter-prefixed codes. For
example, the flake8-debugger extension emits 'T002'-tagged messages.

This change relaxes getLintCodeFromLinterConfigurationKey() to also recognize
extension codes. Otherwise, attempting to configure message severities for
e.g. 'T002' would result in an exception.

Messages from extensions continue to default to ERROR severity, as they did
before this change.

Test Plan:
Successfully reduced the severity of 'T002' to a warning via .arclint:

    "severity": {
        "T002": "warning"
    }

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15810
2016-04-27 15:11:46 -07:00
epriestley
a2ab38df78 Improve performance of arc branch in Git with many branches
Summary:
This is mostly just a personal quality-of-life fix. I run this command fairly often and having it return a little faster is nice.

This replaces a `git show` for each individual branch with a big `git for-each-ref` which we were already running anyway. This is quite a bit faster.

This command also occasionally hangs or segfaults for me while executing the huge pile of subprocesses. This is unreliable to reproduce, probably some bug in some PHP extension I have, and likely hard to narrow down, and this approach is better in every way anyway.

Test Plan:
  - Ran `arc branch` in Git, observed faster output (in my `phabricator/`, about 2000ms -> 1200ms).
  - Ran `arc feature` in Mercurial.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15735
2016-04-16 16:39:32 -07:00
Mukunda Modell
737f5c0df9 Allow amending revisions without commandeering first
Summary:
It is common practice in Wikimedia's projects to amend a contributor's
change without taking over authorship of the change. We found that
the only enforcement of commandeering before amending is in arcanist,
not validated server-side. While it would be fairly straightforward to
maintain this as a patch to arcanist, I thought I would see if upstream
is willing to support making this optional.

With this change, amending without commandeering is enabled by a flag in
`.arcconfig` and it defaults to the old behavior.

For background see [wmf T121751](https://phabricator.wikimedia.org/T121751)

Test Plan:
* ran `arc patch D146` to locally apply a revision that I did not author,
* made a trivial change and amended the commit.
* ran `arc diff --update D146 HEAD^` to send the update to differential
* Saw that https://phabricator.wikimedia.org/D146 updated as it should.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: greggrossmeier, aklapper, Luke081515.2, Korvin, dereckson

Maniphest Tasks: T10584

Differential Revision: https://secure.phabricator.com/D15468
2016-04-09 11:57:42 -05:00
epriestley
8701e6c1f3 Strip tips out of commit messages from arc backout
Summary:
Fixes T10707. Currently, `arc backout` creates a commit message which includes questionably-helpful "tips" in the message itself.

Strip these out.

Test Plan:
Used `arc backout` to revert any commit, then `git show` to see the generated message.

  - Before patch: included tips.
  - After patch: no tips.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10707

Differential Revision: https://secure.phabricator.com/D15573
2016-04-02 07:26:02 -07:00
Aviv Eyal
3d7ac867f5 Make callsigns optional in arcanist
Summary:
Remove couple of references to callsigns:
- `arc which` now prints repository name
- `getShouldAmend()` can now use new format of commit name

a quick git-grep looks like the remaining references are all about `repository.callsign` config.

Ref T4245

Test Plan:
- `arc which` on a repository with no callsign
- trigger `requireCleanWorkingCopy()`, see both "Do you want to amend this change" and "Do you want to create a new commit" prompts.
- fire this diff with new code.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T4245

Differential Revision: https://secure.phabricator.com/D15472
2016-03-15 03:58:46 +00:00
epriestley
ccbaee585e When arc pushes to the staging area, tell Phabricator what we did
Summary:
Ref T10093. Right now, Phabricator kind of guesses that `arc` probably pushed stuff to the staging area.

This can cause confusing/misleading errors later, if it didn't actually push.

Instead, tell Phabricator that we pushed, so we can raise more tailored messages in the web UI (e.g., make "Land Revision" say "this wasn't pushed to the staging area" instead of "whoops, error!!~").

Test Plan:
Ran `arc diff` a few times, then looked in the database for properties.

{F1161655}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10093

Differential Revision: https://secure.phabricator.com/D15426
2016-03-07 07:24:16 -08:00
epriestley
4a1160e0c3 When pushing changes to staging, also push the base commit
Summary:
Fixes T10509. Pushing changes to staging can be inefficient. What happens, roughly, is:

  - Master is at commit "W" -- "W" is the most recent published commit in the main repository.
  - The local working copy has one change on top of that, "X", so its history is commits "A, B, C, D, E, F, ..., U, V, W, X".
  - The remote has some other previous changes that I or other users have made, maybe like "A, B, C, ..., S, T, U, Y" and "A, B, C, ..., T, U, V, Z", from previous pushes to staging areas.
  - "X", "Y" and "Z" will never actually make it to master, because they'll be squash-merged/amended by `arc land`.

So the local says "I want to push 'X'", and the remote says "I know about 'Y' and 'Z', are those in the history of 'W'? You only need to send me new stuff if they are".

But they aren't, so the local says "nope, so here's the whole history for you". This is slow and sends a ton of data that the remote already has over the network.

In theory, Git could use a slightly different algorithm to tell the local about more commits, but this is hard, rarely useful, and not the kind of thing I'd be excited about changing if I was the Git upstream.

Instead, when pushing "X", also push "W", to trick Git into telling future clients about it.

Now, the remote should say "I know about 'W', 'Y' and 'Z'", and the local will say "oh, great, 'W' is in history, here's just the changes since then".

Also, fail `arc diff` if the push to staging fails, and tell users to use `--skip-staging`. This code has been in production for a while and doesn't seem to have any issues, and a failed push to staging prevents builds, lands, etc.

Test Plan:
  - Ran `arc diff`, saw two changes push.
  - Ran `arc diff --base arc:empty`, saw only one change push.
  - Ran `arc diff` with an intentionally broken staging area, saw an error.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10509

Differential Revision: https://secure.phabricator.com/D15424
2016-03-07 06:53:49 -08:00
epriestley
3876d93583 Properly URL encode branches in arc browse --branch ...
Summary: Fixes T10511. If you `arc browse --branch x/y/z`, we do not encode the URI properly.

Test Plan:
Ran `arc browse --branch x/y/z/ something.c`.

Before, got an error about "x" does not exist. This is wrong; the error should be about "x/y/z".

After, got the proper error:

{F1141096}

Reviewers: chad, avivey

Reviewed By: avivey

Maniphest Tasks: T10511

Differential Revision: https://secure.phabricator.com/D15397
2016-03-04 15:52:58 -08:00
epriestley
b1de04aa68 Report unit test details from Arcanist to Harbormaster
Summary: Ref T10457. Provides information for D15363.

Test Plan: See D15363.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9951, T10457

Differential Revision: https://secure.phabricator.com/D15364
2016-03-04 15:49:46 -08:00
Eric Stern
086f5399bf Filter out some Clover coverage to prevent false positives
Summary: Clover reports generated from PHPUnit sometimes give false positives of lines that were not covered by a test that should have actually been not coverable, apparently due to inaccurate static analysis of files that weren't actually executed. This filters coverage reports of files that show no coverage which avoids these false positives. Fixes T10420.

Test Plan:
Looked at coverage reports of files before and after the change

Before: {F1124115}

After: {F1124113}

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, aurelijus

Maniphest Tasks: T10420

Differential Revision: https://secure.phabricator.com/D15343
2016-02-24 12:58:07 -08:00
epriestley
fcc11b3a27 Add --quiet to git fetch on arc land
Summary: This makes it a bit quieter.

Test Plan: shh

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15236
2016-02-10 14:00:24 -08:00
epriestley
d6b1531b94 Use passthru to run git fetch in arc land so password prompts work
Summary:
Fixes T10314. In `arc land`, we currently run `git fetch` as a subprocess.

However, this can prevent password prompts (when fetching over HTTP with basic authentication) from working properly.

Instead, use passthru to redirect stdin/stdout to the subprocess so the user can type their password.

This adds a little extra clutter to the `arc land` output but I think that's OK.

Test Plan: See T10314, @maxie confirmed this fixes the issue.

Reviewers: chad

Reviewed By: chad

Subscribers: maxie

Maniphest Tasks: T10314

Differential Revision: https://secure.phabricator.com/D15233
2016-02-10 12:31:18 -08:00
Mukunda Modell
57f6fb59d7 Make arc unit NoseTestEngine work in a sub-dir
Summary:
D14362 didn't actually work in a subdirectory.

This globs the tests/ directory to find test_*.py, now you get
more than just a coverage report when running `arc unit --everything`
whether it's run from the project root or a subdirectory.

Test Plan:
ran `arc unit --everything` from project root and also ran it from
a sub-directory.

```
$ arc unit --everything
   PASS    1ms★  test_log.FilterTest.test_filter_can_invert_behavior
   PASS    1ms★  test_log.FilterTest.test_filter_filters_matching
   PASS   <1ms★  test_log.FilterTest.test_filter_filters_matching_lambda
   PASS    1ms★  test_log.FilterTest.test_filter_filters_matching_regex
   PASS    3ms★  test_log.FilterTest.test_filter_loads
   PASS    2ms★  test_log.FilterTest.test_filter_loads_filters_correctly
   PASS   <1ms★  test_log.FilterTest.test_filter_loads_supports_numeric_comparisons
   PASS    1ms★  test_log.FilterTest.test_filter_parse
   PASS    1ms★  test_log.JSONFormatterTest.test_format_includes_all_serializable_logrecord_fields
   PASS    1ms★  test_log.JSONFormatterTest.test_format_includes_exceptions_as_text
   PASS   <1ms★  test_log.JSONFormatterTest.test_format_includes_extra_fields
   PASS    1ms★  test_log.JSONFormatterTest.test_make_record
   PASS    1ms★  test_nrpe.NRPETest.test_load
   PASS   <1ms★  test_nrpe.NRPETest.test_registered_check
   PASS   <1ms★  test_nrpe.NRPETest.test_unregistered_check
   PASS   <1ms★  test_ssh.JSONOutputHandlerTest.test_accept_ignores_bad_json
   PASS   <1ms★  test_ssh.JSONOutputHandlerTest.test_accept_parses_and_logs_json_messages
   PASS   <1ms★  test_ssh.JSONOutputHandlerTest.test_lines_buffers_partial_lines
   PASS    4ms★  test_checks.ChecksConfigTest.test_custom_type
   PASS    2ms★  test_checks.ChecksConfigTest.test_load_bad_type
   PASS    5ms★  test_checks.ChecksConfigTest.test_load_valid_config
   PASS   19ms★  test_checks.ChecksExecuteTest.test_execute
   PASS  222ms   test_checks.ChecksExecuteTest.test_execute_concurrency
   PASS   18ms★  test_checks.ChecksExecuteTest.test_execute_failure
   PASS   15ms★  test_checks.ChecksExecuteTest.test_execute_timeout
   PASS   <1ms★  test_utils.UtilsTest.test_check_php_opening_tag
   PASS    3ms★  test_utils.UtilsTest.test_check_target_hosts
   PASS    1ms★  test_utils.UtilsTest.test_check_valid_json_file
   PASS   <1ms★  test_utils.UtilsTest.test_get_env_specific_filename
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14363
2016-01-25 04:18:15 -06:00
Mukunda Modell
607cd77ca1 Add support for '--everything' in NoseTestEngine
Summary: Adds support for running all unit tests with NoseTestEngine.

Test Plan:
`ran arc unit --everything` and got unit test results

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: joshuaspence, Korvin

Differential Revision: https://secure.phabricator.com/D14362
2016-01-25 04:08:53 -06:00
Michael Akinde
b87138356a Cleans up some minor issues in cpplint
Summary:
- Corrected typo in install instructions
- Sets the default binary to cpplint.py

Test Plan:
- Running the unit tests.

You may need to check your test environment is set up with the latest
cpplint.py available, since the default binary is being changed.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T10157

Differential Revision: https://secure.phabricator.com/D15030
2016-01-15 08:19:23 -08:00
Michael Akinde
22af67c1c0 Minor fixes to arcanist cpplint
Summary:
This fixes the regex in "getLintCode..." so that it accepts lint
codes such as `build/c++11` which have become valid lint codes
in later versions of cpplint.

It also corrects the install instructions for the linter (Google's
style guide is no longer available on SVN and has been migrated to
Github).

Test Plan:
For the Regex:
- Create an .arclint in a project such as:
```
{
  "linters": {
    "cpplint": {
      "type": "cpplint",
      "severity": {
        "build/c++11": "advice"
      }
    }
  }
}
```
- Run `arc lint` with the existing linter. This should fail. Patch the linter, and this should now be accepted.

For the Instructions
- Verify the download location `wget https://raw.github.com/google/styleguide/gh-pages/cpplint/cpplint.py`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T10118

Differential Revision: https://secure.phabricator.com/D15019
2016-01-14 06:59:10 -08:00
epriestley
05c12eb9d9 If the Script-and-Regex linter captures no "line" text, treat the message as affecting the entire file
Summary: Fixes T10124.

Test Plan:
Added this "linter" to `.arclint`:

```
    "thing": {
      "type": "script-and-regex",
      "script-and-regex.script": "echo every file is very bad #",
      "script-and-regex.regex": "/^(?P<message>.*)/"
    }
```

...to produce this diff. Also made a variant of it which matches lines to make sure that still works.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10124

Differential Revision: https://secure.phabricator.com/D15000
2016-01-11 17:37:34 -08:00
John Allen
aeb374b333 Fix cpplint message regex
Summary:
ref T8404

The issue is caused, not by the non-zero return code, but by the fact that
$messages is coming back empty due to the incorrect regex. tyhoff pointed out
that the regex matched correctly when we used STDIN, but now it is failing.

https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/linter/ArcanistExternalLinter.php;8c589f1f759f0913135b8cc6959a6c1589e14ae4$357

Test Plan:
arc lint cpp file containing lint error. run cpplint on the
file directly to confirm that there are errors and that the return code
is non-zero

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T8404

Differential Revision: https://secure.phabricator.com/D14960
2016-01-06 13:15:09 -08:00
epriestley
98d71571e4 Fix arc diff --raw with "onto" target properties
Summary:
Currently, `git show | arc diff --raw` and similar doesn't work because we try to figure out what the "Branch: feature (branched from whatever)" value is, which doesn't make sense.

```
$ git show | arc diff --raw --trace
 ARGV  '/Users/epriestley/dev/core/lib/arcanist/bin/../scripts/arcanist.php' 'diff' '--raw' '--trace'
 LOAD  Loaded "phutil" from "/Users/epriestley/dev/core/lib/libphutil/src".
 LOAD  Loaded "arcanist" from "/Users/epriestley/dev/core/lib/arcanist/src".
Config: Reading user configuration file "/Users/epriestley/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/Users/epriestley/dev/core/lib/arcanist/.arcconfig".
Working Copy: Path "/Users/epriestley/dev/core/lib/arcanist" is part of `git` working copy "/Users/epriestley/dev/core/lib/arcanist".
Working Copy: Project root is at "/Users/epriestley/dev/core/lib/arcanist".
Config: Reading local configuration file "/Users/epriestley/dev/core/lib/arcanist/.git/arc/config"...
Loading phutil library from '/Users/epriestley/dev/core/lib/arcanist/src'...
>>> [0] <conduit> conduit.connect() <bytes = 489>
>>> [1] <http> https://secure.phabricator.com/api/conduit.connect
<<< [1] <http> 211,217 us
<<< [0] <conduit> 212,001 us
>>> [2] <event> diff.didCollectChanges <listeners = 0>
<<< [2] <event> 140 us
>>> [3] <event> diff.didBuildMessage <listeners = 0>
<<< [3] <event> 46 us
Reading diff from stdin...
>>> [4] <conduit> differential.creatediff() <bytes = 10,542>
>>> [5] <http> https://secure.phabricator.com/api/differential.creatediff
<<< [5] <http> 120,215 us
<<< [4] <conduit> 120,411 us
>>> [6] <event> diff.wasCreated <listeners = 0>
<<< [6] <event> 41 us
 SKIP STAGING  Raw changes can not be pushed to a staging area.
>>> [7] <conduit> harbormaster.queryautotargets() <bytes = 290>
>>> [8] <http> https://secure.phabricator.com/api/harbormaster.queryautotargets
<<< [8] <http> 217,717 us
<<< [7] <conduit> 217,944 us
>>> [9] <conduit> harbormaster.sendmessage() <bytes = 274>
>>> [10] <http> https://secure.phabricator.com/api/harbormaster.sendmessage
>>> [11] <conduit> harbormaster.sendmessage() <bytes = 274>
>>> [12] <http> https://secure.phabricator.com/api/harbormaster.sendmessage
<<< [10] <http> 123,821 us
<<< [9] <conduit> 134,329 us
<<< [12] <http> 227,580 us
<<< [11] <conduit> 227,787 us

[2016-01-05 10:08:58] EXCEPTION: (Exception) This workflow ('ArcanistDiffWorkflow') requires a Repository API, override requiresRepositoryAPI() to return true. at [<arcanist>/src/workflow/ArcanistWorkflow.php:804]
arcanist(head=master, ref.master=b3e68c9f1793), phutil(head=stable, ref.master=adb8a9c074ba, ref.stable=7b8d38cd2d4e)
  #0 ArcanistWorkflow::getRepositoryAPI() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2421]
  #1 ArcanistDiffWorkflow::getDiffOntoTargets() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:2411]
  #2 ArcanistDiffWorkflow::updateOntoDiffProperty() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:534]
  #3 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:392]
```

Test Plan: Ran `arc diff --raw` in `phabricator/`.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D14946
2016-01-05 10:16:39 -08:00
Joshua Spence
b3e68c9f17 Add a linter rule for use of is_a
Summary: `instanceof` should be used instead of `is_a`. I need to do a bit more research here to see if there are any edge cases.

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14573
2015-12-23 08:44:39 +11:00
Joshua Spence
9ee14d2849 Improve the "self member reference" linter rule
Summary:
Extends `ArcanistSelfMemberReferenceXHPASTLinterRule` to warn about the use of a hardcoded class name instead of `self` when instantiating a class. Arguably, we should maybe rename the linter rule from `ArcanistSelfMemberReferenceXHPASTLinterRule` to `ArcanistSelfUsageXHPASTLinterRule`, or even maybe split this rule into three separate rules:

  - `ArcanistSelfMemberReferenceXHPASTLinterRule`
  - `ArcanistSelfSpacingXHPASTLinterRule`
  - `ArcanistSelfClassReferenceXHPASTLinterRule`.

Test Plan: Added to existing test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13935
2015-12-23 08:39:44 +11:00