1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-24 01:28:51 +02:00
Commit graph

1409 commits

Author SHA1 Message Date
James Rhodes
f658f17080 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
2014-07-17 11:58:22 +10:00
Evan Priestley
97501da164 Fix double file content in files in new subdirectories in Subversion
Summary:
Fixes T5555. Normally, when we `svn diff subdir/`, we use `--depth empty` to get only changes for the directory itself (usually, property changes).

However, this flag has no effect if the directory is newly added.

Adjust the diff parser so that if two sets of hunks are specified for a single file in a raw diff, we let the last one win instead of including both. This approach is a broadly more reasonable interpretation of these diffs.

Test Plan:
  - Added a new file in a new subdirectory in Subversion.
  - Ran `arc diff --only`.
  - No double file content in resulting diff.
  - Added unit test.
  - There's fairly comprehensive unit test coverage for this stuff.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5555

Differential Revision: https://secure.phabricator.com/D9921
2014-07-15 09:43:04 -07:00
Joshua Spence
9016207307 Fix various spelling mistakes
Summary: Minor change, self-explanatory.

Test Plan: Eye-ball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9910
2014-07-13 00:45:38 +10:00
epriestley
f9f2092246 Use git diff a b for ranges, not git diff a..b
Summary:
These are documented as being identical, but `git diff a b` works if `a` is a tree (for example, `4b825d...`, the empty tree hash), but `git diff a..b` does not.

Particularly, with the `a..b` form, `arc diff --base arc:empty` does not work. With the `a b` form, it does.

Test Plan: Ran `arc diff --base arc:empty` in a repository and got a diff.

Reviewers: btrahan, talshiri

Reviewed By: talshiri

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9898
2014-07-11 10:45:11 -07:00
Joshua Spence
09cf64bec3 Remove Phabricator reference from the linter description of ArcanistXHPASTLinter
Summary: The `ArcanistXHPASTLinter` is no longer //too// specific to Phabricator (Phabricator-specific XHPAST lints generally live in `ArcanistPhutilXHPASTLinter`) and //should// be better suited for general purpose usage.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9892
2014-07-12 01:25:51 +10:00
Joshua Spence
806f21315a Minor change to ArcanistXHPASTLinter
Summary: Change `==` to `===`. This is a little bit cleaner because we shouldn't need type coercion here.

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9893
2014-07-12 01:21:21 +10:00
epriestley
0be983a7a3 Parameterize @{upstream} in arc to fix Windows
Summary: We manually quote this in a couple of places. That works fine on Lunix, but does not work on Windows. Instead, explicitly parameterize the command so the correct quoting rules are applied for the OS.

Test Plan: See IRC; windows user had issues fixed by this. `arc:upstream` still works locally.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9868
2014-07-10 07:56:35 -07:00
Joshua Spence
f4615cd86b Allow the todo workflow to add project tags.
Summary: Fixes T4418. Allows Maniphests created through the `arc todo` workflow to have projects assigned.

Test Plan:
```
> ./bin/arc --trace --conduit-uri='http://phabricator.joshuaspence.com' todo "Test project" --project foo --project bar
libphutil loaded from '/home/joshua/workspace/github.com/phacility/libphutil/src'.
arcanist loaded from '/home/joshua/workspace/github.com/phacility/arcanist/src'.
Config: Reading user configuration file "/home/joshua/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/joshua/workspace/github.com/phacility/arcanist/.arcconfig".
Working Copy: Path "/home/joshua/workspace/github.com/phacility/arcanist" is part of `git` working copy "/home/joshua/workspace/github.com/phacility/arcanist".
Working Copy: Project root is at "/home/joshua/workspace/github.com/phacility/arcanist".
Config: Did not find local configuration at "/home/joshua/workspace/github.com/phacility/arcanist/.git/arc/config".
Loading phutil library from '/home/joshua/workspace/github.com/phacility/arcanist/src'...
>>> [0] <conduit> conduit.connect() <bytes = 618>
>>> [1] <http> http://phabricator.joshuaspence.com/api/conduit.connect
<<< [1] <http> 1,050,487 us
<<< [0] <conduit> 1,051,585 us
>>> [2] <conduit> project.query() <bytes = 199>
>>> [3] <http> http://phabricator.joshuaspence.com/api/project.query
<<< [3] <http> 294,584 us
<<< [2] <conduit> 294,986 us
>>> [4] <conduit> maniphest.createtask() <bytes = 313>
>>> [5] <http> http://phabricator.joshuaspence.com/api/maniphest.createtask
<<< [5] <http> 637,693 us
<<< [4] <conduit> 638,098 us
Created task T6: 'Test project' at http://phabricator.joshuaspence.com/T6
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T4418

Differential Revision: https://secure.phabricator.com/D9457
2014-07-10 21:48:49 +10:00
Joshua Spence
3de9e4aaea Allow the ArcanistPhutilLibraryLinter to recover from PHP syntax errors
Summary: Fixes T5577. If the `ArcanistPhutilLibraryLinter` lints a PHP file that contains a syntax error, it will die horribly. Instead, force it to continue as if nothing was wrong.

Test Plan: Introduced a PHP syntax error. Ran `arc lint` and made sure the output looked reasonable.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

Differential Revision: https://secure.phabricator.com/D9865
2014-07-10 11:48:45 +10:00
Aviv Eyal
dfdaed0b27 Don't build unused linters for the ArcanistConfigurationDrivenLintEngine
Summary: Fixes T5124.

Test Plan: `arc lint` on a Phabricator diff that doesn't have JS files doesn't complain on missing JSHint.

Reviewers: #blessed_reviewers, joshuaspence, epriestley

Reviewed By: joshuaspence

Subscribers: epriestley, Korvin

Maniphest Tasks: T5124

Differential Revision: https://secure.phabricator.com/D9843
2014-07-09 15:33:58 -07:00
Joshua Spence
8975e3a424 Decrease the priority of the ArcanistPhutilLibraryLinter
Summary: Ref T5577. Decrease the priority of the `ArcanistPhutilLibraryLinter` such that it is lower than that of the `ArcanistXHPASTLinter`. There isn't any specific reason that we should do this, although it seems to generally be a reasonable idea.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

Differential Revision: https://secure.phabricator.com/D9866
2014-07-10 08:06:37 +10:00
Joshua Spence
e37a76896a Minor change to ArcanistPhutilLibraryLinter
Summary: Ref T5577. Modify `ArcanistPhutilLibraryLinter` to use `PhutilLibraryMapBuilder` instead of using an `ExecFuture` to run `phutil_rebuild_map.php`.

Test Plan: Ran `arc lint`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

Differential Revision: https://secure.phabricator.com/D9864
2014-07-10 07:38:40 +10:00
Joshua Spence
b45142e608 Minor change to ArcanistInfrastructureTestCase
Summary: Update `ArcanistInfrastructureTestCase` after D9860 and D9861.

Test Plan: `arc unit` should do the trick.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9863
2014-07-10 07:34:35 +10:00
Joshua Spence
d09beeb75c Remove @group annotations
Summary: I'm pretty sure that `@group` annotations are useless now... I believe that they were originally used by Diviner?

Test Plan: Eye-balled it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9855
2014-07-09 09:12:13 +10:00
Joshua Spence
b09d21d878 Remove deprecated lints from ArcanistXHPASTLinter
Summary: After D9576, `LINT_PHP_53_FEATURES` and `LINT_PHP_54_FEATURES` are deprecated. They have been replaced by `LINT_PHP_COMPATIBILITY`.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9657
2014-07-08 10:54:40 +10:00
Joshua Spence
32623f84c7 Minor change to ArcanistInfrastructureTestCase::testLibraryMap
Summary: Modify `ArcanistInfrastructureTestCase::testLibraryMap` to use `phutil_get_current_library_name()` instead of hard-coding the library name.

Test Plan: See D9844.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9846
2014-07-06 23:50:30 +10:00
epriestley
ac73fb8cbd In Arcanist, ignore extensions when unit testing the library map
Summary: See D9834. Arcanist version.

Test Plan: See D9834.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9835
2014-07-06 06:21:55 -07:00
Joshua Spence
9bac06cf60 Improve the ArcanistInfrastructureTestCase unit tests
Summary:
Improve the `ArcanistInfrastructureTestCase` unit tests such that they will fail if any of the following conditions are satisfied:

- A symbol referenced in the `__phutil_library_map__.php` file no longer exists.
- A symbol exists in the library but is not referenced within the `__phutil_library_map__.php` file.
- A symbol extends from a different parent symbol than that declared in the `__phutil_library_map.php` file.

Test Plan: See D9824

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9826
2014-07-06 01:50:53 +10:00
Joshua Spence
ae680d9114 Regenerate library map
Summary: Ran `arc liberate` after D9805.

Test Plan: `arc liberate`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9825
2014-07-06 01:14:29 +10:00
Joshua Spence
7de6549338 Move PhutilLibraryMapBuilder to libphutil
Summary: See D9813 for a detailed explanation.

Test Plan:
```
> ./bin/arc liberate
Finding source files...
Found 194 files.
Loading symbol cache...
Found 194 files in cache.
Building library map...
Writing map...
Done.
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9815
2014-07-05 17:01:36 +10:00
Joshua Spence
494d974005 Move ArcanistSpellingDefaultData into a configurable JSON file
Summary: Currently, the `ArcanistSpellingLinter` loads data from `ArcanistSpellingDefaultData`, with no way to configure the linter from an `.arclint` file. Instead we should define a format for a "dictionary" file, of which the `ArvcanistSpellingLinter` can load and of which the paths are easily configured through `.arclint`.

Test Plan:
Updated the test case and ran `arc unit`.

NOTE: I have removed the `LINT_SPELLING_PICKY` and `LINT_SPELLING_IMPORTANT` constants and replaced them with `LINT_SPELLING_FULL` and `LINT_SPELLING_PARTIAL`. This was done because it simplifies the implementation considerably and makes customization of the `ArcanistSpellingLinter` simpler, but also because these constants were not widely used in the existing implementation.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9805
2014-07-04 08:18:33 +10:00
Richard van Velzen
792204db95 Refactor author handling in the Mercurial API
Summary: There were two callsites which needed some information from the username. Only one worked "correctly", causing `arc diff` to not amend commits anymore because the author could not be parser.

Test Plan: run `arc diff` with changes

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9797
2014-07-02 13:59:25 -07:00
Joshua Spence
ca5f05e62b Enable unit tests for ArcanistJscsLinterTestCase
Summary:
https://github.com/mdevils/node-jscs/issues/444 has been resolved in commit [[0de667bac2 | 0de667bac2491ba04d930ff94e990965213ba36b]], which means that `jscs` can be easily run on files with any extension.

NOTE: JSCS version 1.5.7 is required.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9789
2014-07-03 05:15:09 +10:00
Joshua Spence
aaf626fc39 Update spelling data
Summary: Update `ArcanistSpellingDefaultData` with data from the [[http://anonscm.debian.org/gitweb/?p=lintian/lintian.git;a=blob_plain;f=data/spelling/corrections;hb=4b3fc40babff01874b54718406b77b7f3052d26a | original source]].

Test Plan: Visual inspection.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9790
2014-07-01 22:21:49 +10:00
Joshua Spence
5ab288b30c ArcanistChmodLinter should not allow certain MIME types to be executable
Summary: Fixes T5466. An image is an example of a binary which should //not// be executable. Modify the `ArcanistChmodLinter` to disallow certain blacklisted MIME types from being executable.

Test Plan: Created an executable image file and ran `arc lint` over this file.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: richardvanvelzen, epriestley, Korvin

Maniphest Tasks: T5466

Differential Revision: https://secure.phabricator.com/D9723
2014-06-26 05:30:23 +10:00
Joshua Spence
439dff5e09 Fix a spelling mistake and tidy up whitespace
Summary: Self-explanatory.

Test Plan: Eye-ball it.

Reviewers: epriestley, chad, #blessed_reviewers

Reviewed By: chad, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9705
2014-06-24 15:09:53 +10:00
Joshua Spence
108a4dc9e6 Pass the file contents instead of the file path to phutil_json_decode.
Summary: See D9681#22.

Test Plan: Created an empty `.git/arc/config` file... no exception was thrown.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9704
2014-06-24 12:02:19 +10:00
Joshua Spence
750a94e89f Better handling of .arcconfig files.
Summary:
Throw a useful error message when an `.arcconfig` file is not valid JSON.

Depends on D9697.

Test Plan:
Modified an `.arcconfig` file to be invalid JSON.

```
> arc lint
Usage Exception: Your '~/.arcrc' file is not a valid JSON file.

Parse error on line 18 at column 4: Expected: 'STRING' - It appears you have an extra trailing comma
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9681
2014-06-24 09:24:41 +10:00
Joshua Spence
30df78f64c Improve the handling of .arclint files.
Summary: Throw a useful error message when an `.arclint` file is not valid JSON.

Test Plan:
Modified an `.arclint` file to be invalid JSON.

```
> arc lint
Exception
Parse error on line 24 at column 5: Expected one of: 'EOF', '}', ',', ']'
(Run with --trace for a full exception trace.)
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9679
2014-06-24 09:24:30 +10:00
Joshua Spence
c727a98f73 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
2014-06-24 04:56:52 +10:00
Joshua Spence
213628ff34 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
2014-06-24 04:16:15 +10:00
Joshua Spence
48d62ed444 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
2014-06-23 10:33:01 +10:00
Joshua Spence
4fd6c99a93 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
2014-06-23 10:30:57 +10:00
epriestley
b2aeca1963 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
2014-06-22 12:40:36 -07:00
Joshua Spence
3228f7789c 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
2014-06-23 04:12:26 +10:00
Joshua Spence
60d879fc8c 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
2014-06-23 03:32:35 +10:00
Joshua Spence
4f96a23485 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
2014-06-23 01:56:57 +10:00
Joshua Spence
990027e3e0 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
2014-06-23 01:56:44 +10:00
Joshua Spence
cf998db5e0 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
2014-06-22 06:41:22 +10:00
Joshua Spence
a428f22cbf 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
2014-06-21 07:15:38 +10:00
Joshua Spence
5ee12bbad6 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
2014-06-21 00:39:20 +10:00
Joshua Spence
67b6bed92e 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
2014-06-20 18:26:44 +10:00
Joshua Spence
212c41fbd0 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
2014-06-20 07:59:12 +10:00
epriestley
2198cc2849 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
2014-06-18 08:35:29 -07:00
epriestley
dd1f93d77b 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
2014-06-18 05:33:05 -07:00
Joshua Spence
9257f1bc85 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
2014-06-18 08:07:02 +10:00
Richard van Velzen
680ec3670c Don't parse mercurial usernames without email address as an email address
Summary:
This leads to information being lost when others do `arc patch` because the name is used as the email address.

For example:
  username = Richard van Velzen

Would give:
  'authorName' => null,
  'authorEmail' => 'Richard van Velzen'

Test Plan:
ran it through my head a couple of times, and tested it with the common options which all gave the expected result:
  'rvanvelzen@company.com',
  'Richard van Velzen',
  'Richard van Velzen <rvanvelzen@company.com>',
  'Richard van Velzen rvanvelzen@company.com',

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9605
2014-06-17 11:46:49 -07:00
Joshua Spence
d7541c70dd Convert arc list to use PhutilConsoleTable.
Summary: Similar to D9601 and D9602. Also added pretty colors.

Test Plan: {F167702}

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9603
2014-06-18 03:42:53 +10:00
Joshua Spence
7a99e4bc93 Convert arc feature to use PhutilConsoleTable.
Summary: Fixes T5110. `PhutilConsoleTable` handles Unicode characters and can display a decent-looking table.

Test Plan: {F167698}

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5110

Differential Revision: https://secure.phabricator.com/D9602
2014-06-18 03:41:21 +10:00
Joshua Spence
9f8a23d598 Convert arc tasks to use PhutilConsoleTable.
Summary: `PhutilConsoleTable` does a better job at aligning columns. We still probably need to do some work to `PhutilConsoleTable` to set a maximum width for a specified column, or elect which columns can be truncated etc but this can probably come later.

Test Plan: {F167687}

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9601
2014-06-18 03:01:39 +10:00
Joshua Spence
f2f5fb2508 Drop support for parsing non-URL differential IDs from commit message.
Summary: This has been a `TODO` for a few years now... no-one should be using the old-school (non-URL) syntax anymore.

Test Plan: I'm actually not sure if it's okay to drop support for this... please verify.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9595
2014-06-18 01:39:28 +10:00
Joshua Spence
4c99a65567 Allow PHP version to be customized with ArcanistXHPASTLinter
Summary: Fixes T5385. Provide a flexible means of setting a minimum PHP version for the `ArcanistXHPASTLinter`, instead of relying on `ArcanistXHPASTLinter::LINT_PHP_53_FEATURES` and `ArcanistXHPASTLinter::LINT_PHP_54_FEATURES`.

Test Plan: Fixed up and ran unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5385

Differential Revision: https://secure.phabricator.com/D9576
2014-06-18 01:30:15 +10:00
Joshua Spence
473c6d89d7 Move the "ragged classtree edge" linter rule to ArcanistPhutilXHPASTLinter.
Summary: This linter rule is very specific to the Phabricator and it is unlikely that it is being used elsewhere. We should move it to `ArcanistPhutilXHPASTLinter`, where other Phabricator-specific linting code lives.

Test Plan: Moved the corresponding test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9590
2014-06-18 01:28:40 +10:00
Richard van Velzen
3201239e85 Correctly recognize "no bookmarks" for Mercurial
Summary: Fixes T5086.

Test Plan: remove all bookmarks and run `arc feature`

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5086

Differential Revision: https://secure.phabricator.com/D9588
2014-06-17 04:51:55 -07:00
Tal Shiri
5a02012706 Allow specifying runtime configuration with --set-config key=value
Summary:
This is useful for wrapper scripts that want to customize arcanist's behavior without affecting the global configuration.
This can be implemented with arcanist_configuration entry in .arcconfig, however it is currently limited to
per-project settings, and this feature makes writing wrapper scripts a little easier.

Test Plan: arc diff --set-config editor=vim (yeah yeah, crappy test case)

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9442
2014-06-16 15:28:33 -07:00
Joshua Spence
b1ddd0f03b Add an ArcanistJscsLinter.
Summary: Add a linter which wraps around [[https://github.com/mdevils/node-jscs | JSCS]].

Test Plan: Currently, we can't test this linter with out existing infrastructure. Specifically, `jscs` will only lint `*.js` files. I have done a fair bit of manual testing though.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9565
2014-06-17 06:40:36 +10:00
Joshua Spence
419a1247c2 Remove the deprecated ArcanistWorkCopyIdentity::getConfig method.
Summary: This method has been deprecated for a while now (see rARC0d212ccf5a7ac5fc75d2d3036cb3a0bee220fd02). It should be safe to remove.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9466
2014-06-17 06:39:47 +10:00
Ben Alpert
ee3baade6e Add --no-verify to git commit call for arc patch
Summary: I can't find an analogous flag for hg.

Test Plan: I don't have any precommit hooks set up on my machine so I can't test this easily, but I think this seems pretty harmless?

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9523
2014-06-16 11:39:58 -07:00
Joshua Spence
36698b92af Add constants and class methods to php_compat_info.json.
Summary: Allows the `ArcanistXHPASTLinter` to determine whether constants can be used, based on the target PHP version. Also added class methods to the compatibility information, although this isn't used yet (it is small anyway).

Test Plan: Created a test file that contained the `JSON_PRETTY_PRINT` constant. Verified that a linter error was raised.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9571
2014-06-17 01:00:23 +10:00
Joshua Spence
8f8ab969db Update update_compat_info.php to use PHP_CompatInfo version 3
Summary:
Fixes T5377. The current `scripts/update_compat_info.php` script works for PHP CompatInfo version 2, but doesn't work with the newer version 3.

There are a few breaking changes in version 3 that had to be addressed:

- PHP 5.3 is required. Whilst Arcanist is generally compatible with PHP 5.2, I don't think that having this dependency presents any real issues because it is purely a development tool that is rarely updated.
- [[https://getcomposer.org/ | Composer]] is used for packaging, which makes including the library slightly more complicated. Basically, I had to install `PHP_CompatInfo` globally with Composer (`composer global require "bartlett/php-compatinfo"` and then symlink `~/.composer/vendor` into `externals/includes`.

Test Plan: Compared the `resources/php_compat_info.json` file. There are a bunch of functions/classes that //were// in this file but are no longer, but I think that I've covered the most popular extensions.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5377

Differential Revision: https://secure.phabricator.com/D9568
2014-06-17 00:30:16 +10:00
Joshua Spence
497229acd8 Made some additional methods final.
Summary: Just some minor tidying up. I don't think that these methods should ever be overridden in subclasses.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9569
2014-06-17 00:30:04 +10:00
Joshua Spence
523d767646 Add a unit test to check src/__phutil_library_map__.php.
Summary: See D9557. Add a unit test to ensure that `src/__phutil_library_map__.php` is up-to-date.

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9558
2014-06-16 05:42:43 +10:00
Joshua Spence
4371cd81f5 Restore PEP8 errors.
Summary: As per the TODO comment, now that `.arclint` is more mature, we should be able to restore PEP8 errors.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9473
2014-06-16 04:50:59 +10:00
Joshua Spence
45c66a1a7b Fix ArcanistLesscLinter::getVersion function.
Summary:
This `ArcanistLesscLinter::getCacheVersion` should have been renamed to `getVersion` as of D8971, but wasn't updated.

Also fix the regex to properly capture version information.

Test Plan: It's pretty difficult to test this stuff.... I have an idea that I will submit a separate diff for.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9475
2014-06-16 04:50:15 +10:00
epriestley
dfe2bde88d Dirty cache of HEAD commit after an amend/range reload
Summary:
Introducing `--head` caused us to run `git diff base..head` explicitly.

However, we can now hit this workflow:

  - We resolve `HEAD` as commit `aaaa1`.
  - This is cached.
  - We notice dirty working copy changes and prompt the user to amend them to HEAD.
  - The user accepts the amend.
  - We amend, creating commit `bbbb2`.
  - We dirty the commit range and reload the working copy. This //does not// dirty the cache of HEAD.
  - We run `git diff`, but it uses the old cached HEAD: `git diff base..aaaa1`.
  - This works fine (`aaaa1` still exists, it's just not on any branch) but produces the wrong diff (without amended changes).

To resolve this, implement the "dirty the cache when the range reloads" hook.

Also never try to amend if the user provides `--head`.

Test Plan:
Ran `arc diff --only --trace` in a working copy with a new commit and some uncommitted changes.

  - Prior to this change, saw a `git diff base..aaaa1` command and the wrong diff.
  - After this change, saw a `git diff base..bbbb2` command and the correct diff.

Reviewers: chad, csilvers, talshiri

Reviewed By: talshiri

Subscribers: epriestley, spicyj

Differential Revision: https://secure.phabricator.com/D9506
2014-06-12 15:46:15 -07:00
epriestley
9492b4ecba Tweak error and status messages for commit ranges
Summary: Improve/clarify some error messages a bit, hopefully.

Test Plan: Ran `arc which`, `arc diff`, etc., with various explicit, implicit, and `--head` flags. Read error messages, didn't catch anything too awkward.

Reviewers: talshiri

Reviewed By: talshiri

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9489
2014-06-11 16:35:50 -07:00
Tal Shiri
6b192f3178 --range support for git
Summary:
This adds support for passing range of commits for arc diff. This is useful when you want to submit code reviews for past commits without mucking around with the working copy.

This will probably require changes :)

Test Plan: Tested locally, but totally need to add tests for this

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9369
2014-06-11 14:37:01 -07:00
Joshua Spence
08bad11bc8 Remove the ArcanistBaseWorkflow::getUserGUID function.
Summary: This function has been deprecated for a long time (see rARC8150fdf044818c503a588c1b3ef0ddbb93cfa1be). It should be safe to remove it now.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9465
2014-06-11 05:51:06 -07:00
Joshua Spence
b189b594d2 Present case of class and interface names.
Summary: Currently, class and interface names are converted to lowercase when comparing minimum and maximum versions. This is necessary in order to compare with the data from `php_compat_info.json` but causes the lint message to be slightly misleading.

Test Plan:
Linted a test file.

**Before**
```
   Error  (XHP31) Use Of PHP 5.3 Features
    This codebase targets PHP 5.2.3, but `iterator` was not introduced until
    PHP 5.3.0.

               1 <?php
               2
    >>>        3 final class FooBar implements Iterator {}
```

**After**
```
   Error  (XHP31) Use Of PHP 5.3 Features
    This codebase targets PHP 5.2.3, but `Iterator` was not introduced until
    PHP 5.3.0.

               1 <?php
               2
    >>>        3 final class FooBar implements Iterator {}
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9471
2014-06-11 05:39:51 -07:00
Joshua Spence
4c06d1b9e3 [LATER] Remove deprecated mark-committed workflow.
Summary: This workflow has been deprecated for a long time now. At some stage, it should be removed.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9463
2014-06-10 18:29:00 -07:00
Joshua Spence
02e3905cf5 Don't lint symlinks by default.
Summary: Fixes T5300. Currently, if a dead symbolic link is linted, all kinds of errors will be thrown by most linters because they will try to read the (non-existent) file contents. Instead, let's not lint symbolic links by default. In the case that the target of a symbolic link is inside the working copy, then it should be being linted anyway.

Test Plan: Created a symbolic link and verified that it wasn't linted (by any linter other than the `ArcanistFilenameLinter`).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5300

Differential Revision: https://secure.phabricator.com/D9448
2014-06-10 18:20:59 -07:00
Joshua Spence
ff1915ecff Apply various linter fixes.
Summary: Applied various linter fixes. Also make the `.editorconfig` file a bit more specific. Unfortunately, `arc lint --apply-patches` currently modifies some test data that it shouldn't, but this should be fixed after T5105.

Test Plan: Ran `arc unit` to make sure things weren't broken.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9440
2014-06-10 11:02:42 -07:00
Richard van Velzen
b60eaa6487 Make retrieving parents for mercurial commits work consistently across platforms
Summary:
Currently the template is single quoted, but Windows only supports double quotes. This meant that the output would be like:
  lang=text
  'aabbccddeeffaabbccddeeffaabbccddeeff0123
  '

Which is clearly wrong.

This is displayed like that in Phabricator as well, which is confusing.

Test Plan: ran `arc diff` on a Windows machine and saw the correct behaviour.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9450
2014-06-10 10:20:39 -07:00
Joshua Spence
57f4bbae42 Allow spaces after the . operator if followed by a comment.
Summary: Currently, `'foo'.    // Some comment` is not allowed by the `ArcanistXHPASTLinter::LINT_BINARY_EXPRESSION_SPACING` rule. I believe that in the case of a trailing comment, we //should// allow whitespace after the `.` operator.

Test Plan: Wrote and executed a unit test for this case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9438
2014-06-09 12:25:14 -07:00
Joshua Spence
833ce45155 Lint the ArcanistSpellingDefaultData class.
Summary:
Currently, the `ArcanistSpellingDefaultData` is marked with a `@nolint` annotation. This means that it doesn't get linted by any linters. Really, the intention here was to make sure that this file isn't linted by the `ArcanistSpellingLinter` linter.

Now that the `.arclint` file is more mature, we can easily just exclude this file from being linted //only// by the spelling linter, whilst allowing other linters to run.

Test Plan: Ran `arc lint`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9432
2014-06-09 11:36:00 -07:00
Joshua Spence
86eec5b44c Fix "array to string" conversion error.
Summary: Fixes T5298. This bug was probably introduced in D9248. It looks like I forgot to update some references to `$version`.

Test Plan: Ran `arc lint --everything` in rPHU.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5298

Differential Revision: https://secure.phabricator.com/D9434
2014-06-09 11:32:23 -07:00
epriestley
50caec620a Point github.com/facebook URIs at github.com/phacility (Arcanist Edition)
Summary: See D9328.

Test Plan: `grep`

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9329
2014-05-29 09:15:33 -07:00
Joshua Spence
7b61faa192 Add a version number to ArcanistXHPASTLinter.
Summary: Fixes T5209. It makes sense for the `ArcanistXHPASTLinter` to implement the `getVersion` method in order to be able to enforce version requirements (as in T4954).

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5209

Differential Revision: https://secure.phabricator.com/D9317
2014-05-28 06:33:58 -07:00
epriestley
ff97a77786 Add lint rules for => (fat arrow) and . (string concatenation)
Summary: We have coverage for normal binary operators, but not these unusual cases.

Test Plan: Added and executed unit tests.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9314
2014-05-27 16:16:39 -07:00
Joshua Spence
2881686407 Handle arc --version.
Summary: It seems reasonable to transform `arc --version` into `arc version`. The version command is similar to the help command in that it is a command that users unfamiliar with Arcanist will probably try to run at some stage.

Test Plan: Ran `arc --version`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9274
2014-05-23 19:54:04 -07:00
Joshua Spence
b7bb6c8348 Add a version workflow to arcanist.
Summary: A `version` workflow would be useful, especially for less technical users. Additionally, whenever I am faced with a new command I reasonably expect `$CMD [--help|help]` and `$CMD [--version|version]` to work.

Test Plan: Ran `arc version`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9265
2014-05-23 19:35:33 -07:00
epriestley
0d0b8abcdd set custom arcrc file earlier
Summary: It appears to have never really work? At least as far as phabricator.uri (empirically).

Test Plan:
removed ~/.arcrc, run call-conduit user.whoami with --arcrc-file and --trace.
set-config, get-config and alias also read and write to the right place now.

Reviewers: avivey

Reviewed By: avivey

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9263
2014-05-23 14:06:29 -07:00
Joshua Spence
17820442da Change double quotes to single quotes.
Summary: Ran `arc lint --apply-patches --everything` over rARC, mainly to change double quotes to single quotes where appropriate. These changes also validate that the `ArcanistXHPASTLinter::LINT_DOUBLE_QUOTE` rule is working as expected.

Test Plan: Eyeballed //most// of the diff.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9269
2014-05-23 13:53:05 -07:00
epriestley
e34bdf6c74 Fix diffusion.looksoon call to actually work
Summary:
This is all derped up, and we ignore the error so old installs don't break.

Underp it.

Test Plan: Did `arc land`, verified that the call actually went through successfully.

Reviewers: btrahan, davedash

Reviewed By: davedash

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9271
2014-05-23 11:00:07 -07:00
Joshua Spence
042aa2ee38 Add an ArcanistGoLintLinter.
Summary: Create bindings for `golint` as an external linter.

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/D9246
2014-05-23 07:59:57 -07:00
Joshua Spence
85b8b2e5f8 Make arc shell-complete more robust.
Summary: Fixes T5122. Add some basic error handling to the `shell-complete` workflow.

Test Plan: `arc shell-complete` no longer throws errors.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5122

Differential Revision: https://secure.phabricator.com/D9268
2014-05-23 07:59:23 -07:00
epriestley
f64dee022e Fix "arc linters" if no engine is built or configured
Summary: `$engine` will be undefined here. This was just copy/paste derp, combined with me accidentally having an `.arclint` file in a place I didn't expect to have one when I tried to test this.

Test Plan: Ran `arc linters` in a totally bare, non-.arclint-having working copy

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9255
2014-05-22 10:36:31 -07:00
Joshua Spence
e0ee3e8a07 Capture maximum version information in php_compat_info.
Summary: Ref T5141. In order to be able to warn when deprecated functions are used, we need to be aware of from which version the functions were deprecated.

Test Plan: Ran `arc lint` and made sure no unexpected warnings were raised.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5141

Differential Revision: https://secure.phabricator.com/D9248
2014-05-22 09:22:36 -07:00
Joshua Spence
f13aa21b8e Capture a wider range of version information in php_compat_info.json.
Summary: Ref T5141. Currently, `php_compat_info.json` is hardcoded to support PHP 5.2.3. Instead, store as much version information as possible in `php_compat_info.json` and filter accordingly in `ArcanistXHPASTLinter.`

Test Plan: Ran `arc lint` and made sure no additional warnings were raised.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5141

Differential Revision: https://secure.phabricator.com/D9247
2014-05-22 09:14:14 -07:00
Joshua Spence
bca14a368b Fix the wrong argument type being passed to setFlags.
Summary:
Currently, the `ComprehensiveLintEngine` fails to lint `*.py` files with the following exception:

```
> arc lint foo.py
[2014-05-22 01:17:12] ERROR 2: escapeshellarg() expects parameter 1 to be string, array given at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #0 escapeshellarg(Array { 0 => --ignore=E101,E501,W291,W292,W293 })
  #1 array_map(escapeshellarg, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #2 xsprintf_command(Array { unmasked => false }, %s %s, 4, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #3 xsprintf(xsprintf_command, Array { unmasked => false }, Array of size 3 starting with: { 0 => %C %Ls }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #4 PhutilCommandString::renderString(false) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:24]
  #5 PhutilCommandString::getMaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:12]
  #6 PhutilCommandString::__construct(Array of size 3 starting with: { 0 => %C %Ls }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:34]
  #7 csprintf(%C %Ls, Object PhutilCommandString, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/ArcanistExternalLinter.php:400]
  #8 ArcanistExternalLinter::buildFutures(Array { 0 => foo.py }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/ArcanistFutureLinter.php:17]
  #9 ArcanistFutureLinter::willLintPaths(Array { 0 => foo.py }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/engine/ArcanistLintEngine.php:297]
  #10 ArcanistLintEngine::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/src/workflow/ArcanistLintWorkflow.php:336]
  #11 ArcanistLintWorkflow::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/scripts/arcanist.php:322]
[2014-05-22 01:17:12] ERROR 2: escapeshellarg() expects parameter 1 to be string, array given at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #0 escapeshellarg(Array { 0 => --ignore=E101,E501,W291,W292,W293 })
  #1 array_map(escapeshellarg, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #2 xsprintf_command(Array { unmasked => false }, %s %s, 4, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #3 xsprintf(xsprintf_command, Array { unmasked => false }, Array of size 3 starting with: { 0 => %C %Ls }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #4 PhutilCommandString::renderString(false) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:24]
  #5 PhutilCommandString::getMaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:65]
  #6 xsprintf_command(Array { unmasked => false }, %C %C, 1, Object PhutilCommandString, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #7 xsprintf(xsprintf_command, Array { unmasked => false }, Array of size 3 starting with: { 0 => %C %C }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #8 PhutilCommandString::renderString(false) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:24]
  #9 PhutilCommandString::getMaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:12]
  #10 PhutilCommandString::__construct(Array of size 3 starting with: { 0 => %C %C }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:34]
  #11 csprintf(%C %C, Object PhutilCommandString, Object PhutilCommandString)
  #12 call_user_func_array(csprintf, Array of size 3 starting with: { 0 => %C %C }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/exec/ExecFuture.php:72]
  #13 ExecFuture::__construct(%C %C, Object PhutilCommandString, Object PhutilCommandString) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/ArcanistExternalLinter.php:414]
  #14 ArcanistExternalLinter::buildFutures(Array { 0 => foo.py }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/ArcanistFutureLinter.php:17]
  #15 ArcanistFutureLinter::willLintPaths(Array { 0 => foo.py }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/engine/ArcanistLintEngine.php:297]
  #16 ArcanistLintEngine::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/src/workflow/ArcanistLintWorkflow.php:336]
  #17 ArcanistLintWorkflow::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/scripts/arcanist.php:322]
[2014-05-22 01:17:12] ERROR 2: escapeshellarg() expects parameter 1 to be string, array given at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #0 escapeshellarg(Array { 0 => --ignore=E101,E501,W291,W292,W293 })
  #1 array_map(escapeshellarg, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #2 xsprintf_command(Array { unmasked => false }, %s %s, 4, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #3 xsprintf(xsprintf_command, Array { unmasked => false }, Array of size 3 starting with: { 0 => %C %Ls }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #4 PhutilCommandString::renderString(false) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:24]
  #5 PhutilCommandString::getMaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:65]
  #6 xsprintf_command(Array { unmasked => false }, %C %C, 1, Object PhutilCommandString, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #7 xsprintf(xsprintf_command, Array { unmasked => false }, Array of size 3 starting with: { 0 => %C %C }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #8 PhutilCommandString::renderString(false) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:24]
  #9 PhutilCommandString::getMaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:16]
  #10 PhutilCommandString::__toString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/exec/ExecFuture.php:611]
  #11 ExecFuture::isReady() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/FutureIterator.php:322]
  #12 FutureIterator::updateWorkingSet() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/FutureIterator.php:97]
  #13 FutureIterator::addFuture(Object ExecFuture, foo.py) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/ArcanistFutureLinter.php:18]
  #14 ArcanistFutureLinter::willLintPaths(Array { 0 => foo.py }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/engine/ArcanistLintEngine.php:297]
  #15 ArcanistLintEngine::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/src/workflow/ArcanistLintWorkflow.php:336]
  #16 ArcanistLintWorkflow::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/scripts/arcanist.php:322]
[2014-05-22 01:17:12] ERROR 2: escapeshellarg() expects parameter 1 to be string, array given at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #0 escapeshellarg(Array { 0 => --ignore=E101,E501,W291,W292,W293 })
  #1 array_map(escapeshellarg, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:87]
  #2 xsprintf_command(Array { unmasked => true }, %s %s, 4, Array { 0 => Array { 0 => --ignore=E101,E501,W291,W292,W293 } }, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #3 xsprintf(xsprintf_command, Array { unmasked => true }, Array of size 3 starting with: { 0 => %C %Ls }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #4 PhutilCommandString::renderString(true) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:20]
  #5 PhutilCommandString::getUnmaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/csprintf.php:63]
  #6 xsprintf_command(Array { unmasked => true }, %C %C, 1, Object PhutilCommandString, 5) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/xsprintf.php:63]
  #7 xsprintf(xsprintf_command, Array { unmasked => true }, Array of size 3 starting with: { 0 => %C %C }) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:33]
  #8 PhutilCommandString::renderString(true) called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/xsprintf/PhutilCommandString.php:20]
  #9 PhutilCommandString::getUnmaskedString() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/exec/ExecFuture.php:622]
  #10 ExecFuture::isReady() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/FutureIterator.php:322]
  #11 FutureIterator::updateWorkingSet() called at [/home/joshua/dotfiles/modules/phabricator/libphutil/src/future/FutureIterator.php:97]
  #12 FutureIterator::addFuture(Object ExecFuture, foo.py) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/linter/ArcanistFutureLinter.php:18]
  #13 ArcanistFutureLinter::willLintPaths(Array { 0 => foo.py }) called at [/home/joshua/workspace/github.com/facebook/arcanist/src/lint/engine/ArcanistLintEngine.php:297]
  #14 ArcanistLintEngine::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/src/workflow/ArcanistLintWorkflow.php:336]
  #15 ArcanistLintWorkflow::run() called at [/home/joshua/workspace/github.com/facebook/arcanist/scripts/arcanist.php:322]
```

Test Plan: Ran `arc lint foo.py` on an empty file.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9251
2014-05-21 18:23:21 -07:00
epriestley
07895c41c7 Fix warning in arc backout
Summary: Fixes T5145. Neither variable is ever used.

Test Plan: Searched for uses of either variable.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5145

Differential Revision: https://secure.phabricator.com/D9244
2014-05-21 13:07:11 -07:00
epriestley
c999f3e6b5 Fix XHPAST to detect use of undeclared variables in catch
Summary:
Currently, when code has a block like:

  } catch (Exception $ex) {

...we attempt to mark "$ex" as declared. However, we incorrectly mark every variable used anywhere in the block as declared. This means we'll never raise this warning in a `catch` block.

Instead //only// mark the caught exception as declared.

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

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: lpriestley, epriestley

Differential Revision: https://secure.phabricator.com/D9239
2014-05-21 12:23:51 -07:00
James Rhodes
6b8552291d Handles an issue in windows with large code bases not squash merging correctly.
Summary: Handles an issue in windows with large code bases not squash merging correctly, this only catches the issue it doesn't really do any recovery.

Test Plan: We have been running this change in our work environment, it's a hard bug to replicate but when it has reared it's head this has caught it.

Reviewers: waynea, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Maniphest Tasks: T4884

Differential Revision: https://secure.phabricator.com/D8729
2014-05-21 10:15:31 +10:00
epriestley
a19503bb59 Don't support severity customization in pyflakes
Summary: Pyflakes doesn't have any message codes, so we can't do anything with severities.

Test Plan: Ran `arc lint` with severities on one of these linters, got an error.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9222
2014-05-20 12:44:55 -07:00
epriestley
104219dd62 Improve 'arc get-config', 'arc set-config' and show more config info with --trace
Summary:
Fixes T4952. Several issues:

  - You review configuration values with `arc set-config --show`. This makes no sense and never has, I think it just predated `arc get-config` or was easier or something.
    - Instead, review values with `arc get-config` and review details with `arc get-config --verbose`.
  - Show better and more detailed information about all config sources.
  - Establish and show default values from a new "default" source.
  - With `--trace` include more information about attempts to read configuration files.

Test Plan:
Ran `arc get-config --trace --verbose` in various working directories and received sensible-looking output.

{F156247}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4952

Differential Revision: https://secure.phabricator.com/D9172
2014-05-20 11:34:28 -07:00
epriestley
03ea43646a Fix up quotes on a silly string
Summary: This string is quite silly!

Test Plan: `arc land --hold` in an affected working copy.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9212
2014-05-20 11:34:22 -07:00
Joshua Spence
1b3eb9a247 Remove the ExampleLintEngine class.
Summary: Ref T2039. Now that the `ArcanistConfigurationDrivenLintEngine` has gained more widespread use, we do no longer expect users to need to write their own lint engine. The documentation has already been updated to reflect this.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9198
2014-05-19 07:52:07 -07:00
Joshua Spence
615fc0a7f8 Remove the PhutilLintEngine class.
Summary: After D9057 and D9064 this class is no longer used.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9197
2014-05-19 07:50:35 -07:00
Joshua Spence
1b0ab48f15 Improve autofixing of double quotes in XHPAST linter.
Summary: The XHPAST double quotes rule autofixes strings which use double quotes where single quotes would suffice. In the case in which the double-quoted string contained an escaped double quote, the autofix string can be improved by removing the escape symbol.

Test Plan: Modified existing unit tests to cover this case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9196
2014-05-19 07:49:51 -07:00
Joshua Spence
b251615716 Add a rule to the XHPAST linter to check for whitespace before a semicolon.
Summary: This rule is based on a rule from [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/WhiteSpace/SemicolonSpacingSniff.php | PHP_CodeSniffer]].

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/D9195
2014-05-19 07:48:58 -07:00
Joshua Spence
566c7e9c5c Add a rule to the XHPAST linter for detecting elseif usage.
Summary: This rule is adapted from [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/ControlStructures/ElseIfDeclarationSniff.php | PHP_CodeSniffer]] and is used to enforce the consistent use of `else if`.

Test Plan: Wrote and executed unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, neal

Differential Revision: https://secure.phabricator.com/D9193
2014-05-19 06:33:22 -07:00
Joshua Spence
904fbe737c Add an ArcanistChmodLinter.
Summary: Fixes T3922. Add a linter which complains if files are executable when they shoudn't be.

Test Plan: Tested by modifying the `.arclint` file of the rARC repository and running `arc lint --everything`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T3922

Differential Revision: https://secure.phabricator.com/D9187
2014-05-18 16:57:08 -07:00
Joshua Spence
606380f4bd Made some additional methods of ArcanistLintEngine final
Summary: To me, it seems that these methods should not be overridden by subclasses

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

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: LegNeato, aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D7960
2014-05-18 11:08:29 -07:00
Joshua Spence
a67b848f44 Made some additional methods of ArcanistBaseWorkflow final.
Summary: To me, it seems that these methods should never be overwritten in subclasses.

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

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: LegNeato, aran, epriestley, Korvin

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

Conflicts:
	src/workflow/ArcanistBaseWorkflow.php
2014-05-18 11:05:51 -07:00
Joshua Spence
6c1bae437e Modernize ArcanistScalaSBTLinter.
Summary: Ref T2039. Convert the `ArcanistScalaSBTLinter` into an `ArcanistExternalLinter` and make it compatible with `.arclint`.

Test Plan: I can't really test this because I don't have any Scala projects and we don't have any test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: codeblock, epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9097
2014-05-18 10:49:22 -07:00
Joshua Spence
178b32c6c2 Fix the ArcanistXHPASTLinter single quote rule.
Summary: Previously, the `ArcanistXHPASTLinter` was suggesting that `"\1"` be written as `'\1'`, which is incorrect. Therefore, I ensured that all of the cases listed in the [[http://www.php.net/manual/en/language.types.string.php | PHP documentation]] were handled correctly.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9182
2014-05-18 06:47:37 -07:00
Joshua Spence
b21a420071 Update ArcanistCoffeeLintLinter to be compatible with CoffeeLint v1.4.0.
Summary: CoffeeLint v1.4.0 deprecated the `--checkstyle` flag in favor of `--reporter=checkstyle`.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9181
2014-05-18 06:07:35 -07:00
Joshua Spence
4181fbde12 Fix the ArcanistJSONLintLinter::getVersion function.
Summary: Ref T4954. There was a typo in the original implementation. It wasn't noticed until now because the `getVersion` function isn't really used anywhere.

Test Plan: Ran `arc linters` in a repository with `ArcanistJSONLintLinter` configured, noticed that the version number appeared in the output.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4954

Differential Revision: https://secure.phabricator.com/D9160
2014-05-17 18:36:25 -07:00
Joshua Spence
b4b6a33d2a Relax the version regex for ArcanistFlake8Linter.
Summary: As noticed by @epriestley in D9060, `flake8 --version` can emit a string like "2.0" rather than the expected "2.0.0".

Test Plan: Uninstalled my existing version of `flake8` (v2.1.0) and installed a prior version (`pip install flake8==2.0.0`). Ran `flake8 --version` and inspected the output.

Reviewers: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D9174
2014-05-17 18:18:03 -07:00
Joshua Spence
7c56fad48f Fix the ArcanistJSHintLinter::getVersion function.
Summary: As identified by @epriestley in D9060, `jshint --version` emits version information on stderr, not stdout.

Test Plan: Ran `jshint --version` locally and verified that the version information is output to stderr.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T4954

Differential Revision: https://secure.phabricator.com/D9173
2014-05-17 18:17:47 -07:00
epriestley
b52f3fafe3 Fix "arc diff --raw-command --create"
Summary: Fixes T5082. We try to access the repository API in some cases when we don't have one.

Test Plan:
  - Made revisions with "arc diff --raw-command --create".
  - Made this revision, without "--raw-command".

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5082

Differential Revision: https://secure.phabricator.com/D9165
2014-05-17 13:40:05 -07:00
Joshua Spence
1493e043e1 Add an ArcanistCoffeeLintLinter linter.
Summary:
Add a wrapper around [[http://www.coffeelint.org/ | CoffeeLint]] as an `ArcanistExternalLinter`.

Depends on D9041.

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/D9051
2014-05-16 21:58:53 -07:00
Joshua Spence
7bde5941cf Set the working directory to the project root for external linter ExecFuture classes.
Summary: Fixes T5085. Currently, the `ExecFuture` instances that are used to call an external linter are executed in the current working directory. This means that if a path is specified in the `.arclint` file, relative to the project root directory, that the path will not be properly interpreted by the external linter when `arc lint` is called from a level deeper than the project root.

Test Plan: Ran `arc lint` from a subdirectory of a project and verified that the linter did not throw an exception due to not being able to find the specified configuration file.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5085

Differential Revision: https://secure.phabricator.com/D9159
2014-05-16 21:48:12 -07:00
Joshua Spence
8cd9cb1047 Add some .arclint configuration options for ArcanistJSHintLinter.
Summary:
Allow `.jshintrc` and `.jshintignore` paths to be passed to `jshint`.

Ref T2039.

Test Plan: Added the `jshintrc` and `jshintignore` keys to an `.arclint` file that was configured to use `ArcanistJSHintLinter`. Ran `arc lint --trace` and inspected the flags that were passed to `jshint`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: john.snow, epriestley, Korvin

Maniphest Tasks: T2039, T5085

Differential Revision: https://secure.phabricator.com/D9112
2014-05-16 21:42:52 -07:00
Joshua Spence
35a26718d8 Add a linter rule for determining when single quotes should be used over double quotes.
Summary: Personally, I am a strong fan of this rule. There is currently a similar rule provided by PHP_CodeSniffer.

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/D9117
2014-05-16 19:26:55 -07:00
Joshua Spence
38eda3e86b Move getPEP8WithTextOptions method into ComprehensiveLintEngine class.
Summary: Since this method is only used within this class, it makes sense to move it here.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9114
2014-05-16 19:18:35 -07:00
epriestley
75cb3cf358 Fix arc diff --raw when run outside a repository
Summary: Fixes T5071. If you run `arc diff --raw` from some arbitrary, non-repository directory we incorrectly try to read information out of the working copy. Even if this information is available, `arc diff --raw` should not assume it's accurate (there's no guarantee the diff comes from the working copy).

Test Plan: Ran `arc diff --raw` in an arbitrary directory.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5071

Differential Revision: https://secure.phabricator.com/D9142
2014-05-15 19:03:29 -07:00
Vihang Mehta
6c6035d04b Add Closure linter to arcanist
Summary:
Found https://secure.phabricator.com/D4519 but it was horribly out of date, so decided to write a new version.
Kinda clobbered together form that diff and the new version of ArcanistJSHintLinter

Test Plan: Tested on personal projects with js files.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9131
2014-05-15 09:19:28 -07:00
James Rhodes
fcdacc28b8 Fix issue where message contained % but wasn't intended for use with parameters
Summary: This fixes an issue with the C# linter where a message could be returned from cslint that wasn't intended for use with parameters.  This just ensures there's enough parameters so that it won't crash (and consequently ignore lint messages).

Test Plan: Ran the linter, it didn't crash.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9116
2014-05-14 17:11:45 -07:00
Joshua Spence
d484b60295 Minor improvements to the ArcanistLintCheckstyleXMLRenderer class.
Summary: Ref T4948. Move the `startDocument` code to a `renderPreamble` function so that, at least theoretically, the renderer can be reused. Otherwise, the only way to reuse the renderer would be to construct a new instance.

Test Plan: Ran `arc lint --output xml` and verified that the output looked reasonable.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4948

Differential Revision: https://secure.phabricator.com/D9108
2014-05-13 17:32:49 -07:00
Joshua Spence
b744ed9a19 Be more strict with the type of .arclint properties.
Summary: Although this provides less context in terms of the error message (for example, `Parameter has invalid type. Expected type 'optional regex|list<regex>', got type 'list<string>'.`), I think that it is the right approach. I think that `PhutilTypeSpec::checkMap` should be improved such that additional context is provided in the exception message.

Test Plan: Ran `arc lint`. Modified `.arclint` to contain an invalid regex and ran `arc lint` again.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9089
2014-05-13 15:17:56 -07:00
Joshua Spence
79285208c4 Don't prompt for patches when outputting lint results as XML.
Summary: The Checkstyle XML output format is not intended to be an interactive workflow.

Test Plan: Introduced linter issues and ran `arc lint`. Verified that no interactive prompt was shown.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9107
2014-05-13 14:40:27 -07:00
Joshua Spence
ec3de41684 Support Checkstyle as an output format for lint results.
Summary: Fixes T4948. Add a lint renderer which supports outputting the lint results in the Checkstyle XML format.

Test Plan: Ran `arc lint --xml` and inspected the output.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4948

Differential Revision: https://secure.phabricator.com/D9083
2014-05-13 13:20:29 -07:00
Joshua Spence
d826bf65c6 Minor cleanup of linter testing code.
Summary:
Just some minor cleaning up, including:

- Removing old annotations for Diviner.
- Renaming some `lint-test` files so that the directory name bears a closer resemblance to that of the linter.
- Remove some useless `return` statements.

Test Plan: `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9096
2014-05-13 06:16:02 -07:00
Joshua Spence
c4c0fbd7cd Rename test method.
Summary: Rename this test method for consistency with other linter test classes.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9095
2014-05-13 05:44:32 -07:00
epriestley
abafef7fb6 Write waiting message to stderr, not stdout. 2014-05-12 17:27:19 -07:00
William R. Otte
d5d8086646 Fixed the error message when cppcheck isn't installed to not be completely wrong.
Summary: Arcanist is a dirty rotten liar.  I made it less of a dirty, rotten liar.

Test Plan: http://imgur.com/36qXcgI

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9081
2014-05-12 12:58:03 -07:00
epriestley
0c21afa08a Print out a "waiting on stdin" message from 'arc call-conduit'
Summary: It looks like this command is just hanging if you skim the documentation and miss that you have to echo parameters into it. Print out a hint.

Test Plan: Ran `arc call-conduit` and got a hint.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9050
2014-05-12 11:36:19 -07:00
Joshua Spence
9b05a025b7 Made some additional methods of ArcanistLinter and ArcanistExternalLinter final
Summary: To me, it seems that these methods should never be overwritten in subclasses.

Test Plan: `arc unit`

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D7958
2014-05-12 09:49:45 -07:00
epriestley
0583b39bb0 Minor tweaks for XHPAST config
Summary: Ref T2039. The type specs are right in theory but not quite correct in practice, since we pass strings in rather than objects.

Test Plan: While tweaking `phabricator/`, adjusted these to get desirable results.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9071
2014-05-12 05:06:14 -07:00
epriestley
7bbafe91d2 Fill out some more info functions for libphutil-specific linters
Summary: Ref T2039. It looks like "phutil-library" didn't make it over, I'll add that to the other two (unless I'm wrong and this isn't an oversight?).

Test Plan: Used `arc linters` to read help.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9070
2014-05-12 05:06:04 -07:00
Joshua Spence
be803ce577 Remove the getConfig and setConfig method.
Summary: It seems that there is a lot of overlap between `getConfig` / `setConfig` and `getLinterConfigurationOptions` / `setLinterConfigurationValue` respectively.

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

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9067
2014-05-12 04:46:56 -07:00
Joshua Spence
1b820dbb14 Allow ArcanistPhutilXHPASTLinter to be configured from .arclint.
Summary: Currently, `PhabricatorLintEngine` configures the `ArcanistPhutilXHPASTLinter` linter. In order to use `.arclint` instead, we need to expose the `ArcanistPhutilXHPASTLinter` configuration to the `.arclint` format.

Test Plan: See D9064.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9066
2014-05-12 04:46:41 -07:00
Joshua Spence
c4ac8a1aea Make the PhutilLintEngine final.
Summary:
Phabricator now uses the `ArcanistConfigurationDrivenLintEngine` lint
engine instead of the `PhabricatorLintEngine` lint engine.

Depends on D9064.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9069
2014-05-12 04:31:03 -07:00
Joshua Spence
315314425e Modernize ArcanistCppcheckLinter.
Summary: Ref T2039. Make the `ArcanistCppcheckLinter` compatible with `.arclint`.

Test Plan: Wrote and executed unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9068
2014-05-12 04:30:36 -07:00
epriestley
54c377448d Provide arc linters --verbose to list all available options
Summary:
Ref T2039. I'll update the corresponding documentation.

It feels a little awkward that this is disconnected from `getLinterConfigurationOptions()`, but I dislike returning weird ad-hoc structures more than I dislike having two methods. Most linters don't implement either of these anyway.

Test Plan: Ran `arc linters` and `arc linters --verbose`.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9062
2014-05-11 20:23:07 -07:00
Joshua Spence
b63828a87e Use the ArcanistConfigurationDrivenLintEngine as a linting engine.
Summary: Ref T2039. The `.arclint` file is reasonably complete now and we should start using it if possible, since we are trying to recommend it to others.

Test Plan: `arc lint`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9057
2014-05-11 19:33:40 -07:00
epriestley
86cbcb9f56 Allow linters to share resources by shoving them on the Engine
Summary:
Currently, the Phutil XHPAST Linter and vanilla XHPAST Linter reuse the same parse tree, but do this by having explicit knowledge of one another.

Instead, let them synchronize by writing to a glorified array of globals on the Engine. They no longer require knowledge of one another, so this can work under `.arclint`.

(This could probably be a little cleaner by putting more logic in the shared base class, but Facebook has some kind of goofy subclass of this thing and //this// patch won't disrupt it, while a cleaner one might.)

This should unblock D9057.

Test Plan: Ran unit tests and normal lint, got accurate looking results without duplicate invocations showing up in `--trace`.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9059
2014-05-11 19:28:46 -07:00
Joshua Spence
9bd740b1f8 Remove severity options from some linters.
Summary: The `ArcanistGeneratedLinter` and `ArcanistNoLintLinter` don't actually ever raise any linter messages, so it doesn't make sense to set custom severities for these linters. Instead, don't expose this configuration.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9038
2014-05-11 19:28:27 -07:00
epriestley
7870e7f2e4 Warn when accessing deprecated lint config
Summary:
Ref T2039. Addresses two issues:

  - Issues a warning for use of config which is deprecated by `.arclint`.
  - We no longer require an engine to be present for these linters, so `arc linters` doesn't fatal if they aren't configured.

Test Plan:
  - Ran `arc linters` in a repo with no JSHint.
  - Ran `arc linters` in a repo with junk in .arcconfig and got a warning when it was read. Verified it still took effect.

Reviewers: chad, btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9058
2014-05-11 18:39:28 -07:00
Juan Pablo Civile
377c585752 Allow linters that extend ArcanistExternalLinter to customize the file parameter
Summary: Not all linters run on a `command file` fashion. In particular, the maven checkstyle plugin runs like `command --flag=file`.

Test Plan: Run a linter that extends `ArcanistExternalLinter`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9026
2014-05-11 16:27:23 -07:00
epriestley
5d1f87a8c2 Provide more help text for arc linters
Summary: Ref T2039. This isn't exhaustive, but moves things forward by a decent chunk.

Test Plan: Used `arc linters` and read the messages.

Reviewers: chad, btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9056
2014-05-11 16:16:45 -07:00
epriestley
e13f5839d4 Add 'arc linters' to list available linters and status
Summary: Ref T2039. We're starting to get kind of a lot of linters; provide `arc linters` to help users review and understand them and construct `.arclint` files.

Test Plan: {F152205}

Reviewers: btrahan, joshuaspence

Reviewed By: btrahan, joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9041
2014-05-11 13:42:56 -07:00
Joshua Spence
c4985ef415 Allow global excludes to be specified in .arclint.
Summary: Currently, paths to be excluded from linting need to be specified for each linter individually. This is a pain for projects that are using even a moderate number of linters and which have common paths which should be excluded from linting completely.

Test Plan: Unfortunately, it's hard to test this sort of stuff. I cloned the `arclint-examples` repository and tested my changes there,

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9054
2014-05-11 05:32:38 -07:00
Joshua Spence
48c67d9c15 Minor formatting changes to ArcanistSpellingDefaultData.
Summary:
Fixed a few minor nitpicks:

  - Fix indentation.
  - Change double quotes to single quotes.
  - Add trailing commas to arrays.

Test Plan: Meh.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9053
2014-05-11 05:25:47 -07:00
Joshua Spence
20a0559522 Use PHP type hinting in ArcanistXHPASTLinter.
Summary: Explicitly specify the types of the function parameters. This change is basically the same as D8388.

Test Plan: `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9040
2014-05-10 01:56:06 -07:00
Joshua Spence
edd85a0e9d Modernize ArcanistMergeConflictLinter.
Summary: The only real change here is adding a `getLinterConfigurationName` method so that this linter can be used with an `.arclint` file. Everything else is just some minor tidying.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9039
2014-05-10 01:55:47 -07:00
Joshua Spence
2dba2f8528 Remove some dead comments.
Summary: These comments are redundant now.

Test Plan: N/A

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9037
2014-05-10 01:53:21 -07:00
Joshua Spence
89de113787 Add --quiet flags to the ArcanistCSSLintLinter.
Summary: This isn't really necessary, nor does it bear any significant benefits, however semantically it seems to make sense. From `csslint --help`, the `--quiet` flag causes `csslint` to "Only output when errors are present".

Test Plan:
Tested using `csslint` directly:

```
> csslint test.css

csslint: No errors in /home/joshua/workspace/github.com/facebook/arcanist/foo.css.
> csslint --quiet test.css
```

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9036
2014-05-10 01:52:57 -07:00
Joshua Spence
d80468bf81 Make the methods of ArcanistBaseXHPASTLinter final.
Summary: No subclass should need to override these methods. Additionally, none currently do.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9035
2014-05-10 01:51:44 -07:00