Summary: D14037 had the logic slightly wrong and unit test results are now being double rendered.
Test Plan: Ran a unit test with `arc unit -- path/to/test` and saw the results rendered only once.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D14495
Summary:
csslint offers some diagnostics related to all the document without any
relevant line number.
In such case, arc lint failed, as setLine expects null or an integer,
but not an empty string.
The 'char' and 'line' attributes in XML report are now optional.
Fixes T9804.
Test Plan: test case to repro the issue added
Reviewers: chad, joshuaspence, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T9804
Differential Revision: https://secure.phabricator.com/D14497
Summary: Ref T9131. This doesn't seem to be used... it seems like it is a relic of postponed test results.
Test Plan: N/A
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Maniphest Tasks: T9131
Differential Revision: https://secure.phabricator.com/D14487
Summary: I've been thinking about this for a while... why not just fold `ArcanistPhutilXHPASTLinter` into `ArcanistXHPASTLinter`?
Test Plan: `arc unit`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13867
Summary: Ref T8742. As mentioned in D13512. This still needs some work, but looks roughly how I expect it to. Mainly, I want to move the standards stuff to the linter itself rather than the linter rule. I wanted to push this out for some initial feedback though.
Test Plan: This still needs work.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Maniphest Tasks: T8742
Differential Revision: https://secure.phabricator.com/D13942
Summary:
Fixes T9661. Users can construct arbitrarily long chains from the remote, like:
(remote) origin/master -> (local) cascade-a -> (local) cascade-b -> (local) cascade-c -> (local) cascade-d
When a user lands "cascade-d" onto "origin/master", we should pull A, B and C if they aren't ahead of the remote.
If a user lands "cascade-d" onto itself, we should pull A, B, and C if they aren't ahead of the remote, then reset D to the remote.
We also find this chain if the last component of it is connected by the local branch having the same name as the remote branch (typical for "master") instead of an actual connection through tracking brnaches.
Test Plan: See comment below.
Reviewers: chad
Reviewed By: chad
Subscribers: edibiase
Maniphest Tasks: T9661
Differential Revision: https://secure.phabricator.com/D14361
Summary:
Ref T9661. I need to reuse this to fix the complex workflow described in T9661 where we need to follow multiple paths to the upstream and cascade updates across them.
Pull the logic into a separate class to make this easier and less copy/pastey.
This shouldn't change any behavior.
Test Plan: Ran `arc land --preview` from detached head, remote-tracking branch, non-tracking branch, local-tracking branch. Selection of target/remote seemed correct in all cases.
Reviewers: chad
Reviewed By: chad
Subscribers: edibiase
Maniphest Tasks: T9661
Differential Revision: https://secure.phabricator.com/D14360
Summary: Fixes T9660. The behavior for this check wasn't quite right -- we want to check the "source ref" (what we're landing) against the "target onto" (the branch we're landing it onto).
Test Plan:
- Landed from `master` (tracking origin/master). No delete.
- Landed from `feature1` (tracking local/master). Delete.
- Landed from `feature2` (tracking origin/master). Delete.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T9660
Differential Revision: https://secure.phabricator.com/D14358
Summary:
Fixes T9543. Fixes T9658. Ref T3855.
Major functional change is that you can have a sequence of branches like:
origin/master -> notmaster -> feature1
...where they track each other, but you named your local master something else. Currently, we resolve only one level of upstreams, so we try to land onto "notmaster" in this case, which is wrong.
Instead, keep resolving upstreams until we either hit a cycle, don't have another upstream to look at, or find someting in a remote. In this case we'll eventually find "origin/master" and select "origin" as the remote and "master" as the target.
Other minor changes:
- Make this selection process explicit.
- Make the help 3000x longer.
Also fix a bug where we could incorrectly try to tell Differential to update awith `--preview`.
Test Plan:
- Landed from a tag.
- Landed from a tracking branch.
- Landed from an nth-degree tracking branch.
- Tried to land from a local branch with a cycle in upstreams.
- Landed with --remote and --onto.
- Read `arc help land`.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T9658, T3855, T9543
Differential Revision: https://secure.phabricator.com/D14357
Summary:
Ref T3855. Fixes T9537. Fixes T8620. Fixes T4333.
This declares bankruptcy and replaces the entire `arc land` workflow under Git. These are the notable changes:
- (T3855) You can now land from a branch to itself.
- (T3855) We now try to restore the original state very aggressively after any failure, instead of dumping you into the middle of a mess.
- (T9537) You can now land without a local branch.
- ([not actually] T9543) We'll now ignore the local branch if it just happens to be named the same thing as the remote branch but doesn't actually track it.
- (T8620) You can now land from a detached HEAD.
- (T4333) We now preserve the author and author date of whatever you land.
This may need some followup work. In particular:
- The signal handler (that tries to put you in a better place if you ^C in the middle of things) causes ^C to work awkwardly in prompts. This might not be worth it.
- Errors/instructions on push/merge issues might need work.
- I dropped support for `--delete-remote` and `--update-with-blah-blah` because I think these flags aren't worth their complexity.
- I've simplified the update/merge algorithm a bit. It may need some complexity added back in.
- I probably missed a few things because this covers like 200 unique, creative workflows.
- Users might need more guidance on the workflows that drop them in the middle of nowhere if they manage to reach them more often than I think.
Test Plan:
- Used `arc land` to land like at least 15,000 different kinds of changes.
- Landed normally.
- Landed from a branch onto itself.
- Landed from a detached head.
- Landed nothing.
- Landed with no local branch.
- Landed onto made-up branches.
- Landed with bad targets.
- ^C'd things in the middle.
Reviewers: chad
Reviewed By: chad
Subscribers: tycho.tatitscheff
Maniphest Tasks: T3855, T4333, T8620, T9537, T9543
Differential Revision: https://secure.phabricator.com/D14356
Summary:
Fixes T9222. Two issues here:
- First, we currently continue on error. Throw instead. I just swapped us from "phutil_passthru()" to "execx()" since I don't think printing out the "pulling from remote..." status messages is very important, and this makes it easier to raise a useful exception.
- Second, if you have a dirty working copy we currently may try to do some sort of silly stuff which won't work, like prompt you to amend changes. Instead, do a slightly lower-level check and just bail.
Test Plan:
- Ran `arc upgrade` with a dirty working copy and got a tailored, useful error.
- Ran `arc upgrade` with an artificially bad `git pull` command, got a failure with a specific error message.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T9222
Differential Revision: https://secure.phabricator.com/D14317
Summary:
Linters can now use the `version` configuration value to specify the required
version of the external binary. The version number may be prefixed with <, <=,
>, >=, or = to specify the version comparison operator (default: =).
PHP's native `version_compare()` function is used to perform the comparison.
Fixes T4954.
Test Plan: Tested against a sample of external linters.
Reviewers: joshuaspence, epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, joshuaspence
Projects: #lint
Maniphest Tasks: T4954
Differential Revision: https://secure.phabricator.com/D14298
Summary:
See discussion in D13737. If you're using this linter to match messages which //sometimes// have a character, you can get `""` (empty string) matches when the expression doesn't match. We'll complain about these later.
Instead, cast the matches the expected types.
Test Plan: @csilvers confirmed fix, see D13737.
Reviewers: chad, csilvers
Reviewed By: csilvers
Subscribers: spicyj, csilvers
Differential Revision: https://secure.phabricator.com/D14307
Summary: See D14232. That didn't actually work. It looks like this does.
Test Plan:
- Ran `git commit --author ...` on build server and saw the same failure.
- Ran `git -c ... -c ... commit ...` on build server and saw it work.
Reviewers: chad
Reviewed By: chad
Differential Revision: https://secure.phabricator.com/D14233
Summary:
On `sbuild`, we currently get a failure on this test. Use an explicit `--author` so we can run the test even if `user.email` and `user.name` are not set in global Git config.
```
FAIL ArcanistBundleTestCase::testGitRepository
15 EXCEPTION (CommandException): Command failed with error #128!
16 COMMAND
17 git commit -m 'Mark koan2 +x and edit it.'
18
19 STDOUT
20 (empty)
21
22 STDERR
23
24 *** Please tell me who you are.
25
26 Run
27
28 git config --global user.email "you@example.com"
29 git config --global user.name "Your Name"
30
31 to set your account's default identity.
32 Omit --global to set the identity only in this repository.
33
34 fatal: empty ident name (for <builder@sbuild001.phacility.net>) not allowed
```
Test Plan: Ran `arc unit --everything`. Will verify in production.
Reviewers: chad
Reviewed By: chad
Differential Revision: https://secure.phabricator.com/D14232
Summary:
This is in a similar vein as D14220 and sets a name on linter
messages. This should handle issues from D14165.
Test Plan: Run as many of the changed linters as possible + existing linter tests.
Reviewers: chad, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D14225
Summary: Fixes T9498
Test Plan: Run `arc lint` with errors that get caught and reported by `ArcanistClosureLinter`
Reviewers: joshuaspence, epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Maniphest Tasks: T9498
Differential Revision: https://secure.phabricator.com/D14220
Summary: Ref T5821. Basic idea here is that Harbormaster can run `arc unit --everything --target ...` to get a build target updated.
Test Plan: Ran `arc unit --target ...`, saw web UI update with test results.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T5821
Differential Revision: https://secure.phabricator.com/D14190
Summary:
Fixes T9476. Currently, if you enter no text in "arc:prompt", we abort resolution immediately.
However, this is a bit inconsistent (other rules that fail to resolve are skipped) it is reasonable to put some default rule behind "arc:prompt" so that you can just mash enter to select it. This construction is unusual, but seems fine and sensible to me.
If you're using "arc:prompt" as the last rule, the behavior is the same as before, so this should only make the rule more useful.
Test Plan:
- Ran `arc which --base 'arc:prompt, git:HEAD^'` with and without the patch.
- Without the patch, entering no text at "arc:prompt" failed immediately.
- With the patch, entering no text caused fallback to the "git:HEAD^" rule.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T9476
Differential Revision: https://secure.phabricator.com/D14187
Summary: Ref T9145. Fixes T9316. We now require "name" and "code" has a maximum length (currently, this is 32, but the next diff will raise it to 128).
Test Plan:
- Installed PHPCS.
- Hit both the "name" and "code" issues.
- Applied this patch.
- Got better errors sooner.
Reviewers: chad
Reviewed By: chad
Subscribers: aik099
Maniphest Tasks: T9145, T9316
Differential Revision: https://secure.phabricator.com/D14165
Summary:
Fixes T9455. Depends on D14136. When you have a dirty submodule:
$ nano submodule/file.c # save changes
...we currently ask you to make a commit when you run `arc diff`, which is meaningless and misleading.
Instead, prompt the user separately.
This behavior isn't perfect but I think it's about the best we can do within reason.
Test Plan:
- Ran `arc diff` in a working copy with uncommitted submodule changes only, got new prompt.
- Ran `arc diff` in a working copy with submodule base commit changes only, got old (correct) prompt.
- Ran `arc diff` in a working copy with both, got only old prompt (which is incomplete, but reasonable/meaningful).
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T9455
Differential Revision: https://secure.phabricator.com/D14137
Summary:
Fixes a minor issue from D14034. PHP doesn't like `clone null;`, and if you type a nonsense command like `arc nbrhch` (as I frequently do) we try to `clone null` here.
Instead, just `return null;` if no workflow matches. Clone otherwise.
Test Plan:
- Ran `arc nbrhcanc`
- Ran `arc branch`
Reviewers: BYK, chad
Reviewed By: chad
Differential Revision: https://secure.phabricator.com/D14112
Summary: Fixes T9159.
Test Plan: Run `arc patch` on a code base requiring auth for a diff that has at least one dependency.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: avivey, thoughtpolice, joshuaspence, Korvin
Maniphest Tasks: T9159
Differential Revision: https://secure.phabricator.com/D14034
Summary: Closes T9353. I think this makes all descriptions at least basically informative.
Test Plan: arc linters - I can now understand what each one is about.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T9353
Differential Revision: https://secure.phabricator.com/D14106
Summary: I think they were wrong.
Test Plan: `arc linters nolint`. It would fail without it.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, #lint
Differential Revision: https://secure.phabricator.com/D14084
Summary: close T9043. This still allows for one dir to be in `master` and the other in `stable`, but hopefully that's not going to be a problem.
Test Plan: Clone arc/libph, checkout `stable`, run arc upgrade.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: cburroughs, epriestley
Maniphest Tasks: T9043
Differential Revision: https://secure.phabricator.com/D14076
Summary: Ref T7148. In D14056, I let `arc upload` upload temporary files, but this is a better way to do some of the internals. Also add support for setting a `viewPolicy`.
Test Plan: Used `arc upload`, `arc upload --temporary`.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T7148
Differential Revision: https://secure.phabricator.com/D14075
Summary: Ref T7148. Depends on D14055. Allows files to be marked as temporary when uploaded.
Test Plan: Used `arc upload --temporary` to upload temporary files.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T7148
Differential Revision: https://secure.phabricator.com/D14056
Summary:
7e2df9a attempted to pht() some strings; unfortunately, it assumed
that some things that were calls to phutil_console_wrap() were
actually calls to phutil_console_format(). This produces errors of
the form:
[2015-07-17 21:17:28] ERROR 2: str_repeat() expects parameter 2 to be long, string given at [/usr/local/libphutil/src/console/format.php:162]
#0 str_repeat(string, string) called at [<phutil>/src/console/format.php:162]
#1 phutil_console_wrap(string, string, string) called at [<arcanist>/scripts/arcanist.php:620]
#2 arcanist_load_libraries(array, boolean, string, ArcanistWorkingCopyIdentity) called at [<arcanist>/scripts/arcanist.php:154]
%s: %s
Provide an additional call to phutil_console_format() when necessary,
or simply append the relevant characters if possible.
Test Plan: Caused a library load error
Reviewers: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D14053
Summary:
The `--no-verify` flag was not added until git 1.8.2. This
flag is used to avoid running local pre-push hooks. This is likely a
rare configuration and is safe to omit the flag on older versions.
Users with local pre-push hooks **and** older git version may need to
adjust their workfow.
fixes T9310
Test Plan:
* Ran `arc diff` with my real git 1.7.10.4 and succeeded with `STAGING
PUSHED`.
* Edited `getGitVersion` to be > 1.8.2 and pushed again. Got
`STAGING FAILED` because `error: unknown option`.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: joshuaspence, epriestley
Maniphest Tasks: T9310
Differential Revision: https://secure.phabricator.com/D14033
Summary: Ref T7215. This test is occasionally failing for me locally. Remove it as per D13992.
Test Plan: `arc unit`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T7215
Differential Revision: https://secure.phabricator.com/D14027
Summary: Adds two different linter rules (one general purpose and another PHP specific) to prevent empty files from being added to a repository. For some unknown reason, people seem to like to do this.
Test Plan: Added test cases.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: avivey, cburroughs, Korvin
Differential Revision: https://secure.phabricator.com/D13881
Summary: `<?php\n\n...` is much easier to read than `<?php\n...`. Depends on D13889 and D13890.
Test Plan: Added unit tests.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13534
Summary: Ref T9134. It looks like this functionality was removed in D13848. Depends on D13869.
Test Plan: Ran `arc diff`, `arc lint` and `arc unit`.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T9134
Differential Revision: https://secure.phabricator.com/D13868
Summary:
'git ls-remote --get-url' is more correct, but younger and less
supported. This commit tempers previous optimism about its availability,
improving support for users of older git packages.
Test Plan:
* Set `git config url.xttps.insteadOf https` rewrite rule.
* Ran `arc which` with git 1.7.5 in `$PATH`, saw rewritten configured remote.
* Ran `arc which` with git 1.7.4 in `$PATH`, saw configured remote.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13998
Summary:
This guards against stability issues with the output format of 'git
blame' (such as git config, localization (ref T5554) or future changes).
For example, `git config blame.blankboundary true` breaks `arc cover`
before this patch.
Test Plan:
* Set `git config blame.blankboundary true` on a test repo.
* Ran `arc cover`. It failed with an exception ("Bad blame?").
* Applied this patch.
* `arc cover` works.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T5554
Differential Revision: https://secure.phabricator.com/D13993
Summary: Fixes T9257. For some messages, PyLint can raise at "character -1", which we don't allow since we don't consider it to make sense.
Test Plan:
- Added failing unit test from T9257.
- Applied patch.
- Test now passes.
Reviewers: joshuaspence, chad
Reviewed By: joshuaspence, chad
Maniphest Tasks: T9257
Differential Revision: https://secure.phabricator.com/D13991
Summary:
Fixes T7215. See D13991. These test cases have been failing intermittently for a while.
I think the XML stuff (which we don't control) changed where it raises these warnings: an old version raised them at the end of the attribute, while the new version raises them at the beginning of the attribute. Not totally 100% sure about this since installing multiple versions is fairly inconvenient, but as far as I know both versions raise the warnings, just at different character offsets.
We could do various things to fix these tests (allow the warning to raise at any character, skip the tests based on versions, etc) but I think it's easier to just remove the tests. They don't seem valuable.
Test Plan: Tests failed prior to change; now pass.
Reviewers: chad, joshuaspence
Reviewed By: joshuaspence
Maniphest Tasks: T7215
Differential Revision: https://secure.phabricator.com/D13992
Summary:
Ref T5554. Both the current branch name (if on a branch), as well as the
list of all local branches, can be retrieved without having to parse the
output from "git branch".
Unfortunately, there seems to be no git plumbing for "get list of
branches containing this commit" yet.
(see http://marc.info/?l=git&m=141408477614635&w=2)
For that case, this commit whitelists the output from "git branch" using
the known valid branch names from "git for-each-ref".
Test Plan:
Set up a test repo with this structure:
```
| * Commit B1, on branch "subfeature"
| /
| * Commit A1, on branch "feature"
|/
* Commit M1, on branch "master"
|
```
In `subfeature`, I tried:
* `arc which --base 'git:branch-unique(master)'`
* `arc feature`
After that, I detached my HEAD (don't worry, I got better) and tried again.
Nothing looked broken.
(Tested with git 1.7.2.5 and 2.5.0.)
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T5554
Differential Revision: https://secure.phabricator.com/D13989
Summary:
Ref T5554. This makes git remote URL detection locale-agnostic.
The previously suggested `git config remote.origin.url` command does
almost the same, but does not support the URL rewriting features in
git-config (`url.<base>.insteadOf`).
This one does, although it has the unintuitive behavior of just printing
the passed remote name when the remote does not exist, or even when
called outside a git repo.
Test Plan:
* Switched to non-english locale in which git has a translation.
* Ran `arc which` on the Arcanist repo. It could not determine the remote URI.
* Applied patch, `arc which` found the URI.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: johnny-bit, Korvin
Maniphest Tasks: T5554
Differential Revision: https://secure.phabricator.com/D13983
Summary:
Improves upon D13795 to correctly handle variables within strings. Specifically, the following code currently (incorrectly) warns about `$x` being undeclared:
```lang=php
function some_func() {
return function ($x) {
echo "$x";
};
}
```
It's worth noting that the situation would be improved if XHPAST properly parsed strings (see T8049).
Test Plan: Added test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13938
Summary: This was taken from D13569.
Test Plan: `arc lint` still works.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13943
Summary:
"Branch" was pluralized as "branchs".
Fixes T9225.
Test Plan:
* Created test repo with two revisions on a feature branch.
* Saw old message, frowned a little.
* Applied patch.
* No longer frowning.
Reviewers: chad, epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: avivey, Korvin
Maniphest Tasks: T9225
Differential Revision: https://secure.phabricator.com/D13944
Summary: Removed excess quotations on the `--msg-template` option as it was interfering with the string-int coercion
Test Plan: Unsure
Reviewers: joshuaspence, epriestley, #blessed_reviewers
Reviewed By: joshuaspence, epriestley, #blessed_reviewers
Subscribers: joshuaspence, e-m-albright, Korvin
Maniphest Tasks: T9214
Differential Revision: https://secure.phabricator.com/D13931
Summary: Adds a basic linter for ensuring that `composer.lock` files are up-to-date.
Test Plan: We have been using this in a private project for around a month.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: johnny-bit, Korvin
Differential Revision: https://secure.phabricator.com/D13883
Summary: Currently, linting PHP short array syntax (i.e. `[...]`) throws an exception ("Expected open parentheses"). This diff relaxes some restrictions which prevent short array syntax from linting with `ArcanistParenthesesSpacingXHPASTLinterRule`.
Test Plan: Modified test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: agenticarus, Korvin
Differential Revision: https://secure.phabricator.com/D13895
Summary: Improve `ArcanistInlineHTMLXHPASTLinterRule` such that it doesn't raise duplicate warnings. Also be a bit more lax with whitespace.
Test Plan: Unit tests now pass.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13896
Summary: Ref T7409. Global variables are gross and should be avoided like the plague.
Test Plan: Added test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Maniphest Tasks: T7409
Differential Revision: https://secure.phabricator.com/D13882
Summary: Add a linter rule to prevent trailing commas in a list assignment. `list($x, $y,)` is equivalent to `list($x, $y)`, but the latter is cleaner and should be preferred.
Test Plan: Added test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13870
Summary:
Fixes T9029
See T9029 for more details, but basically at some point phutil_console_confirm
(which takes a `$default_no` parameter) was refactored to `$console->confirm()`
which takes a `$default` parameter with semantics negated..
Test Plan:
Run `arc lint` on a repository where patch is suggested. Default
option should be "[Y/n]" to accept the patch.
Reviewers: joshuaspence, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley
Maniphest Tasks: T9029
Differential Revision: https://secure.phabricator.com/D13873
Summary: This is a test case for `ArcanistXHPASTLinter`, not `ArcanistPhutilXHPASTLinter`.
Test Plan: `arc unit`
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13866
Summary: This was broken in D13573.
Test Plan: Ran `arc unit --everything` in rPHU.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13864
Summary: Modify `ArcanistParenthesesSpacingXHPASTLinterRule` and `ArcanistCallParenthesesXHPASTLinterRule` to apply to `array()` and `list()` as well. Depends on D13858.
Test Plan: Added unit tests.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13859
Summary: This test case is failing on JSHint v2.8.0.
Test Plan: `arc unit`
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13860
Summary:
Ref T8096. Each test reports coverage information, which we sometimes merge into a combined coverage report.
Usually, each test will report results for every line in the file, so if the file is 30 lines long, coverage is usually 30 characters long.
However, for whatever reason, tests might report results for only the first part of the file. This is allowed and we handle it properly.
Right now, if one test reports 10 lines of results and another reports 30 lines of results, we only use the first 10 lines of results. Instead, extend the merged coverage to include the extra 20 lines of results.
(This is an uncommon case which I only hit because I was manually banging on my keyboard to generate test data, but there's no reason not to handle it better.)
Test Plan: Used web UI, added + executed unit tests.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T8096
Differential Revision: https://secure.phabricator.com/D13854
Summary: Ref T5568. Use the `ArcanistConfigurationDrivenUnitTestEngine` automatically, if an `.arcunit` file exists. This behavior mimics the auto-detection for the configuration driven lint engine.
Test Plan:
Ran through the following scenarios:
- Ran `arc unit` and saw unit tests execute.
- Ran `arc unit --engine PhutilUnitTestEngine`
- Remove the `.arcunit` file and ran `arc unit`... got an exception.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Maniphest Tasks: T5568
Differential Revision: https://secure.phabricator.com/D13855
Summary:
This linter rule fails on multi-line arrays with no whitespace before the first array value. Specifically, the following exception is thrown:
```
Fatal error: Call to a member function isAnyWhitespace() on boolean in arcanist/src/lint/linter/xhpast/rules/ArcanistArrayValueXHPASTLinterRule.php on line 40
```
Test Plan: Added another test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13856
Summary: Add a linter rule to ensure that array elements occupy a single line each.
Test Plan: Added test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13842
Summary: Ref T5568. As discussed in IRC. This is very rough and not widely useable, but represents a solid first step.
Test Plan: Ran `arc unit` with a bunch of flags.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: rfreebern, aripringle, jaydiablo, BYK, tycho.tatitscheff, epriestley, Korvin
Maniphest Tasks: T5568
Differential Revision: https://secure.phabricator.com/D13579
Summary: Use `PhutilClassMapQuery` instead of `PhutilSymbolLoader`, mainly for consistency. Depends on D13572.
Test Plan: This hasn't been tested very comphrehensively as of yet.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13573
Summary:
Fixes T8674. Currently, `ArcanistSelfMemberReferenceXHPASTLinterRule` warns if a fully-qualified class name is used in place of `self`. This is fine in most cases, but in some specific scenarios fails for PHP 5.3 because `self` (and also `$this`) cannot be used in an anonymous closure (see [[http://php.net/manual/en/functions.anonymous.php | anonymous functions]] and [[https://wiki.php.net/rfc/closures/removal-of-this | removal of `$this` in closures]]).
In order to do this, I also had to modify the manner in which configuration was passed to individual linter rule. Previously, it was only possible or an individual linter rule to be set with a configuration value. Once the linter rule had set this value, there was no means by which to allow this value to be shared amongst linter rules.
Depends on D13819.
Test Plan: Added unit tests.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T8674
Differential Revision: https://secure.phabricator.com/D13820
Summary:
Improve `ArcanistUselessOverridingMethodXHPASTLinterRule` by allowing overriding methods which set default values. For example, the following scenario is perfectly valid:
```lang=php
class SomeClass {
public function __construct($x) {}
}
class SomeOtherClass extends Class {
public function __construct($x = null) {
parent::__construct($x);
}
}
```
Test Plan: Added test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13840
Summary: Ref T8674. Adds to `ArcanistPHPCompatibilityXHPASTLinterRule` such that an error is raised whenever `self` or `$this` is used in an anonymous closure prior to PHP 5.4.
Test Plan: Added test cases.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T8674
Differential Revision: https://secure.phabricator.com/D13841
Summary: Ref T8742. Anonymous functions should have a space after the `function` keyword. Additionally, ensure that there is a space before and after the `use` token.
Test Plan: Modified existing test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Maniphest Tasks: T8742
Differential Revision: https://secure.phabricator.com/D13804
Summary: Unary postfix expressions should not have a space before the operator.
Test Plan: Added test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13805
Summary: Add a linter rule to check that there is no whitespace surrounding the object operator, `->`.
Test Plan: Added test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13798
Summary: Add a linter rule to ensure that there is no space between the operator and the operand in a unary prefix expression.
Test Plan: Added test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13797
Summary: Repurpose `ArcanistClosingCallParenthesesXHPASTLinterRule` (and rename it to `ArcanistCallParenthesesXHPASTLinterRule`) to ensure that there is no spacing before opening parenthesis in function calls.
Test Plan: Added test case.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13796
Summary: Ref T7419. This makes it easier to render helpful documentation in the next diff without having to copy/paste things.
Test Plan:
In next diff:
{F688894}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T7419
Differential Revision: https://secure.phabricator.com/D13788
Summary: Ref T8921. See similar change in D13695. This expands the scope to also coerce `setChar()`.
Test Plan: `arc unit --everything`
Reviewers: btrahan
Subscribers: epriestley
Maniphest Tasks: T8921
Differential Revision: https://secure.phabricator.com/D13737
Summary:
Fixes T8912. Property `$project_root` was missing in `PytestTestEngine` class, resulting in
broken py.test wrapper. Also renaming the property so the linter is happy.
Test Plan: `arc unit --everything`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: kparal, epriestley, Korvin
Maniphest Tasks: T8912
Differential Revision: https://secure.phabricator.com/D13698
Summary: Fixes T8921. Harbormaster is strict about types it accepts, but `ArcanistLintMessage` is more liberal. Push the strictness barrier down to the linter level, while maintaining reasonable flexibility in the API.
Test Plan: `arc unit --everything`
Reviewers: btrahan, chad
Reviewed By: chad
Subscribers: epriestley
Maniphest Tasks: T8921
Differential Revision: https://secure.phabricator.com/D13695
Summary: "Advice" is not a valid severity for Checkstyle... valid severities are `ignore`, `info`, `warning` and `error`.
Test Plan: Read the [[http://checkstyle.sourceforge.net/property_types.html | documentation]].
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13684
Summary: Improve `ArcanistClosingDeclarationParenthesesXHPASTLinterRule` (and rename it to `ArcanistDeclarationParenthesesXHPASTLinterRule`) to ensure that there is no whitespace before the opening parenthesis of a function/method declaration.
Test Plan: Added test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13675
Summary:
This is to fix `arc unit` when running a test file with no test results (e.g. skipped)
```
EXCEPTION: (RuntimeException) Undefined variable: last_test_finished at [<phutil>/src/error/PhutilErrorHandler.php:210]
arcanist(head=master, ref.master=d54cb072facd), deviantart(), phutil(head=master, ref.master=75f675747648)
#0 PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/unit/parser/ArcanistPhpunitTestResultParser.php:95]
#1 ArcanistPhpunitTestResultParser::parseTestResults(string, string) called at [<deviantart>/unit/DaUnitEngine.php:150]
#2 DaUnitEngine::parseTestResults(string, TempFile, string, string) called at [<deviantart>/unit/DaUnitEngine.php:82]
#3 DaUnitEngine::run() called at [<arcanist>/src/workflow/ArcanistUnitWorkflow.php:186]
#4 ArcanistUnitWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
```
Test Plan: Create a test file with skipped tests. Run `arc unit`. Make sure the exception is not thrown.
Reviewers: joshuaspence, epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin, aurelijus
Differential Revision: https://secure.phabricator.com/D13640
Summary: Fixes T8805. Explicitly require int/float for duration. Adjust XUnit/Go parsers to provide one.
Test Plan: Ran unit tests.
Reviewers: btrahan, joshuaspence, chad
Reviewed By: chad
Subscribers: jsotuyod, champo, epriestley
Maniphest Tasks: T8805
Differential Revision: https://secure.phabricator.com/D13637
Summary:
Ref T8332. I find it really odd that I need to run `arc lint --everything --output xml > checkstyle.xml` and feel that it would be much more intuitive to just run `arc lint --everything --output xml` and have the output written to `checkstyle.xml`.
To provide context, we are running `arc lint --everything` in a CI job and parsing the results.
Test Plan: Ran `arc lint --everything --output xml` and saw the output written to file.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Maniphest Tasks: T8332
Differential Revision: https://secure.phabricator.com/D13570
Summary: I think that this output was used during the early stage of `ArcanistConfigurationDrivenLintEngine`, but I question it's value nowadays. In particular, I find that this output makes the output of `arc lint --trace` significantly less useful.
Test Plan: Ran `./bin/arc lint --trace` and saw useful output.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13593
Summary: This host is no longer in service.
Test Plan: `git grep -i www.phabricator.com`
Reviewers: chad
Reviewed By: chad
Subscribers: epriestley
Differential Revision: https://secure.phabricator.com/D13586
Summary: Fixes T8714. When a test engine isn't returning the correct result type, shift suspicion onto it.
Test Plan: Faked error, got exception blaming test engine.
Reviewers: joshuaspence, btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T8714
Differential Revision: https://secure.phabricator.com/D13486
Summary:
Ref T8670. Ref T8657.
- When lint only has advice (no warnings/errors), consider it a "passing" build.
- Be a little louder about `sendmessage` calls failing because this stuff is not totally broken and that makes T8670-related things easier to catch/fix.
Test Plan: Created this revision.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T8657, T8670
Differential Revision: https://secure.phabricator.com/D13436
Summary: Return `$this` from a bunch of setter methods for consistency. See also D13422.
Test Plan: Eyeball it.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13423
Summary: For consistency, a single space should separate `catch` and the following parenthetical expression.
Test Plan: Added test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13389
Summary:
Ref T8095. Before uploading lint/unit results in the old way, try to ship them to autotargets.
If we can query and upload data to autotargets, do so, and then skip the older style uploads.
Test Plan: Used `arc diff` to ship data up via Harbormaster.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T8095
Differential Revision: https://secure.phabricator.com/D13381
Summary: Add some tests to ensure that `ArcanistXHPASTLinterRule` subclasses are properly implemented. This should catch issues such as two linter rules having the same `ID` value. See D13272 for a similar change.
Test Plan: `arc unit`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13274
Summary: All base classes should extend from `Phobject` or some other classes. See D13275 for some explanation.
Test Plan: `arc unit`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13281
Summary: If I understand correctly, all classes should extend from `Phobject`?
Test Plan: This needs some further work
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D13275
Summary: I found another issue with T8042... it seems that tests from the root directory (i.e. `src/__tests__` are not being discovered properly). The handling of this case (`$library_path` being the library root directory) can probably be improved, and I am open to suggestions. Depends on D13202.
Test Plan: Added to existing test cases.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D13185
Summary: Minor tidying of documentation and adding some groups.
Test Plan: Eyeball it.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D13135
Summary:
Ref T8042. Tests were not being discovered in two different scenarios:
# Files modified at the same level as the library root directory.
# "Normal" directories like `src/unit/engine`.
This regression was caused by D12689.
Test Plan: Added unit tests.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T8042
Differential Revision: https://secure.phabricator.com/D13126
Summary: Fixes T8374.
Test Plan:
```
$ arc diff
You have untracked files in this working copy.
Working copy: /Users/epriestley/dev/core/lib/arcanist/
Untracked changes in working copy:
(To ignore this change, add it to ".git/info/exclude".)
derp
Ignore this untracked file and continue? [y/N] ^C
```
Reviewers: btrahan, joshuaspence, chad
Reviewed By: chad
Subscribers: epriestley
Maniphest Tasks: T8374
Differential Revision: https://secure.phabricator.com/D13096
Summary:
The `ArcanistXHPASTLinter` class is becoming quite bloated. This diff separates the class into one-class-per-rule, which makes everything much more modular. One downside to this decoupling is that code reuse between linter rules is much more difficult, although this only affects a very small number of linter rules.
There is still some further work that could be done here, but I defer this until a later diff:
- Rewrite `ArcanistPhutilXHPASTLinter` using `ArcanistXHPASTLinterRule`.
- Change the unit tests so that they are truly only testing a single linter rule.
- Maybe improve the way in which linter configuration options are handled.
- Make it easier to keep track of the linter rule IDs (see T6859).
Test Plan: `arc unit`
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: johnny-bit, epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D10541
Summary: Fixes T8344. Prior to D12971, this always returned `array()`. It may now sometimes return `null`. Switch the behavior to be more similar to the old behavior.
Test Plan: Inspection.
Reviewers: btrahan, joshuaspence
Reviewed By: joshuaspence
Subscribers: epriestley
Maniphest Tasks: T8344
Differential Revision: https://secure.phabricator.com/D13061
Summary: Fixes T8042. Changes the way that `PhutilUnitTestEngine` discovers unit tests. In particular, if you only modify a single test case then there is no reason to run all other test cases within the same directory (which is the current behavior).
Test Plan: Added some unit tests.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, epriestley
Maniphest Tasks: T8042
Differential Revision: https://secure.phabricator.com/D12689
Summary: Ref T8238. If a staging area is configured for a repository (see D13019), push a copy of changes to it after creating a diff.
Test Plan: Ran `arc diff` with various options, saw applicable changes get pushed to staging.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: cburroughs, epriestley
Maniphest Tasks: T8238
Differential Revision: https://secure.phabricator.com/D13020
Summary: Fixes T8259. Depends on D13016. Use modern logic to support large file uploads.
Test Plan:
- Diffed with some images, saw them show up in the diff.
- Diffed with a 12MB binary, saw it upload in chunks.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T8259
Differential Revision: https://secure.phabricator.com/D13017
Summary:
Ref T8259. Currently, `arc upload` uses new logic but `arc diff` uses older logic internally. This prevents `arc diff` from uploading files larger than 4MB to newer servers.
Split the upload logic apart so the two upload pathways can share it. Callers now build a list of FileDataRefs and hand them to an Uploader for upload.
Test Plan:
Ran `arc upload` on:
- One file.
- Several files.
- Small files.
- Big files.
- Directories.
- Unreadable files.
- Files full of random data.
- The same file over and over again.
- The same big file over and over again.
- Artificially broke `file.allocate` and redid some of the simple cases (large/chunked aren't expected to work in this case).
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: joshuaspence, epriestley
Maniphest Tasks: T8259
Differential Revision: https://secure.phabricator.com/D13016
Summary:
Fixes T8314. Change the phutil_console_wrap() call to only have a single
string parameter.
Test Plan:
Ran `arc diff` added text into the title, summary and test plan fields,
but did not specify any reviewers. When prompted to continue, clicked 'No' and
saw the '(Message saved to commit message.)' string.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley
Maniphest Tasks: T8314
Differential Revision: https://secure.phabricator.com/D13015
Summary: Ref T7604. Remove "arcanist projects" from `ArcanistWorkingCopy` and a few other callsites. Depends on D12999.
Test Plan: Can't really think of how to test this.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley
Maniphest Tasks: T7604
Differential Revision: https://secure.phabricator.com/D12945
Summary: Ref T7604. Remove call to the `arcanist.projectinfo` #conduit endpoint from `ArcanistWorkflow`. Depends on D12992.
Test Plan: Ran `arc which` and verified that repository information was present.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley
Maniphest Tasks: T7604
Differential Revision: https://secure.phabricator.com/D12971
Summary:
Ref T7604. Ref T8307. This was broken in D12962 because I only tested `arc patch --arcbundle`. Furthermore, this particular sanity check doesn't actually do anything now (see T8307).
Test Plan:
Ran `arc patch --nobranch D12971` successfully.
Auditors: epriestley
Summary:
Ref T7604. Remove a call to `arcanist.projectinfo` from `arc export`. This Conduit call was only used to detect the repository encoding, which we should be able to do locally anyway.
I was considering removing the `$projectName` from `ArcanistBundle` as well, but I'm not convinved that this is a good idea. Specifically, doing so would make it difficult to issue the "This patch is for the 'X' project, but the working copy belongs to the 'Y' project" error. We could potentially use the repository callsign for this purposes, but this isn't portable across installs.
Test Plan: I'm not quite sure how to test this. I suspect that this functionality isn't widely used anyway.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7604
Differential Revision: https://secure.phabricator.com/D12962
Summary: I found a few strings that I had missed, using a mostly-broken-but-somewhat-okay custom linter ruler (https://secure.phabricator.com/differential/diff/30988/).
Test Plan: Intense eyeballing.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: aurelijus, Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12888
Summary:
Currently, a lot of `ArcanistExternalLinter` subclasses have something like this:
```lang=php
if ($err && !$messages) {
return false;
}
```
We can avoid this code duplication by moving this check to the `ArcanistExternalLinter` class.
Test Plan: `arc unit`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D11321
Summary: This allows `ArcanistBaseXHPASTLinter::getXHPASTTreeForPath` to return the parse tree for a file that wasn't explicitly linted. In my particular use case, I am writing a linter rule to determine if it is necessary to import a PHP file with `require_once` (i.e. the file consists only of class/interface definitions which are autoloadable).
Test Plan: Tested externally using a custom linter.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12271
Summary: Ref T7674. `ArcanistXHPASTLinter` has some workarounds for running in "commit hook" mode (which has since been removed). This linter should always have a working copy.
Test Plan: `arc unit`
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, epriestley
Maniphest Tasks: T7674
Differential Revision: https://secure.phabricator.com/D12956
Summary:
Removes the deprecated method of configuring linters (via the `.arcconfig` file). There is one main caveat here:
- There is currently no convenient method by which to change the path for an external linter (T5057). This means that there is no direct replacement for the deprecated `lint.ruby.prefix` configuration. The workaround is to symlink these binaries into `arcanist/externals/bin`.
Test Plan: Wait a sufficient amount of time before landing this.
Reviewers: chad, epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: aik099, epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D10005
Summary: Add some linter rule to detect invalid modifiers for class methods/properties.
Test Plan: Added test cases.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12922
Summary: Ref T7977. The `ArcanistTestCase` class is pointless and can be replaced by `ArcanistPhutilTestCase`. Furthermore, it sorta makes sense to just rename `ArcanistPhutilTestCase` to `PhutilTestCase`. Depends on D12664 and D12666.
Test Plan: `arc unit`
Reviewers: avivey, #blessed_reviewers, epriestley
Reviewed By: avivey, #blessed_reviewers, epriestley
Subscribers: aurelijus, Korvin, epriestley
Maniphest Tasks: T7977
Differential Revision: https://secure.phabricator.com/D12665
Summary:
Ref T7977. The `PhutilTestCase::getLink` method currently relies on arcanist projects instead of repositories. Instead, make this logic a bit smarter by looking up the base URI from `phabricator.uri` (currently it is hardcoded to `https://secure.phabricator.com`).
Ideally, we would pass `?repositories=$REPOSITORY_PHID` to `DiffusionSymbolController` as well, but I don't know if this is worth pursuing.
Test Plan: This diff.
Reviewers: avivey, #blessed_reviewers, epriestley
Reviewed By: avivey, #blessed_reviewers, epriestley
Subscribers: aurelijus, Korvin, epriestley
Maniphest Tasks: T7977
Differential Revision: https://secure.phabricator.com/D12664
Summary: Improve the `ArcanistXHPASTLinter::LINT_ALIAS_FUNCTION` linter rule. Currently this rule does not correctly handle alias functions which are not strictly lowercase.
Test Plan: Added a test case.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12921
Summary: Fixes T7417. Adds `ArcanistXHPASTLinter::LINT_MODIFIER_ORDERING` for ensuring that method/property modifiers (`public`, `protected`, `private`, `static`, `abstract` and `final`) are consistently ordered. The modifier ordering that is enforced is consistent with [[http://www.php-fig.org/psr/psr-2 | PSR-2]].
Test Plan: Added unit tests.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: Korvin, epriestley
Maniphest Tasks: T7417
Differential Revision: https://secure.phabricator.com/D12421
Summary:
Improve the `ArcanistXHPASTLinter::LINT_ARRAY_SEPARATOR` rule to be able to autofix the following code:
```lang=php
array(
1,
2,
3, /* comment */ );
```
Test Plan: Added unit tests.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley
Differential Revision: https://secure.phabricator.com/D12308
Summary: Depends on D9430. If we are using the system installation of `pep8`, then it probably unnecessary (and possibly wrong) to specify `python2.6` as the default interpreter.
Test Plan: Ran `arc unit`.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: vrusinov, epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D9474
Summary: Currently, we bundle a specific version of `pep8` with Arcanist. Whilst maybe this made sense historically, as pointed out by @epriestley in D9412#6, there is no longer much point in doing so.
Test Plan: N/A
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: talshiri, vrusinov, Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D9430
Summary: This linter is a relic from Facebook days. As Harbormaster becomes more useful (T1049) this linter should become obsolete. Instead of modernising this linter to be compatible with modern infrastructure, it is easier to just let it die.
Test Plan: N/A
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D10533