epriestley [Fri, 17 Jun 2016 14:49:07 +0000 (07:49 -0700)]
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.
Allan Jude [Sun, 5 Jun 2016 22:12:46 +0000 (15:12 -0700)]
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.
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`
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.
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`.
Jon Parise [Wed, 27 Apr 2016 20:48:46 +0000 (13:48 -0700)]
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:
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.
Mukunda Modell [Sat, 9 Apr 2016 16:47:09 +0000 (11:47 -0500)]
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.
Aviv Eyal [Tue, 15 Mar 2016 03:58:46 +0000 (03:58 +0000)]
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.
epriestley [Mon, 7 Mar 2016 15:13:11 +0000 (07:13 -0800)]
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.
epriestley [Mon, 7 Mar 2016 14:17:43 +0000 (06:17 -0800)]
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.
Eitan Adler [Sat, 5 Mar 2016 22:29:46 +0000 (14:29 -0800)]
Use python2 instead of python in `arc anoid` shebang`
Summary:
With the old shebang of `#!/usr/bin/env python` on machines with python 3 as the default python it would fail.
Prefer an explicit python2 like PEP 394 suggests.
Eric Stern [Wed, 24 Feb 2016 20:48:37 +0000 (12:48 -0800)]
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
Mukunda Modell [Mon, 25 Jan 2016 10:15:28 +0000 (04:15 -0600)]
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.
Michael Akinde [Thu, 14 Jan 2016 14:59:10 +0000 (06:59 -0800)]
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`
epriestley [Tue, 12 Jan 2016 01:18:58 +0000 (17:18 -0800)]
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.
John Allen [Wed, 6 Jan 2016 21:15:09 +0000 (13:15 -0800)]
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.
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
epriestley [Tue, 5 Jan 2016 18:10:06 +0000 (10:10 -0800)]
(stable) 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/`.
epriestley [Tue, 5 Jan 2016 18:10:06 +0000 (10:10 -0800)]
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/`.
Joshua Spence [Tue, 22 Dec 2015 21:39:44 +0000 (08:39 +1100)]
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:
epriestley [Fri, 18 Dec 2015 00:16:05 +0000 (16:16 -0800)]
Use "--whitespace nowarn" in `arc patch` to respect trailing whitespace
Summary: Fixes T10008. Git tries to fix some issues by default (apparently? empirically; not consistent with documentation, I think?), but patches from `arc patch` are "always" accurate (disregarding other bugs we might have -- basically, they haven't been emailed or copy/pasted or anything like that) so we can just tell it to apply the patch exactly as-is.
epriestley [Sun, 13 Dec 2015 11:08:06 +0000 (03:08 -0800)]
Explain how to move forward or backward from `arc land --hold`
Summary: Fixes T9973. When users run `arc land --hold`, give them the commands to move forward (push) or backward (checkout the branch/tag/commit they were on) and be explicit that branches have not changed.
Test Plan: Ran `arc land --hold`, got lots of explanatory text.
Dimitry Andric [Sun, 13 Dec 2015 10:35:07 +0000 (02:35 -0800)]
Simplify diff exit code handling.
Summary:
This fixes T9970 in an alternate manner, with the same effect: the
binary_safe_diff.sh script returns 0 if the diff succeeds, 1 in all
other cases.
Test Plan:
Tested locally with a fixed binary_safe_diff.sh, resulting in this
correct review:
Dimitry Andric [Sun, 13 Dec 2015 10:21:43 +0000 (02:21 -0800)]
Preserve the exit code of the diff command in binary_safe_diff.sh
Summary:
Some versions of Subversion (1.9 in any case, maybe others) will
duplicate diff headers, if the diff command run through --diff-cmd
returns 0.
This lead to T9970, where the addition of a new file with properties
only shows the properties themselves in the review, not the content of
the new file.
Test Plan: This is a trivial change, is a test needed at all?
epriestley [Thu, 10 Dec 2015 22:33:33 +0000 (14:33 -0800)]
In `arc diff`, try to guess where a change should land
Summary:
Ref T9952. Ref T3462. My primary goal is to improve prefilling of the "Onto Branch:" field in the "Land Revision" dialog.
When uploading a diff with `arc diff`, add a property with some information about which branch to target. In particular:
- If the local branch tracks an upstream branch (or tracks something which tracks something which tracks the upstream), target that.
- If not, but "arc.land.onto.default" is set, target that.
This doesn't try to guess in other cases, since they're more involved. I'll add some context about this in T3462.
I don't //love// using "diff properties" for this, but it doesn't make cleaning them up any harder since we already use it for other stuff which isn't going away (lint/unit excuses).
Test Plan:
- Added some `var_dump()` and used `arc diff --only` to generate diffs.
- Saw upstream tracking and config-based rules generate reasonable values and submit them.
epriestley [Thu, 10 Dec 2015 22:10:02 +0000 (14:10 -0800)]
Don't use "-c" flag in "git:branch-unique()" revision range rule
Summary:
Fixes T9953.
- "-c" was introduced in 1.7.2.
- "--no-color" has existed forever as far as I can tell.
- "--no-column" was introducd in 1.7.11, but there was nothing that needed to be disabled before that (hopefully).
Test Plan:
- Ran `arc which --trace` and observed a reasonable `git branch` command with correct output.
- Ran `arc which --trace` with a faked older Git version, observed command omit `--no-column`.
Joshua Spence [Tue, 8 Dec 2015 19:56:48 +0000 (06:56 +1100)]
Add a linter rule for curly brace array indexes
Summary: In PHP, both `$x['key']` and `$x{'key'}` can be used to access an array (see http://stackoverflow.com/questions/8092248/php-curly-braces-in-array-notation), but the former should be preferred.
Joshua Spence [Wed, 2 Dec 2015 21:11:22 +0000 (08:11 +1100)]
Add a linter rule for invalid octals
Summary: PHP doesn't handle octals very well. Basically, it seems that any numeric scalar matching `/^0\d+$/` will be treated as an octal, whereas this should be `/^0[0-7]+$/`. As a result, `08` and `09` are both treated as `0` (because they are invalid octals. This diff adds a linter rule to detect this abnormality.
Joshua Spence [Tue, 1 Dec 2015 19:25:22 +0000 (06:25 +1100)]
Add a table showing all XHPAST linter rules to the output of `arc linters xhpast`
Summary: Now that we have 91 subclasses of `ArcanistXHPASTLinterRule`, it is becoming difficult to manage the IDs. This diff adds a table to `arc linters xhpast` workflow to facilitate this.
Test Plan:
```
> arc xhpast-linter-rules
+=====+=======================================================+===================================================================+
| ID | Class | Name |
+=====+=======================================================+===================================================================+
| 1 | ArcanistSyntaxErrorXHPASTLinterRule | PHP Syntax Error! |
| 2 | ArcanistUnableToParseXHPASTLinterRule | Unable to Parse |
| 3 | ArcanistVariableVariableXHPASTLinterRule | Use of Variable Variable |
| 4 | ArcanistExtractUseXHPASTLinterRule | Use of `extract` |
| 5 | ArcanistUndeclaredVariableXHPASTLinterRule | Use of Undeclared Variable |
| 6 | ArcanistPHPShortTagXHPASTLinterRule | Use of Short Tag `<?` |
| 7 | ArcanistPHPEchoTagXHPASTLinterRule | Use of Echo Tag `<?=` |
| 8 | ArcanistPHPCloseTagXHPASTLinterRule | Use of Close Tag `?>` |
| 9 | ArcanistNamingConventionsXHPASTLinterRule | Naming Conventions |
| 10 | ArcanistImplicitConstructorXHPASTLinterRule | Implicit Constructor |
| 12 | ArcanistDynamicDefineXHPASTLinterRule | Dynamic `define` |
| 13 | ArcanistStaticThisXHPASTLinterRule | Use of `$this` in Static Context |
| 14 | ArcanistPregQuoteMisuseXHPASTLinterRule | Misuse of `preg_quote` |
| 15 | ArcanistPHPOpenTagXHPASTLinterRule | Expected Open Tag |
| 16 | ArcanistTodoCommentXHPASTLinterRule | TODO Comment |
| 17 | ArcanistExitExpressionXHPASTLinterRule | `exit` Used as Expression |
| 18 | ArcanistCommentStyleXHPASTLinterRule | Comment Style |
| 19 | ArcanistClassFilenameMismatchXHPASTLinterRule | Class-Filename Mismatch |
| 20 | ArcanistTautologicalExpressionXHPASTLinterRule | Tautological Expression |
| 21 | ArcanistPlusOperatorOnStringsXHPASTLinterRule | Not String Concatenation |
| 22 | ArcanistDuplicateKeysInArrayXHPASTLinterRule | Duplicate Keys in Array |
| 23 | ArcanistReusedIteratorXHPASTLinterRule | Reuse of Iterator Variable |
| 24 | ArcanistBraceFormattingXHPASTLinterRule | Brace Placement |
| 25 | ArcanistParenthesesSpacingXHPASTLinterRule | Spaces Inside Parentheses |
| 26 | ArcanistControlStatementSpacingXHPASTLinterRule | Space After Control Statement |
| 27 | ArcanistBinaryExpressionSpacingXHPASTLinterRule | Space Around Binary Operator |
| 28 | ArcanistArrayIndexSpacingXHPASTLinterRule | Spacing Before Array Index |
| 30 | ArcanistImplicitFallthroughXHPASTLinterRule | Implicit Fallthrough |
| 32 | ArcanistReusedAsIteratorXHPASTLinterRule | Variable Reused As Iterator |
| 34 | ArcanistCommentSpacingXHPASTLinterRule | Comment Spaces |
| 36 | ArcanistSlownessXHPASTLinterRule | Slow Construct |
| 37 | ArcanistCallParenthesesXHPASTLinterRule | Call Formatting |
| 38 | ArcanistDeclarationParenthesesXHPASTLinterRule | Declaration Formatting |
| 39 | ArcanistReusedIteratorReferenceXHPASTLinterRule | Reuse of Iterator References |
| 40 | ArcanistKeywordCasingXHPASTLinterRule | Keyword Conventions |
| 41 | ArcanistDoubleQuoteXHPASTLinterRule | Unnecessary Double Quotes |
| 42 | ArcanistElseIfUsageXHPASTLinterRule | `elseif` Usage |
| 43 | ArcanistSemicolonSpacingXHPASTLinterRule | Semicolon Spacing |
| 44 | ArcanistConcatenationOperatorXHPASTLinterRule | Concatenation Spacing |
| 45 | ArcanistPHPCompatibilityXHPASTLinterRule | PHP Compatibility |
| 46 | ArcanistLanguageConstructParenthesesXHPASTLinterRule | Language Construct Parentheses |
| 47 | ArcanistEmptyStatementXHPASTLinterRule | Empty Block Statement |
| 48 | ArcanistArraySeparatorXHPASTLinterRule | Array Separator |
| 49 | ArcanistConstructorParenthesesXHPASTLinterRule | Constructor Parentheses |
| 50 | ArcanistDuplicateSwitchCaseXHPASTLinterRule | Duplicate Case Statements |
| 51 | ArcanistBlacklistedFunctionXHPASTLinterRule | Use of Blacklisted Function |
| 52 | ArcanistImplicitVisibilityXHPASTLinterRule | Implicit Method Visibility |
| 53 | ArcanistCallTimePassByReferenceXHPASTLinterRule | Call-Time Pass-By-Reference |
| 54 | ArcanistFormattedStringXHPASTLinterRule | Formatted String |
| 55 | ArcanistUnnecessaryFinalModifierXHPASTLinterRule | Unnecessary Final Modifier |
| 56 | ArcanistUnnecessarySemicolonXHPASTLinterRule | Unnecessary Semicolon |
| 57 | ArcanistSelfMemberReferenceXHPASTLinterRule | Self Member Reference |
| 58 | ArcanistLogicalOperatorsXHPASTLinterRule | Logical Operators |
| 59 | ArcanistInnerFunctionXHPASTLinterRule | Inner Functions |
| 60 | ArcanistDefaultParametersXHPASTLinterRule | Default Parameters |
| 61 | ArcanistLowercaseFunctionsXHPASTLinterRule | Lowercase Functions |
| 62 | ArcanistClassNameLiteralXHPASTLinterRule | Class Name Literal |
| 63 | ArcanistUselessOverridingMethodXHPASTLinterRule | Useless Overriding Method |
| 64 | ArcanistNoParentScopeXHPASTLinterRule | No Parent Scope |
| 65 | ArcanistAliasFunctionXHPASTLinterRule | Alias Functions |
| 66 | ArcanistCastSpacingXHPASTLinterRule | Cast Spacing |
| 67 | ArcanistToStringExceptionXHPASTLinterRule | Throwing Exception in `__toString` Method |
| 68 | ArcanistLambdaFuncFunctionXHPASTLinterRule | `__lambda_func` Function |
| 69 | ArcanistInstanceOfOperatorXHPASTLinterRule | `instanceof` Operator |
| 70 | ArcanistInvalidDefaultParameterXHPASTLinterRule | Invalid Default Parameter |
| 71 | ArcanistModifierOrderingXHPASTLinterRule | Modifier Ordering |
| 72 | ArcanistInvalidModifiersXHPASTLinterRule | Invalid Modifiers |
| 73 | ArcanistUnaryPrefixExpressionSpacingXHPASTLinterRule | Space After Unary Prefix Operator |
| 74 | ArcanistObjectOperatorSpacingXHPASTLinterRule | Object Operator Spacing |
| 75 | ArcanistUnaryPostfixExpressionSpacingXHPASTLinterRule | Space Before Unary Postfix Operator |
| 76 | ArcanistArrayValueXHPASTLinterRule | Array Element |
| 77 | ArcanistListAssignmentXHPASTLinterRule | List Assignment |
| 78 | ArcanistInlineHTMLXHPASTLinterRule | Inline HTML |
| 79 | ArcanistGlobalVariableXHPASTLinterRule | Global Variables |
| 80 | ArcanistParseStrUseXHPASTLinterRule | Questionable Use of `parse_str` |
| 81 | ArcanistNewlineAfterOpenTagXHPASTLinterRule | Newline After PHP Open Tag |
| 82 | ArcanistEmptyFileXHPASTLinterRule | Empty File |
| 83 | ArcanistParentMemberReferenceXHPASTLinterRule | Parent Member Reference |
| 84 | ArcanistArrayCombineXHPASTLinterRule | `array_combine()` Unreliable |
| 85 | ArcanistDeprecationXHPASTLinterRule | Use of Deprecated Function |
| 86 | ArcanistUnsafeDynamicStringXHPASTLinterRule | Unsafe Usage of Dynamic String |
| 87 | ArcanistRaggedClassTreeEdgeXHPASTLinterRule | Class Not `abstract` Or `final` |
| 88 | ArcanistClassExtendsObjectXHPASTLinterRule | Class Not Extending `Phobject` |
| 90 | ArcanistNestedNamespacesXHPASTLinterRule | Nested `namespace` Statements |
| 91 | ArcanistThisReassignmentXHPASTLinterRule | `$this` Reassignment |
| 92 | ArcanistUnexpectedReturnValueXHPASTLinterRule | Unexpected `return` Value |
| 97 | ArcanistUseStatementNamespacePrefixXHPASTLinterRule | `use` Statement Namespace Prefix |
| 99 | ArcanistUnnecessarySymbolAliasXHPASTLinterRule | Unnecessary Symbol Alias |
| 107 | ArcanistAbstractPrivateMethodXHPASTLinterRule | `abstract` Method Cannot Be Declared `private` |
| 108 | ArcanistAbstractMethodBodyXHPASTLinterRule | `abstract` Method Cannot Contain Body |
| 113 | ArcanistClassMustBeDeclaredAbstractXHPASTLinterRule | `class` Containing `abstract` Methods Must Be Declared `abstract` |
+=====+=======================================================+===================================================================+
```
epriestley [Fri, 27 Nov 2015 16:35:17 +0000 (08:35 -0800)]
Improve error handling in `arc install-certificate`
Summary: Fixes T9858. Reasonable typos and misunderstandings currently produce very confusing error messages.
Test Plan:
```
$ arc install certificate
Usage Exception: Server URI "certificate" must include a protocol and domain. It should be in the form "https://phabricator.example.com/".
```
Joshua Spence [Wed, 25 Nov 2015 19:18:19 +0000 (06:18 +1100)]
Fix a compatibility issue with `ArcanistUnsafeDynamicStringXHPASTLinterRule`
Summary: A user reported to me that `arc lint` was failing with an error message along the lines of "argument 1 passed to `idx` must be of type array, bool given". I suspect that the user is running an older version of PHP, which means that `array_combine(array(), array())` is returning `false` instead of the expected `array()`. Instead, avoid calling `array_combine` on an empty array.
Test Plan: I don't have PHP 5.3 easily accessible to test this.
Joshua Spence [Mon, 23 Nov 2015 21:18:38 +0000 (08:18 +1100)]
Add a linter rule to determine whether a class should be marked as `abstract`
Summary:
A class containing `abstract` methods must itself be marked as `abstract`.
```
PHP Fatal error: Class X contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (X::Y) in /home/josh/workspace/github.com/phacility/arcanist/test.php on line 5
```
Joshua Spence [Mon, 23 Nov 2015 21:17:25 +0000 (08:17 +1100)]
Add a linter rule for unnecessary symbol aliases
Summary: Add a linter rule to detect symbols which are aliased with the same name, such as `use X\Y\Z as Z`. This is unnecessary and is more-simply expressed as `use X\Y\Z`.
Joshua Spence [Mon, 23 Nov 2015 19:42:39 +0000 (06:42 +1100)]
Add a linter rule for `use` statement namespace prefixes
Summary:
When importing or aliases a symbol with a `use` statement, the leading namespace separator is optional and does not modify the behavior. That is, `use \X` is equivalent to `use X`. As such, the latter syntax should be preferred because it is more concise.
According to the [[http://php.net/manual/en/language.namespaces.importing.php | PHP documentation]]:
> Note that for namespaced names (fully qualified namespace names containing namespace separator, such as `Foo\Bar` as opposed to global names that do not, such as `FooBar`), the leading backslash is unnecessary and not recommended, as import names must be fully qualified, and are not processed relative to the current namespace.
Alex Vandiver [Fri, 20 Nov 2015 06:28:02 +0000 (22:28 -0800)]
Examine upstream path instead of assuming "origin"
Summary:
Instead of blindly assuming that "origin" is the repository that
arcanist should communicate with, use the remote that is configured
for the branch in git.
Test Plan:
Used `arc which` with a branch with no upstream, an
origin/master upstream, and an upstream/master upstream -- the last of
which is being used to create and land this diff.
Alex Vandiver [Fri, 20 Nov 2015 18:55:37 +0000 (10:55 -0800)]
Try switching to the branch of the same name, instead of detached head
Summary:
Landing from a branch that directly tracks origin/master places one in
a detached HEAD state. Instead, examine if there is a local branch of
the name that we landed onto, that also tracks the upstream; if so,
switch to that.
Test Plan:
Made a branch via `git checkout -b testing origin/master`
and tried to `arc land`