Add a newline to the output of `arc help --full`.

Summary: The output from `arc help --full` is missing a newline character.

Test Plan:
**Before**
```
> arc help --full
      --skip-arcconfig
           Skip the working copy configuration file

      --arcrc-file filename
           Use provided file instead of ~/.arcrc.>
```

**After**
```
> arc help --full
      --skip-arcconfig
           Skip the working copy configuration file

      --arcrc-file filename
           Use provided file instead of ~/.arcrc.
>
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9608
Fix race condition inside `git diff-files`

Summary:
There's some sort of race inside `git` here, where the `git diff-files` command exits with different results some of the time when run in parallel with `git ls-files` or `git diff` (running either command was sufficient to trigger the race).

Run it separately to avoid the race.

I poked around the `git` source a little bit but quickly lost interest given that the issue seems fixed and this workaround is essentially reasonable.

Test Plan: Ran test 20x in a row without failures.

Reviewers: hach-que

Reviewed By: hach-que

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9616
Fix an issue with `arc branch` and very old branches

Summary:
In D9595, we stopped parsing short-form "Differential Revision:" fields in commit messages, and only accept URLs.

I have one of the older style commit messages in my local `arcanist/`, so now we go down this parse failure branch in `arc branch`. This has never worked quite correctly, and if the parse fails we end up with a bad branch dictionary that is missing fields.

Test Plan: Ran `arc branch` in a working copy with an old `Differential Revision:` field at the head of a branch. Before patch: explosions; after patch: works great.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9620
Add unit tests for `ArcanistMergeConflictLinter`.

Summary: Self explanatory. Also fixed the character offset to start at 1 instead of 0 (because the other linters seem to do this).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9626
Tidying up of linter code.

Summary: Various tidying up of linting code.

Test Plan: `arc lint` and `arc unit` still pass.

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9625
Update callsites of `phutil_json_decode`.

Summary: Depends on D9634. `phutil_json_decode` now throws an exception on invalid JSON.

Test Plan: Ran the unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9641
Don't throw an exception if no configuration is set for linter tests

Summary: This was broken in D9641. If `$config` is not set, then a `PhutilJSONParserException` will be thrown. The expected behaviour is that it is okay to not explicitly set any configuration.

Test Plan: Ran `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9643
Add a native JSON linter.

Summary:
Ref T5297. Utilize `PhutilJSONParser` to create a native JSON linter (native in that it is pure PHP with no external dependencies).

Since [[https://github.com/Seldaek/jsonlint | JsonLint]] is literally a PHP port of [[https://github.com/zaach/jsonlint | jsonlint]], I figured that we should also deprecate `ArcanistJSONLintLinter`. `ArcanistJSONLinter` //should// behave identically to `ArcanistJSONLintLinter`.

Depends on D9634.

Test Plan: Ran the `ArcanistJSONLintLinter` unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9628
Lint JSON files with `ArcanistJSONLinter`.

Summary: After D9628, we can lint JSON files natively.

Test Plan: Linted a few JSON files manually (i.e. `arc lint --trace -- $FILE`).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9652
Improve the handling of the `php_compat_info.json` file.

Summary: See inline comments on D9576. Also replace `json_decode` with `phutil_json_decode`, for better error handling.

Test Plan: Make sure `arc unit` still works.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9656
Minor fix for the `ArcanistXHPASTLinter`.

Summary: This `LINT_PHP_53_FEATURES` should have been replaced with `LINT_PHP_COMPATIBILITY` in D9576.

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9655
Add unit tests for `ArcanistPylintLinter`.

Summary: Self-explanatory.

Test Plan: Ran the tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9661
Remove the `ArcanistScalaSBTLinter`

Summary: As discussed in D9097, the `ArcanistScalaSBTLinter` isn't //really// a linter. Eventually we should add support for a proper Scala linter, but I think that supporting the `ArcanistScalaSBTLinter` as-is is more effort than it is worth.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9664
Read extension classes and functions from `php_compat_info.json`.

Summary: Consolidate `php_extension_classes.txt` and `php_extension_functions.txt` with `php_compat_info.json`. Given that `php_extension_classes.txt` and `php_extension_functions.txt` are manually generated whereas `php_compat_info.json` is generated automatically, this should make maintenance easier.

Test Plan: Deleted the `src/.phutil_module_cache` file (in each of rARC, rPHU and rP) and ran `arc liberate`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9662
Remove SBTLinter from ComprehensiveEngine

Summary: D9664 removed this, clean up this remaining callsite.

Test Plan: `grep`

Reviewers: chad, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9668
Only lint files in the working copy with `arc lint --everything`.

Summary: Fixes T5442. `arc lint --everything` currently uses a `FileFinder` to discover paths for linting. A consequence of this is that files that are ignored or otherwise excluded from version control are linted.

Test Plan: Ran `arc lint --everything` in rPHU and noticed that I wasn't prompted to add a trailing newline to `src/.phutil_module_cache`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5442

Differential Revision: https://secure.phabricator.com/D9674
Don't use error context from JSHint in linter messages

Summary:
The error context (a.k.a. "original text") as provided by `jshint` is not very useful and actually causes `arc lint` to display the lint message incorrectly.

{F169277}

The underlying problem here is that the error context from `jshint` contains the entire line from the input file rather than just the offending source code.

Test Plan: Ran `arc lint -- webroot/rsrc/js/core/behavior-hovercard.js` (in rP) and verified that the output looked reasonable.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9675
Skip the "Too Many Errors" error that is raised by JSHint.

Summary: If JSHint encounters //too many// errors (by default, more than 50) errors, then it quits prematurely and raises an additional (rather unhelpful) "Too Many Errors" error. We should just ignore this additional error.

Test Plan: Added a test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9693
Add a URL to support a TODO comment.

Summary: Provide a link to a "resolved" [[http://bugs.xdebug.org/view.php?id=1041 | Xdebug issue]] to support a TODO comment. Further information can be found at http://derickrethans.nl/dead-code.html.

Test Plan: Read the article.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9696
Patch: don't complain about reviewers not being specified.
This will break in the future when upstream arc incorporates T4631. Hopefully there will be a better solution by then