1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 00:49:11 +02:00
Commit graph

2026 commits

Author SHA1 Message Date
Joshua Spence
581829a99e Write a linter rule for $this reassignment
Summary: Re-assigning `$this` is an invalid PHP construct, see https://3v4l.org/TauX9.

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14514
2015-11-20 06:50:27 +11:00
Joshua Spence
426d535b13 Fix PHP compatibility linter after improvements to parsing of use statements
Summary: Fix the `PHPCompatibilityXHPASTLinterRule` after changes to the way in which #xhpast parses `use` statements. Depends on D14518.

Test Plan: Unit tests

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14519
2015-11-20 06:50:08 +11:00
Joshua Spence
3ac313ad1e Write a linter rule for unexpected return values
Summary:
Although it is technically possible to return a value from a PHP constructor, it is rather odd and should be avoided. See some discussion on [[http://stackoverflow.com/q/11904255 | StackOverflow]]. Consider the following example:

```lang=php
class SomeClass {
  public function __construct() {
    return 'quack';
  }
}
```

This doesn't work:

```lang=php, counterexample
echo new SomeClas();
```

This, strangely, does work:

```lang=php
echo id(new SomeClass())->__construct();
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14516
2015-11-19 19:34:32 +11:00
Joshua Spence
149e7895fb Add a linter rule for nested namespaces
Summary: Namespace declarations cannot be nested, see https://3v4l.org/kRUNj.

Test Plan: Added unit tests

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14513
2015-11-19 19:31:45 +11:00
Joshua Spence
7386afc953 Add a linter rule for parent references
Summary:
Add a linter rule to detect static method calls which //should// reference the `parent` class instead of a hardcoded class reference. For example, consider the following:

```lang=php, counterexample
class SomeClass extends AnotherClass {
  public function someMethod() {
    AnotherClass::someOtherMethod();
  }
}
```

This should instead be written as:

```lang=php
class SomeClass extends AnotherClass {
  public function someMethod() {
    parent::someOtherMethod();
  }
}
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D14443
2015-11-19 08:58:03 +11:00
Joshua Spence
4d512c51d4 Test XHPAST linter rules in isolation
Summary:
Separate XHPAST linter rules in isolation from other rules and formalize the concept of a "linter rule". As the number of XHPAST linter rules grows (we currently have around 80), it becomes increasingly difficult to manage all of the test cases because `ArcanistXHPASTLinterTestCase` currently tests the entire linter (i.e. //all// linter rules) rather than testing individual rules in isolation. See D13534 for a situation in which this is painful. This is particularly bad for third party development because unit tests could break at any time depending on upstream changes.

Basically, in order to facilitate the unit testing of XHPAST linter rules in isolation, I have made the following  changes:

  # Added a `setRules()` method to `ArcanistXHPASTLinter`. Currently, `ArcanistXHPASTLinter` loads all `ArcanistXHPASTLinterRule` subclasses unconditionally. The `setRules()` method provides a way to override the configured linter rules.
  # Formalize the concept of a "linter rule". The `ArcanistXHPASTLinterRule` class was introduced in D10541. I feel that the modularization of `ArcanistXHPASTLinter` has made the linter much more maintainable and easily testable and I intend to extend this concept to other linters, such as `ArcanistTextLinter`.

Test Plan: Ran unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14010
2015-11-19 08:57:23 +11:00
Joshua Spence
e3e232530c Fix brace formatting linter rule after XHPAST changes
Summary: Adjusts `ArcanistBraceFormattingXHPASTLinterRule` after changes to the way in which XHPAST parses namespaces. Depends on D14498.

Test Plan: Unit tests are now passing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14499
2015-11-18 07:20:40 +11:00
Joshua Spence
a4dba24c46 Prevent double rendering of unit test results
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
2015-11-18 07:20:26 +11:00
Sébastien Santoro
b25cf080bc Fix ArcanistCSSLintLinter issue for messages without line number
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
2015-11-17 07:14:13 -08:00
Joshua Spence
66ab1c955d Remove arguments from unit test engines
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
2015-11-15 20:04:59 +00:00
Joshua Spence
9dd6eafb52 Fold ArcanistPhutilXHPASTLinter into ArcanistXHPASTLinter
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
2015-11-13 07:08:40 +11:00
Joshua Spence
dd0deb2407 Add XHAST linter standards
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
2015-11-13 07:07:52 +11:00
Joshua Spence
2db40f9953 Various translation improvements
Summary: Depends on D14070.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14072
2015-11-02 21:31:04 +11:00
Joshua Spence
d12bcdc683 Remove some unused methods from ArcanistLinter
Summary: These methods are unused.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14065
2015-11-02 21:23:01 +11:00
epriestley
baf5eb8a87 Explicitly provide "--ff" when performing squash merges in "arc land" under Git
Summary: Ref T3855. See discussion leading up to T3855#142304.

Test Plan: See T3855#142304.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T3855

Differential Revision: https://secure.phabricator.com/D14365
2015-10-28 17:13:15 -07:00
epriestley
c844669326 After pushing at the end of "arc land", cascade the origin through all local tracking branches
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
2015-10-28 14:01:35 -07:00
epriestley
2a2fd6e338 Pull git upstream-path logic into a separate class
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
2015-10-28 13:19:30 -07:00
epriestley
411a4f4a39 Fix a check when deciding to destroy the local branch after "arc land"
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
2015-10-28 10:10:41 -07:00
epriestley
aa5c023fe8 Make rules for guessing onto/remote more powerful and more explicit in arc land
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
2015-10-28 09:37:17 -07:00
epriestley
a03c6079bb Make "arc land" great again
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
2015-10-28 07:04:57 -07:00
Michael Krasnow
3308da5f8f Fix T9635 by initializing the property
Summary: Fix T9635 by properly initializing a property

Test Plan: run arc unit

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T9635

Differential Revision: https://secure.phabricator.com/D14340
2015-10-26 09:48:31 -07:00
epriestley
dfde57ff81 Improve two error handling behaviors in arc upgrade
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
2015-10-22 19:55:16 +00:00
Jon Parise
b3ea439f4d External linters can now specify a version requirement.
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
2015-10-21 09:46:20 -07:00
epriestley
e51e1c3d44 Allow Script-and-Regex linter to have optional/empty capturing patterns for char/line
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
2015-10-19 14:35:14 -07:00
Aviv Eyal
6c7def560d Remove ArcanistWorkflow::setWorkingCopy
Summary: Fixes T9583. setWorkingCopy doesn't actually work, so eliminate it.

Test Plan: arc unit --everything

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T9583

Differential Revision: https://secure.phabricator.com/D14293
2015-10-16 09:53:01 -07:00
epriestley
172c930630 Pass author config to git with "-c x=y" instead of "--author"
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
2015-10-04 08:49:20 -07:00
epriestley
6966be3e7e Allow an arc test to execute without a git author configured
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
2015-10-04 08:41:48 -07:00
Vihang Mehta
1b4a3e0c5e Set path on more linters
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
2015-10-02 08:58:15 -07:00
Vihang Mehta
f0c57986bc Fix ArcanistClosureLinter
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
2015-10-02 05:45:48 -07:00
epriestley
d3abb65572 Add a --target flag to arc unit for uploading results
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
2015-09-29 09:51:51 -07:00
epriestley
2df96ed405 Allow users to skip "arc:prompt" by entering no text
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
2015-09-29 07:09:19 -07:00
epriestley
e8a0ebaeff Improve validation of 'name' and 'code' parameters for lint messages
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
2015-09-25 11:16:04 -07:00
epriestley
9c056c5cc8 Improve arc's handling of dirty submodules in Git
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
2015-09-21 12:40:06 -07:00
epriestley
083127c4cc Fix an issue with "arc nrabch"
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
2015-09-15 11:14:07 -07:00
Burak Yigit Kaya
61fa644c4e Prevent caching of workflows
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
2015-09-15 05:24:01 -07:00
Aviv Eyal
501007f012 More linter's short description
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
2015-09-14 11:52:24 -07:00
Aviv Eyal
28b89785fe update linter short desc
Summary: ref T9353.

Test Plan: arc linters

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: joshuaspence, Korvin

Maniphest Tasks: T9353

Differential Revision: https://secure.phabricator.com/D14085
2015-09-08 14:52:43 -07:00
Aviv Eyal
bdab422440 arc linters: switch name and short
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
2015-09-08 10:39:26 -07:00
Aviv Eyal
8f3a002cdb Allow upgrading in branch stable
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
2015-09-07 13:44:48 -07:00
epriestley
55d9cc7013 Improve temporary file upload API and add viewPolicy support
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
2015-09-07 12:44:59 -07:00
epriestley
9896908685 Add temporary file support to ArcanistFileUploader
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
2015-09-04 10:34:14 -07:00
Alex Vandiver
7e677c27ec Fix callsites which called libphutil_console_wrap like it were _format
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
2015-09-03 12:01:01 -07:00
cburroughs
029e5a7c29 staging repo compatibility for older git versions
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
2015-09-02 06:58:42 -07:00
Joshua Spence
9419cccdd2 Delete another problematic XML test file
Summary: Ref T7215. This test is occasionally failing for me locally. Remove it as per D13992.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T7215

Differential Revision: https://secure.phabricator.com/D14027
2015-09-02 18:34:55 +10:00
Mike Riley
de7a999ce9 Remove errant in arcanist.php
Summary: This causes `49` to be printed out preceding the start of my next terminal line every time there is an exception thrown.

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

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D14030
2015-09-01 08:46:17 -07:00
Joshua Spence
6fa2de5ff8 Add a linter rule for detecting empty files
Summary: Adds two different linter rules (one general purpose and another PHP specific) to prevent empty files from being added to a repository. For some unknown reason, people seem to like to do this.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: avivey, cburroughs, Korvin

Differential Revision: https://secure.phabricator.com/D13881
2015-09-01 19:30:55 +10:00
Joshua Spence
a5304e472d Add a linter rule for newlines after PHP open tags
Summary: `<?php\n\n...` is much easier to read than `<?php\n...`. Depends on D13889 and D13890.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13534
2015-08-31 06:49:29 +10:00
Joshua Spence
10f9c460fa Remove leftover code for "postponed" lint and unit status
Summary: Ref T9134. It looks like this functionality was removed in D13848. Depends on D13869.

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

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9134

Differential Revision: https://secure.phabricator.com/D13868
2015-08-30 21:56:12 +10:00
Aviv Eyal
1ed98937c4 arc linters: Filter by name, make display one-line
Summary: allow searching/filtering linters displayed by name.

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

Reviewers: joshuaspence, #blessed_reviewers, epriestley

Reviewed By: joshuaspence, #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10706
2015-08-29 05:10:03 -07:00
Joshua Spence
18e32d6ec7 Fix linter rule after XHPAST change
Summary: Depends on D13959.

Test Plan: Ran unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13961
2015-08-27 22:08:49 +10:00