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

1356 commits

Author SHA1 Message Date
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
Joshua Spence
8274ffa44d Update PHP compatibility information.
Summary: Ref T5141. Generated using PHP v5.5.12 and PHP_CompatInfo v2.26.0.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5141

Differential Revision: https://secure.phabricator.com/D9236
2014-05-21 10:13:58 -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
0468be3e7f Use the ArcanistChmodLinter.
Summary: Apply the `ArcanistChmodLinter` from D9187.

Test Plan: Removed all other linters from the `.arclint` file and executed `arc lint --everything`. Confirmed that there were no issues raised.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9190
2014-05-18 18:10:12 -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
epriestley
85b6c581e1 Read 'phabricator.uri' and 'default' out of more config sources
Summary: We have old/inconsistent code for reading these. Instead, read from sources in a modern way.

Test Plan:
  - Removed "default" and "phabricator.uri" from user/local/project config.
  - Set "default" in "/etc/arcconfig".
  - Ran `arc tasks` and got a "connect to Phabricator" message.

Reviewers: btrahan, davedash

Reviewed By: davedash

Subscribers: davedash, epriestley

Differential Revision: https://secure.phabricator.com/D9105
2014-05-13 11:36:56 -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