]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
11 years agoDon't try to call library functions during arc sanity checking
epriestley [Tue, 6 Jan 2015 17:53:11 +0000 (09:53 -0800)]
Don't try to call library functions during arc sanity checking

Summary: These functions won't exist yet. See https://github.com/phacility/arcanist/commit/7e2df9a5bfc635b77c6412ef5a6569edd0e4e138#commitcomment-9172274

Test Plan: Faked a fatal, ran `arc`, got message.

Reviewers: joshuaspence, chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

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

11 years agoRemove the noconfig flag
jjoos [Tue, 6 Jan 2015 14:59:36 +0000 (06:59 -0800)]
Remove the noconfig flag

Summary:
D11196 introduced a regression that made it impossible for coffeelint to read any configuration. I'm reverting the change in that diff.

Created a pull request changing the documentation of coffeelint to make sure I'm interpreting this flag correctly: https://github.com/clutchski/coffeelint/pull/364

Test Plan:
- patch
- npm install -g coffeelint

- create a `test.coffee` file with:
```
# 1234567890
```
- `arc lint test.coffee`
```
 OKAY  No lint warnings.
```
- create a `coffeelint.json` with
```
{
  "max_line_length": {
    "value": 10
  }
}
```
- `arc lint test.coffee`, expected output:
```
>>> Lint for test.coffee:

   Error  (COFFEE)
    Line exceeds maximum allowed length.

    >>>        1 # 1234567890
```
- create a `.arclint` with
```
{
  "linters": {
    "coffeelint": {
      "type": "coffeelint",
      "coffeelint.config": "coffee_lint_config_with_different_name.json"
    }
  }
}
```
- rename `coffeelint.json` to `coffee_lint_config_with_different_name.json`
- `arc lint test.coffee`, expected output:
```
>>> Lint for test.coffee:

   Error  (COFFEE)
    Line exceeds maximum allowed length.

    >>>        1 # 1234567890
```

Reviewers: Korvin, joshuaspence, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years ago`pht`ize some strings
Joshua Spence [Tue, 6 Jan 2015 12:14:04 +0000 (23:14 +1100)]
`pht`ize some strings

Summary: Self-explanatory.

Test Plan: Eye-balled it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoCreate a custom exception class for missing linter dependencies
Joshua Spence [Tue, 6 Jan 2015 11:45:44 +0000 (22:45 +1100)]
Create a custom exception class for missing linter dependencies

Summary: I feel that we are abusing `ArcanistUsageException`. Throw a more tailed exception instead. Depends on D11197.

Test Plan: `arc lint`, I guess.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: avivey, Korvin, epriestley

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

11 years ago`pht`ize some strings
Joshua Spence [Tue, 6 Jan 2015 11:43:52 +0000 (22:43 +1100)]
`pht`ize some strings

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoAdd a linter rule to detect the use of blacklisted functions
Joshua Spence [Sun, 4 Jan 2015 23:51:33 +0000 (10:51 +1100)]
Add a linter rule to detect the use of blacklisted functions

Summary:
As mentioned in the [[https://secure.phabricator.com/book/phabcontrib/article/php_coding_standards/ | Phabricator PHP coding standards]], the `eval` function should be avoided. There is some good discussion on [[http://stackoverflow.com/questions/951373/when-is-eval-evil-in-php | StackOverflow]] as well.

Having said that, instead of hardcoding `eval()`, I have generalised this enough to allow a set of "blacklisted" functions to be defined with `xhpast.blacklisted.function` in the `.arclint` file.

Test Plan: Added a test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoVarious improvements for `ArcanistClosureLinter`
Joshua Spence [Sun, 4 Jan 2015 20:43:55 +0000 (07:43 +1100)]
Various improvements for `ArcanistClosureLinter`

Summary: WIP

Test Plan: WIP

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

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

11 years agoExport namespace in `ArcanistUnitTestResult` dictionary
Joshua Spence [Sun, 4 Jan 2015 19:48:32 +0000 (06:48 +1100)]
Export namespace in `ArcanistUnitTestResult` dictionary

Summary: D7952 added namespaces to `ArcanistUnitTestResult` but these are not exported and thus don't get sent from client to server.

Test Plan: Uploaded a diff and inspected the contents of the `phabricator_differential.differential_diffproperty` table.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoUse `PhutilMethodNotImplementedException` in `ArcanistExternalLinter`
Joshua Spence [Sun, 4 Jan 2015 19:47:12 +0000 (06:47 +1100)]
Use `PhutilMethodNotImplementedException` in `ArcanistExternalLinter`

Summary: Self-explanatory.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoRename `PHPUnitTestEngineTestCase` for consistency
Joshua Spence [Sun, 4 Jan 2015 19:46:24 +0000 (06:46 +1100)]
Rename `PHPUnitTestEngineTestCase` for consistency

Summary: Ref T5655. `PHPUnitTestEngineTestCase` is the test case for `PhpunitTestEngine`.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T5655

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

11 years agoMove `ArcanistTestResultParser` subclasses
Joshua Spence [Sun, 4 Jan 2015 19:46:13 +0000 (06:46 +1100)]
Move `ArcanistTestResultParser` subclasses

Summary: Move `ArcanistTestResultParser` subclasses from `src/unit/engine` to `src/unit/parser`. Depends on D11201.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

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

11 years agoRename `ArcanistTestResultParser` subclasses for consistency
Joshua Spence [Sun, 4 Jan 2015 19:45:14 +0000 (06:45 +1100)]
Rename `ArcanistTestResultParser` subclasses for consistency

Summary: Ref T5655.

Test Plan: `grep`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T5655

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

11 years agoRename `UnitTestableArcanistLintEngine` for consistency
Joshua Spence [Sun, 4 Jan 2015 19:44:49 +0000 (06:44 +1100)]
Rename `UnitTestableArcanistLintEngine` for consistency

Summary: Ref T5655.

Test Plan: `grep`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T5655

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

11 years agoMinor tidying of `ArcanistCoffeeLintLinter`
Joshua Spence [Sun, 4 Jan 2015 19:44:33 +0000 (06:44 +1100)]
Minor tidying of `ArcanistCoffeeLintLinter`

Summary: Self-explanatory.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoDon't pass `--quiet` to `coffeelint`
Joshua Spence [Sun, 4 Jan 2015 19:43:44 +0000 (06:43 +1100)]
Don't pass `--quiet` to `coffeelint`

Summary: This flag doesn't do anything when combined with `--reporter=checkstyle`.

Test Plan:
```
> coffeelint *.coffee
  ✗ fail.coffee
     ✗ #1: Class names should be camel cased. class name: boaConstrictor.
  ✓ pass.coffee

✗ Lint! » 1 error and 0 warnings in 2 files

> coffeelint --quiet *.coffee
  ✗ fail.coffee
     ✗ #1: Class names should be camel cased. class name: boaConstrictor.

✗ Lint! » 1 error and 0 warnings in 2 files

> coffeelint --reporter=checkstyle *.coffee
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="fail.coffee">
<error line="1"
    severity="error"
    message="Class names should be camel cased; context: class name: boaConstrictor"
    source="coffeelint"/>
</file>
</checkstyle>

> coffeelint --reporter=checkstyle --quiet *.coffee
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="fail.coffee">
<error line="1"
    severity="error"
    message="Class names should be camel cased; context: class name: boaConstrictor"
    source="coffeelint"/>
</file>
</checkstyle>
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoCreate an `ArcanistExternalLinterTestCase` class
Joshua Spence [Sun, 4 Jan 2015 19:41:59 +0000 (06:41 +1100)]
Create an `ArcanistExternalLinterTestCase` class

Summary: Creates a new base class for unit testing `ArcanistExternalLinter` subclasses. Specifically, add a test case for verifying that we are correctly parsing the output of `$external_linter --version`.

Test Plan: `arc unit`

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoIgnore environment variables for `coffeelint`
Joshua Spence [Sun, 4 Jan 2015 19:40:07 +0000 (06:40 +1100)]
Ignore environment variables for `coffeelint`

Summary: According to `coffeelint --help`, `--noconfig` ignores the environment variable `COFFEELINT_CONFIG`. This means that `arc lint` will behave more consistently across developer workstations by forcing configuration to be specified with `coffeelint.config` instead of with environment variables.

Test Plan: This is mostly theoretical.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoUpdate flags for `coffeelint`
Joshua Spence [Sun, 4 Jan 2015 19:39:50 +0000 (06:39 +1100)]
Update flags for `coffeelint`

Summary: According to `coffeelint --help` (with an up-to-date version of `coffeelint`, version 1.8.1) , `--nocolor` is deprecated in favor of `--color=never`. According to the [[http://www.coffeelint.org/#changelog | changelog]], `--nocolor` was deprecated in v1.6.0.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoReduce boilerplate code in `ArcanistLinterTestCase` subclasses
Joshua Spence [Sun, 4 Jan 2015 07:38:32 +0000 (18:38 +1100)]
Reduce boilerplate code in `ArcanistLinterTestCase` subclasses

Summary: This is a bit magical and is maybe a terrible idea, but it seems okayish.

Test Plan: `arc unit`

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoRaise a linter error when removed symbols are used
Joshua Spence [Sun, 4 Jan 2015 07:38:07 +0000 (18:38 +1100)]
Raise a linter error when removed symbols are used

Summary: Ref T5141. Utilize the `'max'` key from the `php_compat_info.json` compatibility map to lint for the use of classes/functions/symbols which have been removed from the target PHP version.

Test Plan: Added a test case for `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5141

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

11 years agoAdd a linter rule to detect duplicate `case` statements
Joshua Spence [Sun, 4 Jan 2015 05:49:57 +0000 (16:49 +1100)]
Add a linter rule to detect duplicate `case` statements

Summary: Fixes T6843. Adds a linter rule to `ArcanistXHPASTLinter` to detect duplicate `case` statements within a `switch` statement.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T6843

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

11 years agoMove `LINT_NO_COMMIT` from `ArcanistTextLinter` to a new linter
Joshua Spence [Sun, 4 Jan 2015 05:20:31 +0000 (16:20 +1100)]
Move `LINT_NO_COMMIT` from `ArcanistTextLinter` to a new linter

Summary: I don't feel that this linter rule belongs in the `ArcanistTextLinter`. In fact, this linter rule is quite similar to the rules provided by `ArcanistGeneratedLinter` and `ArcanistNoLintLinter` and these classes could possibly be consolidated. I have moved this linter rule to a standalone `ArcanistCommitLinter` class (which could possibly do additional lints in the future).

Test Plan: Moved existing test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

11 years ago`pht`ize some strings
Joshua Spence [Sat, 3 Jan 2015 12:53:07 +0000 (23:53 +1100)]
`pht`ize some strings

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoSpecify the `config` property of `lint-test` files as a `map`
Joshua Spence [Sat, 3 Jan 2015 12:52:56 +0000 (23:52 +1100)]
Specify the `config` property of `lint-test` files as a `map`

Summary: Self-explanatory. This is implied anyway as we iterate over it with a `foreach` loop.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoRemove `arcconfig` settings from `ArcanistLinterTestCase`
Joshua Spence [Sat, 3 Jan 2015 12:52:45 +0000 (23:52 +1100)]
Remove `arcconfig` settings from `ArcanistLinterTestCase`

Summary: This doesn't make too much sense anymore as all modern linters are configured via the `.arclint` file rather than `.arcconfig`.

Test Plan: `grep`ped to make sure this option isn't used.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoFix variable name
Joshua Spence [Fri, 2 Jan 2015 23:30:15 +0000 (10:30 +1100)]
Fix variable name

Summary: Fix a variable name to be consistent with naming conventions.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

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

11 years agoRemove some unused classes
Joshua Spence [Fri, 2 Jan 2015 22:06:16 +0000 (09:06 +1100)]
Remove some unused classes

Summary: Self-explanatory.

Test Plan: `grep`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoSuppress stdin message if input is piped
Joshua Spence [Fri, 2 Jan 2015 00:36:24 +0000 (11:36 +1100)]
Suppress stdin message if input is piped

Summary: Currently we output "Waiting for JSON parameters on stdin...", even if `stdin` is piped (for example, from `echo`).

Test Plan:
```lang=bash
> echo '{}' | arc call-conduit conduit.ping
{"error":null,"errorMessage":null,"response":"ip-10-161-81-110"}

> arc call-conduit conduit.ping
Waiting for JSON parameters on stdin...
{}
^D
{"error":null,"errorMessage":null,"response":"ip-10-161-81-110"}
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

11 years agoRemove some old code handling the absence of the `file.uploadhash` Conduit method
Joshua Spence [Thu, 1 Jan 2015 23:10:10 +0000 (10:10 +1100)]
Remove some old code handling the absence of the `file.uploadhash` Conduit method

Summary: The `file.uploadhash` method was added a long time ago (in D4899). It should be safe to assume that this method exists on most installs.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

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

11 years agoRemove the `inlines` workflow
Joshua Spence [Tue, 30 Dec 2014 23:45:41 +0000 (10:45 +1100)]
Remove the `inlines` workflow

Summary: Ref T5112. The `arc inlines` workflow no longer works because the `differential.getrevisioncomments` API method has been deprecated (see T2222). The command is basically useless right now.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5112

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

11 years agoFix two linter issues
epriestley [Tue, 30 Dec 2014 18:02:43 +0000 (10:02 -0800)]
Fix two linter issues

Summary:
  - The "exclude static variable access" branch in XHPAST incorrectly excluded all variables in a function or method which used any static access (we were selecting the wrong root node for exclusion).
  - The "PHPLinter" regexp did not work with 5.4.30. Make it more permissive in what it parses.

Test Plan:
  - Added a failing unit test for the variable case and made it pass.
  - PHPLinter tests now pass under 5.4.30

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

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

11 years agoUse `new FutureIterator` instead of `Futures`
Joshua Spence [Tue, 30 Dec 2014 12:14:32 +0000 (23:14 +1100)]
Use `new FutureIterator` instead of `Futures`

Summary: Ref T6829. Deprecate the `Futures()` function.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T6829

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

11 years agoFix `puppet-lint` unit tests for the v1.1.0
Joshua Spence [Tue, 30 Dec 2014 10:46:57 +0000 (02:46 -0800)]
Fix `puppet-lint` unit tests for the v1.1.0

Summary: This unit test is failing locally for me, using v1.1.0 of `puppet-lint`.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

11 years agoAdd some more spelling corrections to Spelling linter
epriestley [Tue, 23 Dec 2014 00:08:02 +0000 (16:08 -0800)]
Add some more spelling corrections to Spelling linter

Summary: Fixes T6773. See also the shameful `PhabricatorDestructableInterface` debacle.

Test Plan: go go dictionary power

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T6773

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

11 years agoSupport simpler, token-based Conduit authentication in Arcanist
epriestley [Mon, 15 Dec 2014 19:12:38 +0000 (11:12 -0800)]
Support simpler, token-based Conduit authentication in Arcanist

Summary:
Ref T5955. If the server supports token-based authentication, prefer it over certificate-based authentication.

Also fixes T3117.

Test Plan:
  - Used `arc install-certificate` to install credentials from both token-based and certificate-based hosts.
  - Used `arc list` with a token-based host.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3117, T2878, T5955

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

11 years agoMinor linter fixes
Joshua Spence [Mon, 8 Dec 2014 12:46:55 +0000 (23:46 +1100)]
Minor linter fixes

Summary: Self explanatory/

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

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

11 years agoExtend `LINT_BRACE_FORMATTING` to support more scenarios
Joshua Spence [Mon, 8 Dec 2014 12:31:21 +0000 (23:31 +1100)]
Extend `LINT_BRACE_FORMATTING` to support more scenarios

Summary: Extend the `ArcanistXHPASTLinter::LINT_BRACE_FORMATTING` rule to support a bunch of extra cases.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

11 years agoExtend `LINT_BRACE_FORMATTING` to warn on missing braces
Joshua Spence [Mon, 8 Dec 2014 12:30:32 +0000 (23:30 +1100)]
Extend `LINT_BRACE_FORMATTING` to warn on missing braces

Summary: Extend the `ArcanistXHPASTLinter::LINT_BRACE_FORMATTING` rule to raise a warning when `n_STATEMENT` is used without having `n_STATEMENT_LIST` as a parent. Essentially, this means that `if ($x) { do_y(); }` is preferred over `if ($x) do_y();`.

Test Plan: Added some test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoUpdate lint engine documentation
epriestley [Mon, 24 Nov 2014 23:01:19 +0000 (15:01 -0800)]
Update lint engine documentation

Summary: Fixes T6627. This class documentation is out of date and somewhat misleading in the modern environment.

Test Plan: Read it.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T6627

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

12 years agoReport tests results whenever possible
David Cramer [Mon, 17 Nov 2014 23:25:48 +0000 (15:25 -0800)]
Report tests results whenever possible

Summary: This adjusts the behavior of PytestTestEngine so that it correctly reports test failures natively, rather than throwing a command error.

Test Plan: Yeah right

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

12 years agoRemove gist link that (never?) doesn't work
Chad Little [Mon, 13 Oct 2014 17:48:18 +0000 (10:48 -0700)]
Remove gist link that (never?) doesn't work

Summary: Removing 404 link, fixes https://github.com/phacility/arcanist/issues/180

Test Plan: n/a

Reviewers: epriestley, avivey

Reviewed By: epriestley, avivey

Subscribers: Korvin, epriestley

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

12 years agoFix `LINT_KEYWORD_CASING` for `class` keyword
Joshua Spence [Tue, 7 Oct 2014 22:26:36 +0000 (09:26 +1100)]
Fix `LINT_KEYWORD_CASING` for `class` keyword

Summary: D10653 didn't quite cut it.

Test Plan: Tested on a real file.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

12 years agoExtend `ArcanistXHPASTLinter::LINT_KEYWORD_CASING`
Joshua Spence [Tue, 7 Oct 2014 21:43:58 +0000 (08:43 +1100)]
Extend `ArcanistXHPASTLinter::LINT_KEYWORD_CASING`

Summary: Extend `ArcanistXHPASTLinter::LINT_KEYWORD_CASING` to include the `class` keyword.

Test Plan: I can't really added a test case for this without getting "XHP19 Class-Filename Mismatch".

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

12 years agoMark some methods in `ArcanistLinter` as final
Joshua Spence [Tue, 7 Oct 2014 13:07:39 +0000 (00:07 +1100)]
Mark some methods in `ArcanistLinter` as final

Summary: Minor change, self-explanatory... this seems to make sense.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd a `LINT_CONSTRUCTOR_PARENTHESES` rule to `ArcanistXHPASTLinter`
Joshua Spence [Tue, 7 Oct 2014 12:59:03 +0000 (23:59 +1100)]
Add a `LINT_CONSTRUCTOR_PARENTHESES` rule to `ArcanistXHPASTLinter`

Summary: Adds an `ArcanistXHPASTLinter::LINT_CONSTRUCTOR_PARENTHESES` rule which ensures that (possibly empty) parentheses are used when calling a constructor.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoMinor linter fixes
Joshua Spence [Sat, 27 Sep 2014 00:21:23 +0000 (10:21 +1000)]
Minor linter fixes

Summary: Apply some linter autofixes.

Test Plan: `arc lint` and `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoAdd a linter rule to detect variable arguments for `break` and `continue`
Joshua Spence [Thu, 25 Sep 2014 22:36:29 +0000 (08:36 +1000)]
Add a linter rule to detect variable arguments for `break` and `continue`

Summary: In PHP 5.4, the `break` and `continue` statements no longer accept variable arguments (e.g., `break 1 + foo() * $bar;`). Static arguments still work, such as break 2;. As a side effect of this change `break 0;` and `continue 0;` are no longer allowed.

Test Plan: Added some test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix `LINT_ARRAY_SEPARATOR` for heredocs
Joshua Spence [Thu, 25 Sep 2014 22:35:40 +0000 (08:35 +1000)]
Fix `LINT_ARRAY_SEPARATOR` for heredocs

Summary: It is not correct to add a trailing comma if the `n_ARRAY_VALUE` node is a heredoc string.

Test Plan: Added a test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix `LINT_ARRAY_SEPARATOR` for nested arrays
Joshua Spence [Thu, 25 Sep 2014 21:06:19 +0000 (07:06 +1000)]
Fix `LINT_ARRAY_SEPARATOR` for nested arrays

Summary: The `LINT_ARRAY_SEPARATOR` rule was added to `ArcanistXHPASTLinter` in D10535. Unfortunately, it does not correctly handle nested arrays correctly. This patch fixes this. Depends on D10554.

Test Plan: Added a test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix incorrect linter code being raised
Joshua Spence [Thu, 25 Sep 2014 02:58:37 +0000 (12:58 +1000)]
Fix incorrect linter code being raised

Summary: `ArcanistXHPASTLinter::lintSpaceAroundConcatenationOperators` should raise `LINT_CONCATENATION_OPERATOR`, not `LINT_BINARY_EXPRESSION_SPACING`.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd a linter rule for array separators
Joshua Spence [Wed, 24 Sep 2014 21:38:37 +0000 (07:38 +1000)]
Add a linter rule for array separators

Summary:
Adds a rule to `ArcanistXHPASTLinter` which ensures that:

# Single-lined arrays //do not// contain an unnecessary trailing comma separator after the final array value.
# Multi-lined arrays //do// contain a trailing comma seperator after the final value value.

Depends on D10534.

Test Plan: Wrote and executed unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoFix a fatal error in `ArcanistXHPASTLinter`
Joshua Spence [Wed, 24 Sep 2014 21:33:24 +0000 (07:33 +1000)]
Fix a fatal error in `ArcanistXHPASTLinter`

Summary: I had assumed that we would always be interested in `n_STATEMENT_LIST`, which is fine for `if (...) { some_statements(); }` but not for `if (...) one_statement();`.

Test Plan: Added a test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoImprove `LINT_DOS_NEWLINE` behavior
Joshua Spence [Wed, 24 Sep 2014 21:13:10 +0000 (07:13 +1000)]
Improve `LINT_DOS_NEWLINE` behavior

Summary: Improve the behavior of `ArcanistTextLinter` in dealing with `LINT_DOS_NEWLINE`. In particular, provide replacement text so that these linter issues can be autofixed.

Test Plan: Added a unit test.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years ago`pht`ize some strings
Joshua Spence [Wed, 24 Sep 2014 21:09:07 +0000 (07:09 +1000)]
`pht`ize some strings

Summary: Self explanatory.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoExplicitly enumerate PHP magic methods
Joshua Spence [Mon, 22 Sep 2014 22:02:19 +0000 (08:02 +1000)]
Explicitly enumerate PHP magic methods

Summary: Explicitly list PHP magic methods (methods beginning with `__`) instead of assuming that //all// methods beginning with `__` are okay in terms of naming conventions. These magic methods were obtained from http://us1.php.net/manual/en/language.oop5.magic.php.

Test Plan:
```
   Warning  (XHP9) Naming Conventions
    Follow naming conventions: methods should be named using lowerCamelCase.

               1 <?php
               2
               3 class Foo {
    >>>        4     function __foo() {}
               5
               6     function _bar() {}
               7 }

   Warning  (XHP9) Naming Conventions
    Follow naming conventions: methods should be named using lowerCamelCase.

               3 class Foo {
               4     function __foo() {}
               5
    >>>        6     function _bar() {}
               7 }
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoMinor reordering of functions
Joshua Spence [Mon, 22 Sep 2014 08:42:41 +0000 (18:42 +1000)]
Minor reordering of functions

Summary: This seems somewhat neater to me, YMMV.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix failing unit test
Joshua Spence [Thu, 11 Sep 2014 22:14:47 +0000 (08:14 +1000)]
Fix failing unit test

I goofed this up... I think my editor trimmed the trailing whitespace for me.

Auditors: epriestley

12 years agoAdd a bunch of additional test cases for `ArcanistTextLinter`
Joshua Spence [Thu, 11 Sep 2014 13:43:38 +0000 (23:43 +1000)]
Add a bunch of additional test cases for `ArcanistTextLinter`

Summary: Self-explanatory, improve test coverage.

Test Plan: Wrote and executed unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoFix custom severity rules not being applied
Joshua Spence [Thu, 11 Sep 2014 13:39:12 +0000 (23:39 +1000)]
Fix custom severity rules not being applied

Summary: It seems that `severity.rules` does not override the default linter severities set by the `ArcanistLinter` itself. This seems incorrect and counter-intuitive.

Test Plan: Created a `"severity.rules": { "(.*)": "disabled" }"` configuration and verified that it was being applied.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoRemove a useless function from `ArcanistMergeConflictLinter`
Joshua Spence [Thu, 11 Sep 2014 13:39:01 +0000 (23:39 +1000)]
Remove a useless function from `ArcanistMergeConflictLinter`

Summary: This function doesn't achieve anything.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix a typo
Joshua Spence [Thu, 11 Sep 2014 13:37:36 +0000 (23:37 +1000)]
Fix a typo

Summary: Minor styling fix.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix PHP version check for function calls with static/variable functions
epriestley [Wed, 10 Sep 2014 21:01:34 +0000 (14:01 -0700)]
Fix PHP version check for function calls with static/variable functions

Summary: D10132 improved this check by eliminating some false postives, but assumes an `n_FUNCTION_CALL` always starts with `n_SYMBOL_NAME`. This is true for `f()`, but not true for `C::m()` or `$v()`.

Test Plan: Added and ran unit tests.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

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

12 years agoAllow classes/functions from a later version if they are used conditionally
Joshua Spence [Wed, 10 Sep 2014 14:19:38 +0000 (00:19 +1000)]
Allow classes/functions from a later version if they are used conditionally

Summary:
Fixes T5299. Currently, linting `src/future/http/HTTPSFuture.php` from rPHU will raise the following error:

```
   Error  (XHP31) Use Of PHP 5.3 Features
    This codebase targets PHP 5.2.3, but `curlfile` was not introduced until
    PHP 5.5.0.

             532       // use this "@" stuff.
             533
             534       if (class_exists('CURLFile')) {
    >>>      535         $file_value = new CURLFile((string)$tmp, $info['mime'], $info['name']);
             536       } else {
             537         $file_value = '@'.(string)$tmp;
             538       }
```

However, since this class is being used conditionally, it //should// be fine and no linter errors should be being raised.

Test Plan: Added a test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5299

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

12 years agoFix a typo
Joshua Spence [Wed, 10 Sep 2014 13:37:54 +0000 (23:37 +1000)]
Fix a typo

Summary: Self-explanatory.

Test Plan: Eyeball it

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoFix linting for spacing around default parameter assignment in function/method declar...
Joshua Spence [Wed, 10 Sep 2014 12:30:01 +0000 (22:30 +1000)]
Fix linting for spacing around default parameter assignment in function/method declaration

Summary: Fix linting for spacing around default parameter assignment in function/method declaration so that `function foo($x = null) {}` is preferred in favor of `function foo($x=null) {}`.

Test Plan: Modified existing unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoApply some autofix linter rules
Joshua Spence [Tue, 9 Sep 2014 20:33:31 +0000 (06:33 +1000)]
Apply some autofix linter rules

Summary: Self-explanatory

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd an XHPAST lint rule for empty block statements
Joshua Spence [Tue, 9 Sep 2014 12:48:45 +0000 (22:48 +1000)]
Add an XHPAST lint rule for empty block statements

Summary: Adds an XHPAST linter rule for empty block statements. Basically, if a block statement is empty then it is much neater if the opening (`{`) and closing (`}`) braces are adjacent. Maybe this is just my own personal preference, in which case we could reduce the default severity to `ArcanistLintSeverity::SEVERITY_DISABLED`.

Test Plan: Wrote unit tests. I had to modify a bunch of existing unit tests accordingly.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoAdd some missing function parameter typehints
Joshua Spence [Mon, 8 Sep 2014 22:27:09 +0000 (08:27 +1000)]
Add some missing function parameter typehints

Summary: Add some missing function parameter typehints to the `ArcanistPhutilXHPASTLinter` class.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoMake some strings in `ArcanistPhutilXHPASTLinter` translatable
Joshua Spence [Mon, 8 Sep 2014 22:24:54 +0000 (08:24 +1000)]
Make some strings in `ArcanistPhutilXHPASTLinter` translatable

Summary: `pht`ize some string in `ArcanistPhutilXHPASTLinter` so that they are translatable.

Test Plan: Not 100% sure that I am doing it right...

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agorestored --head support
Tal Shiri [Mon, 8 Sep 2014 21:02:25 +0000 (14:02 -0700)]
restored --head support

Summary: the call to setHeadCommit() was accidentally placed in a `if ($background) {}` block, which was removed in 54bea94. This adds the removed call.

Test Plan: used --head, worked as expected

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoPass conduit credentials down to children workflow
Vihang Mehta [Mon, 8 Sep 2014 14:42:45 +0000 (07:42 -0700)]
Pass conduit credentials down to children workflow

Summary:
Calling `arc patch` on a diff that's dependent on a different diff tries to patch the parent first.
To patch the parent a child workflow is created, and a conduit is passed down, but the credentials are not and it is not marked as authenticated.

Then when the child tries to get the commit message for the dependency, it checks isConduitAuthenticated() https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/ArcanistPatchWorkflow.php;2c3268f03ed70d3221eb1642bIc99ebb39b12902e$800 and on failure pops up an interactive editor for the commit message.

Instead we just pass down the credentials to the childred and mark them as authenticated, so this is not a problem.

Test Plan: With two diffs where DA2 depends on DA1, run `arc patch --force --nobranch DA2` ... this no longer pops an interactive editor for the commit message for the dependency.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, seshness, epriestley, Korvin

Maniphest Tasks: T5986

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

12 years agophutil_utf8_shorten => PhutilUTF8StringTruncator
Bob Trahan [Fri, 29 Aug 2014 22:15:18 +0000 (15:15 -0700)]
phutil_utf8_shorten => PhutilUTF8StringTruncator

Summary: Ref T3307. Very easy

Test Plan: this very diff!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T3307

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

12 years agoUpdate `puppet-lint` linter
Joshua Spence [Fri, 29 Aug 2014 14:37:01 +0000 (00:37 +1000)]
Update `puppet-lint` linter

Summary: Update the `puppet-lint` linter to support the latest version (v1.0.1). This version allows a custom configuration file to be passed via `--config`, which brings this linter into line with other linters.

Test Plan: Update test cases to pass.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agofix typo in exception handling
Aviv Eyal [Thu, 28 Aug 2014 17:32:57 +0000 (10:32 -0700)]
fix typo in exception handling

Test Plan: brake .arcrc, see reasonable error.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

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

12 years agoAdding php -l linter
Michael Peters [Thu, 28 Aug 2014 00:29:31 +0000 (17:29 -0700)]
Adding php -l linter

Summary: Adds a linter that checks php files for syntax errors using php -l

Test Plan:
Add a section to your .arclint file similar to:
```
"php": {
  "type": "php",
  "include": "(\\.php$)"
}
```

Then run arc lint on a php file with a syntax error.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, jacobwalker0814, Korvin

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

12 years agoDon't run "flake8" via stdin
epriestley [Tue, 26 Aug 2014 21:36:17 +0000 (14:36 -0700)]
Don't run "flake8" via stdin

Summary: flake8 v2.2.3 (released Aug 25) broke this. Just drop the stdin stuff.

Test Plan: User confirmed in IRC that this resolves the issue.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

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

12 years agoAdjust py.test invocation per T5973
epriestley [Tue, 26 Aug 2014 21:36:10 +0000 (14:36 -0700)]
Adjust py.test invocation per T5973

Summary: Fixes T5973

Test Plan: how does computer

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5973

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

12 years agoAllow lines to be specified as comma delimited number ranges for arc browse
Vihang Mehta [Tue, 26 Aug 2014 16:02:34 +0000 (09:02 -0700)]
Allow lines to be specified as comma delimited number ranges for arc browse

Summary: Ref T5971. We lose validation of the line ranges, but I don't think that's a huge issue.

Test Plan: Ran `arc browse README`, `arc browse README:3`, and `arc browse README:3,6-7`

Reviewers: btrahan, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5971

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

12 years agoFix `arc browse path:line`
epriestley [Mon, 25 Aug 2014 19:45:49 +0000 (12:45 -0700)]
Fix `arc browse path:line`

Summary: Ref T5781. This was broken in some earlier changes in T5781.

Test Plan: Ran `arc browse README`, `arc browse README:10`.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5781

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

12 years agoImprove "arc land" error message to mention SVN alternatives
epriestley [Mon, 25 Aug 2014 02:29:40 +0000 (19:29 -0700)]
Improve "arc land" error message to mention SVN alternatives

Summary: Fixes T3813. This error message isn't very helpful in SVN; be more helpful.

Test Plan: Ran `arc land` in a Subversion repository, got a reasonable error message.

Reviewers: btrahan, asherkin

Reviewed By: asherkin

Subscribers: aran

Maniphest Tasks: T3813

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

12 years agoArcanist - potentially fix some Windows badness
Bob Trahan [Thu, 21 Aug 2014 23:07:00 +0000 (16:07 -0700)]
Arcanist - potentially fix some Windows badness

Summary: Fixes T5914, maybs.

Test Plan: will ask users in T5914

Reviewers: chad, epriestley

Reviewed By: chad, epriestley

Subscribers: chad, bluehawk, epriestley, Korvin

Maniphest Tasks: T5914

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

12 years agoSchedule repository updates from `arc commit`, not just `arc land`
epriestley [Thu, 21 Aug 2014 18:25:27 +0000 (11:25 -0700)]
Schedule repository updates from `arc commit`, not just `arc land`

Summary: Ref T5926. We only pass Phabricator an update hint from `arc land`, not from `arc commit`.

Test Plan:
  - Ran `arc land` and `arc commit` with `--trace`, saw hints go over the wire.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5926

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

12 years agoDon't parse separator tabs as part of the filename in Git diffs which affect files...
epriestley [Thu, 14 Aug 2014 19:13:02 +0000 (12:13 -0700)]
Don't parse separator tabs as part of the filename in Git diffs which affect files with spaces

Summary:
Fixes T5870. When a filename contains spaces, Git will add a "\t" at the end of the "---" and "+++" lines. We currently consume this and think we're reading a file called "blah blah\t".

Instead, parse it out as not part of the filename.

Test Plan: Added failing unit test and made it pass.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5870

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

12 years ago[lint] Add HLint-based Haskell linter
Austin Seipp [Wed, 13 Aug 2014 02:49:02 +0000 (19:49 -0700)]
[lint] Add HLint-based Haskell linter

Summary:
This adds a lint engine for `hlint`, which is the standard and most general Haskell lint tool around these days.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Test Plan: Install `hlint`, and run `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Projects: #arcanist

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

12 years agoMake arcanist lint tests flexible about testcase formatting
epriestley [Wed, 13 Aug 2014 02:32:15 +0000 (19:32 -0700)]
Make arcanist lint tests flexible about testcase formatting

Summary:
We currently require an exact number of "~" characters, but this is needless and error-prone.

Instead, allow any number larger than 3.

Test Plan:
  - Added meta test-case.
  - Ran `arc unit --everything`.

Reviewers: btrahan, thoughtpolice

Reviewed By: thoughtpolice

Subscribers: epriestley

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

12 years agoRemove --background flag to prevent `arc` from hanging
epriestley [Fri, 8 Aug 2014 23:09:11 +0000 (16:09 -0700)]
Remove --background flag to prevent `arc` from hanging

Summary:
Ref T4281. A long time ago, we added a `--background` flag to let `arc lint` and `arc unit` run while you're typing a commit message, in some situations.

This code is only moderately beneficial and is way too complicated. Particularly, it has a long history of causing hangs (T4281, T2463), doesn't work on Windows, and is impossible to debug.

It's also running into a serious PHP bug with EAGAIN/EPIPE being indistinguishable that I haven't been able to find a reasonable workaround for in ~3-4 hours of trying.

All the pathways forward that I can see make this already-complex system more complex.

The major reason that this stuff is so complex is that the subprocess may need to prompt the user (notably, to apply patches from lint).

Instead, I'm going to simplify how `arc diff` interacts with `arc lint` and `arc unit`, so we can just fire-and-forget a background process, let it do as much work as it can without needing user input, and then pick up wherever it left off. This will be slightly less cool/magical, but it won't hang bizarrely and I will be able to debug it.

For now, simply remove the `--background` flag and behavior so `arc` works for everyone.

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

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4281

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

12 years agoDon't interpret `arc browse .` as a commit
epriestley [Fri, 8 Aug 2014 18:21:43 +0000 (11:21 -0700)]
Don't interpret `arc browse .` as a commit

Summary: Ref T5781. `git show .` works like HEAD, but that isn't what `arc browse .` means.

Test Plan: Ran `arc browse .` with a repository at a published commit.

Reviewers: chad, btrahan, avive, avivey

Reviewed By: avivey

Subscribers: epriestley, avivey

Maniphest Tasks: T5781

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

12 years agoRename a test class
Joshua Spence [Tue, 5 Aug 2014 21:44:55 +0000 (07:44 +1000)]
Rename a test class

Summary: Rename `ArcanistPHPCSLinterTestCase` to `ArcanistPhpcsLinterTestCase` for consistency with the class being tested.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoAdd a linter rule for parentheses being used with PHP language constructs
Joshua Spence [Tue, 5 Aug 2014 12:35:34 +0000 (22:35 +1000)]
Add a linter rule for parentheses being used with PHP language constructs

Summary: Fixes T5648.

Test Plan: Added some test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5648

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

12 years agoAllow "arc browse <symbol>" to resolve symbolic commits
epriestley [Mon, 4 Aug 2014 19:03:22 +0000 (12:03 -0700)]
Allow "arc browse <symbol>" to resolve symbolic commits

Summary: Ref T5781. This makes things like `arc browse master` work (but they open the commit, not a revision).

Test Plan: Ran `arc browse master`.

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

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

12 years agoAdd a --browse flag to `arc todo`
epriestley [Mon, 4 Aug 2014 19:03:12 +0000 (12:03 -0700)]
Add a --browse flag to `arc todo`

Summary: Ref T5781. Like D10141, but for `arc todo`. Fixes T5787.

Test Plan: See T5787.

Reviewers: btrahan, csilvers

Reviewed By: csilvers

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781, T5787

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

12 years agoAdd a --browse flag to `arc diff`, to open objects in a browser after creating them
epriestley [Mon, 4 Aug 2014 19:03:03 +0000 (12:03 -0700)]
Add a --browse flag to `arc diff`, to open objects in a browser after creating them

Summary: Ref T5781. Add a flag to optionally open a web browser after creating a diff or revision.

Test Plan: Created //this revision// with `arc diff --browse` // !!! //

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

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

12 years agoAllow "arc browse" to browse objects
epriestley [Mon, 4 Aug 2014 19:02:54 +0000 (12:02 -0700)]
Allow "arc browse" to browse objects

Summary: Ref T5781. This implements `arc browse T234`, for any monogrammed object.

Test Plan:
  - Ran `arc browse T234` outside of a working copy (does not require repository API).
  - Ran `arc browse T234` in a working copy, got task.
  - Ran `arc browse PATH` in a working copy.
  - Ran `arc browse nonpath` with and without `--force`.

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

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

12 years agoUse GIT tracked branches for arc land targets when reasonable
Joseph Battelle [Mon, 28 Jul 2014 23:22:04 +0000 (16:22 -0700)]
Use GIT tracked branches for arc land targets when reasonable

Summary:
See T5690.
-arc land now respects tracked branch when choosing 'onto'; '--onto' option remains as an override.
-arc land now respects tracked branch when choosing a remote; the remote is taken from 'onto's upstream unless the '--remote' option is present; when 'onto' branch has no upstream the '--remote' option must be provided as before.

Since 'arc feature' branches are (already) created as tracking branches, 'arc.land.onto.default' if present, is only used as the default when a non-tracking branch created by some other means is landed with out explicit '--onto'.  This may be surprising but is probably the correct go-forward behavior and is inline with the description in T5690.

Test Plan:
-checked having no arc.land.onto.default still assumes 'master'
-checked 'arc.land.onto.default' still overrides 'master'
-checked upstream branch (of feature branch) overrides 'master' and 'arc.land.onto.default'
-checked '--onto' overrides all
-checked origin is default for non-tracking branches
-checked the land onto branch's upstream remote is used instead of 'origin'
-checked '--remote' overrides 'origin' and the tracked upstream
-tested several crazy branch names including 'something/like/this' for both the upstream and tracking branches
-tested on linux and OS X
-rinse and repeat on Windows

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5690

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

12 years agoRename `ArcanistLintRenderer` subclasses
Joshua Spence [Thu, 24 Jul 2014 22:16:29 +0000 (08:16 +1000)]
Rename `ArcanistLintRenderer` subclasses

Summary: Ref T5655.

Test Plan: `arc lint` and `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5655

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

12 years agoRestore the old "history.immutable" default behavior
epriestley [Wed, 23 Jul 2014 13:46:42 +0000 (06:46 -0700)]
Restore the old "history.immutable" default behavior

Summary: See rARC104219dd. Per the explanatory text, this should default to `true` in Mercurial and `false` in Git.

Test Plan: Ran `arc get-config` in Mercurial repo.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

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

12 years agoDon't explicitly name abstract base classes
Joshua Spence [Mon, 21 Jul 2014 21:49:15 +0000 (07:49 +1000)]
Don't explicitly name abstract base classes

Summary:
Ref T5655. It is superfluous to include "base" in the name of an abstract base class. Furthermore, it is not done consistently within the code base.

In order to retain compatibility with external code, I have kept the `ArcanistBaseWorkflow` class (which trivially extends from `ArcanistWorkflow`), but it is now deprecated and should output a warning message. Similarly for `ArcanistBaseUnitTestEngine`.

Test Plan: Created a workflow which extends from `ArcanistBaseWorkflow`. Executed the workflow and saw a deprecation warning.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, aurelijus

Maniphest Tasks: T5655

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

12 years agoUse have/need data in ArcanistPhutilLibraryLinter
epriestley [Thu, 17 Jul 2014 21:34:59 +0000 (14:34 -0700)]
Use have/need data in ArcanistPhutilLibraryLinter

Summary: Ref T5640. In D9864, the data this linter pulls out of the map was changed, breaking "use of undeclared function" warnings.

Test Plan:
```
>>> Lint for src/future/FutureProxy.php:

   Error  (PHL1) Unknown Symbol
    Use of unknown function 'qqqqqq'. Common causes are:

      - Your libphutil/ is out of date.
        This is the most common cause.
        Update this copy of libphutil: /INSECURE/devtools/libphutil

      - Some other library is out of date.
        Update the library this symbol appears in.

      - This symbol is misspelled.
        Spell the symbol name correctly.
        Symbol name spelling is case-sensitive.

      - This symbol was added recently.
        Run `arc liberate` on the library it was added to.

      - This symbol is external. Use `@phutil-external-symbol`.
        Use `grep` to find usage examples of this directive.

    *** ALTHOUGH USUALLY EASY TO FIX, THIS IS A SERIOUS ERROR.
    *** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT.

              15       $this->setProxiedFuture($proxied);
              16     }
              17
    >>>       18     qqqqqq();
              19   }
              20
              21   public function setProxiedFuture(Future $proxied) {
```

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5640

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

12 years agoRemove "Stopped" logic from Phrequent workflows
James Rhodes [Thu, 17 Jul 2014 03:26:00 +0000 (13:26 +1000)]
Remove "Stopped" logic from Phrequent workflows

Summary: We can remove this "Stopped" code as per feedback on D7327.  I think having the full text of "In Progress" and "Suspended" is much clearer than just a '*' though, so I've only removed the ongoing check.

Test Plan: Ran a combination of `arc start`, `arc stop` and `arc time` and it all worked.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd Phrequent workflows to Arcanist
James Rhodes [Thu, 17 Jul 2014 01:58:22 +0000 (11:58 +1000)]
Add Phrequent workflows to Arcanist

Summary:
Depends on D9906.

This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.

Test Plan: Tested this against a local install.

Reviewers: skyronic, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: maxhodak, hach-que, aran, epriestley, Korvin

Maniphest Tasks: T3569, T3969

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