1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-14 02:42:40 +01:00
Commit graph

1690 commits

Author SHA1 Message Date
Joshua Spence
f43b74c605 Improve PHP compatibility linter
Summary: Ref T8674. Adds to `ArcanistPHPCompatibilityXHPASTLinterRule` such that an error is raised whenever `self` or `$this` is used in an anonymous closure prior to PHP 5.4.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T8674

Differential Revision: https://secure.phabricator.com/D13841
2015-08-11 06:48:56 +10:00
Joshua Spence
9e65fc6516 Improve declaration formatting linter rule for anonymous functions
Summary: Ref T8742. Anonymous functions should have a space after the `function` keyword. Additionally, ensure that there is a space before and after the `use` token.

Test Plan: Modified existing test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T8742

Differential Revision: https://secure.phabricator.com/D13804
2015-08-09 09:13:57 +10:00
Joshua Spence
c304c4e045 Minor linter fix
Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13807
2015-08-08 10:18:59 +10:00
Joshua Spence
968f4ae5d7 Add a linter rule for unary postfix expression spacing
Summary: Unary postfix expressions should not have a space before the operator.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13805
2015-08-06 11:40:12 +10:00
Joshua Spence
986f5d82d0 Add a linter rule for object operator spacing
Summary: Add a linter rule to check that there is no whitespace surrounding the object operator, `->`.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13798
2015-08-06 07:14:38 +10:00
Joshua Spence
c8f0deffab Add a linter rule for unary prefix expression spacing
Summary: Add a linter rule to ensure that there is no space between the operator and the operand in a unary prefix expression.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13797
2015-08-06 07:08:55 +10:00
Joshua Spence
1e75302e77 Add a linter rule for spacing before opening parenthesis in function calls
Summary: Repurpose `ArcanistClosingCallParenthesesXHPASTLinterRule` (and rename it to `ArcanistCallParenthesesXHPASTLinterRule`) to ensure that there is no spacing before opening parenthesis in function calls.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13796
2015-08-06 06:58:22 +10:00
Joshua Spence
bf4e7d4ca8 Improve undeclared variables linter rule
Summary: Currently `ArcanistUndeclaredVariableXHPASTLinterRule` does not properly handle anonymous closures.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: johnny-bit, Korvin

Differential Revision: https://secure.phabricator.com/D13795
2015-08-06 06:57:17 +10:00
Joshua Spence
402899a9c3 Allow closing tags in files containing HTML
Summary: Ref T8742. PHP files which contain inline HTML should be allowed to use PHP closing tags (`?>`). This is in accordance with [[https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md | PSR-2 guidelines]].

Test Plan: Updated unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T8742

Differential Revision: https://secure.phabricator.com/D13794
2015-08-06 06:56:26 +10:00
epriestley
fb5d5b86fa Add more information about Harbormaster/Unit result codes to Arcanist
Summary: Ref T7419. This makes it easier to render helpful documentation in the next diff without having to copy/paste things.

Test Plan:
In next diff:

{F688894}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7419

Differential Revision: https://secure.phabricator.com/D13788
2015-08-04 13:05:38 -07:00
Joshua Spence
0d6f3328a0 Fix some failing unit tests
Summary: I somehow missed these.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13693
2015-08-03 06:47:47 +10:00
Joshua Spence
d3b316ad35 Fix an undeclared property
Summary: `NoseTestEngine::$parser` is undefined.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13760
2015-08-03 06:47:20 +10:00
epriestley
e5946ed1a5 Also coerce "char" for lint messages
Summary: Ref T8921. See similar change in D13695. This expands the scope to also coerce `setChar()`.

Test Plan: `arc unit --everything`

Reviewers: btrahan

Subscribers: epriestley

Maniphest Tasks: T8921

Differential Revision: https://secure.phabricator.com/D13737
2015-07-28 16:31:03 -07:00
Lukas Sparrow
5fcf7b5a3b Add $projectRoot to PytestTestEngine
Summary:
Fixes T8912. Property `$project_root` was missing in `PytestTestEngine` class, resulting in
broken py.test wrapper. Also renaming the property so the linter is happy.

Test Plan: `arc unit --everything`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: kparal, epriestley, Korvin

Maniphest Tasks: T8912

Differential Revision: https://secure.phabricator.com/D13698
2015-07-24 05:11:32 -07:00
epriestley
bd1da9da6c Improve strictness around setLine() types in ArcanistLintMessage
Summary: Fixes T8921. Harbormaster is strict about types it accepts, but `ArcanistLintMessage` is more liberal. Push the strictness barrier down to the linter level, while maintaining reasonable flexibility in the API.

Test Plan: `arc unit --everything`

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8921

Differential Revision: https://secure.phabricator.com/D13695
2015-07-23 13:19:53 -07:00
Joshua Spence
5e4f9a2bf9 Fix checkstyle severities
Summary: "Advice" is not a valid severity for Checkstyle... valid severities are `ignore`, `info`, `warning` and `error`.

Test Plan: Read the [[http://checkstyle.sourceforge.net/property_types.html | documentation]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13684
2015-07-23 09:14:16 +10:00
Joshua Spence
e286ef66c8 Improve the declaration parentheses linting
Summary: Improve `ArcanistClosingDeclarationParenthesesXHPASTLinterRule` (and rename it to `ArcanistDeclarationParenthesesXHPASTLinterRule`) to ensure that there is no whitespace before the opening parenthesis of a function/method declaration.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13675
2015-07-23 06:44:10 +10:00
Yomi
b7e87e959c Fix typo. Closes T8915.
Summary:
From 'or' to 'are'.
Closes T8915.

Test Plan: Wait 30 seconds.

Reviewers: joshuaspence, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8915

Differential Revision: https://secure.phabricator.com/D13664
2015-07-21 11:14:39 -07:00
Joshua Spence
58302432cc Fix brace formatting linter rule
Summary: Fixes T8847.

Test Plan:
Ran `arc lint` on a test file:

```lang=php
<?php

if ($x) {
  echo 'foo';
}else {
  echo 'bar';
}
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8847

Differential Revision: https://secure.phabricator.com/D13633
2015-07-17 16:40:46 +10:00
Sebastian Szulc
3793998df4 Fix unitialized variable in ArcanistPhpunitTestResultParser
Summary:
This is to fix `arc unit` when running a test file with no test results (e.g. skipped)
```
EXCEPTION: (RuntimeException) Undefined variable: last_test_finished at [<phutil>/src/error/PhutilErrorHandler.php:210]
arcanist(head=master, ref.master=d54cb072facd), deviantart(), phutil(head=master, ref.master=75f675747648)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/unit/parser/ArcanistPhpunitTestResultParser.php:95]
  #1 ArcanistPhpunitTestResultParser::parseTestResults(string, string) called at [<deviantart>/unit/DaUnitEngine.php:150]
  #2 DaUnitEngine::parseTestResults(string, TempFile, string, string) called at [<deviantart>/unit/DaUnitEngine.php:82]
  #3 DaUnitEngine::run() called at [<arcanist>/src/workflow/ArcanistUnitWorkflow.php:186]
  #4 ArcanistUnitWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
```

Test Plan: Create a test file with skipped tests. Run `arc unit`. Make sure the exception is not thrown.

Reviewers: joshuaspence, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D13640
2015-07-16 13:40:05 -07:00
epriestley
5e578fb847 Make test result parsing stricter about duration formats
Summary: Fixes T8805. Explicitly require int/float for duration. Adjust XUnit/Go parsers to provide one.

Test Plan: Ran unit tests.

Reviewers: btrahan, joshuaspence, chad

Reviewed By: chad

Subscribers: jsotuyod, champo, epriestley

Maniphest Tasks: T8805

Differential Revision: https://secure.phabricator.com/D13637
2015-07-15 13:26:15 -07:00
Joshua Spence
407954dddd Output lint XML results to a file
Summary:
Ref T8332. I find it really odd that I need to run `arc lint --everything --output xml > checkstyle.xml` and feel that it would be much more intuitive to just run `arc lint --everything --output xml` and have the output written to `checkstyle.xml`.

To provide context, we are running `arc lint --everything` in a CI job and parsing the results.

Test Plan: Ran `arc lint --everything --output xml` and saw the output written to file.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8332

Differential Revision: https://secure.phabricator.com/D13570
2015-07-15 06:58:41 +10:00
Joshua Spence
999eb93765 Remove verbose output from arc lint --trace
Summary: I think that this output was used during the early stage of `ArcanistConfigurationDrivenLintEngine`, but I question it's value nowadays. In particular, I find that this output makes the output of `arc lint --trace` significantly less useful.

Test Plan: Ran `./bin/arc lint --trace` and saw useful output.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13593
2015-07-08 20:03:00 +10:00
Joshua Spence
23a653e2bb Minor performance optimization
Summary: Avoid using `idx` in `PhutilTestCase::endCoverage`.

Test Plan: Compared [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-tgmc6ci74daivtankuck/?symbol=idx | before]] and [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-nd77mled6xnezyxidd6m/?symbol=idx | after]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13595
2015-07-08 18:32:08 +10:00
epriestley
3d16595c07 Update references to "www.phabricator.com" in Arcanist
Summary: This host is no longer in service.

Test Plan: `git grep -i www.phabricator.com`

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D13586
2015-07-07 13:34:56 -07:00
Joshua Spence
4d6d3feb7f Use PhutilClassMapQuery
Summary: Use `PhutilClassMapQuery` where appropriate.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13428
2015-07-07 19:22:12 +10:00
Joshua Spence
bbccf1dd40 Linter performance optimization
Summary: Optimize `ArcanistXHPASTLinterRule::getLintID`.

Test Plan: Compare [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-wwgi4xzupt4z2fvbyff3/?symbol=mpull | before]] and [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-rn2ialomtr2apnkzisb3/?symbol=mpull | after]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13541
2015-07-07 18:00:27 +10:00
epriestley
d54cb072fa Raise a more tailored error message when a third-party test engine returns bad results
Summary: Fixes T8714. When a test engine isn't returning the correct result type, shift suspicion onto it.

Test Plan: Faked error, got exception blaming test engine.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8714

Differential Revision: https://secure.phabricator.com/D13486
2015-07-01 04:48:52 -07:00
epriestley
29839e8c72 Don't fail lint builds for "advice"; make lint/unit upload failures louder
Summary:
Ref T8670. Ref T8657.

  - When lint only has advice (no warnings/errors), consider it a "passing" build.
  - Be a little louder about `sendmessage` calls failing because this stuff is not totally broken and that makes T8670-related things easier to catch/fix.

Test Plan: Created this revision.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8657, T8670

Differential Revision: https://secure.phabricator.com/D13436
2015-06-25 10:05:54 -07:00
Joshua Spence
5466451b76 Return $this from setter methods
Summary: Return `$this` from a bunch of setter methods for consistency. See also D13422.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13423
2015-06-25 22:30:33 +10:00
Joshua Spence
04d788c79e Ensure that a space is used after a catch token
Summary: For consistency, a single space should separate `catch` and the following parenthetical expression.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13389
2015-06-25 07:09:17 +10:00
epriestley
b697a3b80b Try to ship lint and unit results to Harbormaster autotargets
Summary:
Ref T8095. Before uploading lint/unit results in the old way, try to ship them to autotargets.

If we can query and upload data to autotargets, do so, and then skip the older style uploads.

Test Plan: Used `arc diff` to ship data up via Harbormaster.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8095

Differential Revision: https://secure.phabricator.com/D13381
2015-06-23 10:22:57 -07:00
Joshua Spence
f06eea0d84 Fix arcanist shell completion
Summary: Fixes T8560.

Test Plan: Ran `arc shell-complete` outside of a working copy.

Reviewers: avivey, #blessed_reviewers, epriestley

Reviewed By: avivey, #blessed_reviewers, epriestley

Subscribers: avivey, epriestley, Korvin

Maniphest Tasks: T8560

Differential Revision: https://secure.phabricator.com/D13338
2015-06-19 13:15:44 +10:00
Joshua Spence
3414cbeda5 Use PhutilInvalidStateException
Summary: Use `PhutilInvalidStateException` where appropriate.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13333
2015-06-18 22:41:30 +10:00
epriestley
9a7c4d87a8 Fix missing property on ArcanistTestResultParser
Fixes T8554 (properly, this time).

Auditors: joshuaspence
2015-06-15 13:59:54 -07:00
epriestley
579c0eba1a Fix missing property in ArcanistPhpunitTestResultParser
Fixes T8554.

Auditors: joshuaspence
2015-06-15 13:39:24 -07:00
Joshua Spence
fe4856277c Add some tests for subclasses
Summary: Add some tests to ensure that `ArcanistXHPASTLinterRule` subclasses are properly implemented. This should catch issues such as two linter rules having the same `ID` value. See D13272 for a similar change.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13274
2015-06-15 20:01:30 +10:00
Joshua Spence
956bfa701c Extend from Phobject
Summary: All base classes should extend from `Phobject` or some other classes. See D13275 for some explanation.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13281
2015-06-15 15:47:33 +10:00
Joshua Spence
ac8367a884 Add a linter rule for extending Phobject
Summary: If I understand correctly, all classes should extend from `Phobject`?

Test Plan: This needs some further work

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13275
2015-06-15 15:44:45 +10:00
Joshua Spence
e97cdc6c9a Remove "@stable" annotation
Summary: I don't believe that `@stable` is useful anymore?

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13285
2015-06-15 07:51:43 +10:00
Joshua Spence
3c3438714b Further improvements to test discovery
Summary: I found another issue with T8042... it seems that tests from the root directory (i.e. `src/__tests__` are not being discovered properly). The handling of this case (`$library_path` being the library root directory) can probably be improved, and I am open to suggestions. Depends on D13202.

Test Plan: Added to existing test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13185
2015-06-15 07:23:17 +10:00
Joshua Spence
7d15b85a1b Mark some strings for translation
Summary: Add some more `pht`izations.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13198
2015-06-09 07:17:39 +10:00
Joshua Spence
c36a825f5c Minor documentation improvements
Summary: Minor tidying of documentation and adding some groups.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13135
2015-06-08 11:31:35 +10:00
Joshua Spence
8c589f1f75 Improve test discovery with PhutilUnitTestEngine
Summary:
Ref T8042. Tests were not being discovered in two different scenarios:

  # Files modified at the same level as the library root directory.
  # "Normal" directories like `src/unit/engine`.

This regression was caused by D12689.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8042

Differential Revision: https://secure.phabricator.com/D13126
2015-06-03 21:07:17 +10:00
Joshua Spence
4754a3e156 Linter fixes
Summary: Apply various minor linter fixes.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13106
2015-06-02 22:13:21 +10:00
epriestley
4e83efb31d Fix a translation ("to ignore these changes...")
Summary: Fixes T8374.

Test Plan:
```
$ arc diff
You have untracked files in this working copy.

  Working copy: /Users/epriestley/dev/core/lib/arcanist/

  Untracked changes in working copy:
  (To ignore this change, add it to ".git/info/exclude".)
    derp

    Ignore this untracked file and continue? [y/N] ^C
```

Reviewers: btrahan, joshuaspence, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8374

Differential Revision: https://secure.phabricator.com/D13096
2015-06-01 06:50:46 -07:00
Joshua Spence
0b1acf0dc0 Split the ArcanistXHPASTLinter into modular rules
Summary:
The `ArcanistXHPASTLinter` class is becoming quite bloated. This diff separates the class into one-class-per-rule, which makes everything much more modular. One downside to this decoupling is that code reuse between linter rules is much more difficult, although this only affects a very small number of linter rules.

There is still some further work that could be done here, but I defer this until a later diff:

  - Rewrite `ArcanistPhutilXHPASTLinter` using `ArcanistXHPASTLinterRule`.
  - Change the unit tests so that they are truly only testing a single linter rule.
  - Maybe improve the way in which linter configuration options are handled.
  - Make it easier to keep track of the linter rule IDs (see T6859).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: johnny-bit, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10541
2015-06-01 15:49:16 +10:00
epriestley
cdaa0e32e4 Always return an array from ArcanistWorkflow->loadProjectRepository()
Summary: Fixes T8344. Prior to D12971, this always returned `array()`. It may now sometimes return `null`. Switch the behavior to be more similar to the old behavior.

Test Plan: Inspection.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T8344

Differential Revision: https://secure.phabricator.com/D13061
2015-05-28 16:10:59 -07:00
Joshua Spence
8fe013b0ec Allow PhutilUnitTestEngine to execute tests from a single path
Summary: Fixes T8042. Changes the way that `PhutilUnitTestEngine` discovers unit tests. In particular, if you only modify a single test case then there is no reason to run all other test cases within the same directory (which is the current behavior).

Test Plan: Added some unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8042

Differential Revision: https://secure.phabricator.com/D12689
2015-05-28 18:39:37 +10:00
epriestley
3ac80200e2 Push to staging areas when running "arc diff"
Summary: Ref T8238. If a staging area is configured for a repository (see D13019), push a copy of changes to it after creating a diff.

Test Plan: Ran `arc diff` with various options, saw applicable changes get pushed to staging.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: cburroughs, epriestley

Maniphest Tasks: T8238

Differential Revision: https://secure.phabricator.com/D13020
2015-05-27 10:27:03 -07:00
epriestley
a36dc81715 Provide more documentation for Arcanist upload stuff
Summary: Ref T8259. Make some highly-ambiguous methods like `setData()` more clear.

Test Plan: reading

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8259

Differential Revision: https://secure.phabricator.com/D13038
2015-05-27 10:26:27 -07:00
epriestley
5c7b22e620 Use file.allocate to upload large files from arc diff
Summary: Fixes T8259. Depends on D13016. Use modern logic to support large file uploads.

Test Plan:
  - Diffed with some images, saw them show up in the diff.
  - Diffed with a 12MB binary, saw it upload in chunks.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8259

Differential Revision: https://secure.phabricator.com/D13017
2015-05-27 10:26:12 -07:00
epriestley
877e7b6388 Move Conduit file upload logic into a separate class
Summary:
Ref T8259. Currently, `arc upload` uses new logic but `arc diff` uses older logic internally. This prevents `arc diff` from uploading files larger than 4MB to newer servers.

Split the upload logic apart so the two upload pathways can share it. Callers now build a list of FileDataRefs and hand them to an Uploader for upload.

Test Plan:
Ran `arc upload` on:

  - One file.
  - Several files.
  - Small files.
  - Big files.
  - Directories.
  - Unreadable files.
  - Files full of random data.
  - The same file over and over again.
  - The same big file over and over again.
  - Artificially broke `file.allocate` and redid some of the simple cases (large/chunked aren't expected to work in this case).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T8259

Differential Revision: https://secure.phabricator.com/D13016
2015-05-27 10:25:53 -07:00
Nevogd
407af00ef6 Fix invalid parameter in phutil_console_wrap()
Summary:
Fixes T8314. Change the phutil_console_wrap() call to only have a single
string parameter.

Test Plan:
Ran `arc diff` added text into the title, summary and test plan fields,
but did not specify any reviewers. When prompted to continue, clicked 'No' and
saw the '(Message saved to commit message.)' string.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T8314

Differential Revision: https://secure.phabricator.com/D13015
2015-05-26 06:07:25 -07:00
Joshua Spence
64d03ff68b Remove arcanist projects from working copy code
Summary: Ref T7604. Remove "arcanist projects" from `ArcanistWorkingCopy` and a few other callsites. Depends on D12999.

Test Plan: Can't really think of how to test this.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12945
2015-05-26 07:08:56 +10:00
Joshua Spence
59ef783f4a Remove call to "arcanist.projectinfo" from ArcanistWorkflow
Summary: Ref T7604. Remove call to the `arcanist.projectinfo` #conduit endpoint from `ArcanistWorkflow`. Depends on D12992.

Test Plan: Ran `arc which` and verified that repository information was present.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12971
2015-05-25 22:04:50 +10:00
Joshua Spence
410331db75 Fix some format strings
Summary: These `pht` calls use `%d` instead of `%s`.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12994
2015-05-25 21:24:40 +10:00
Joshua Spence
1f2b51c4a3 Fix sanity checks for patch workflow
Summary:
Ref T7604. Ref T8307. This was broken in D12962 because I only tested `arc patch --arcbundle`. Furthermore, this particular sanity check doesn't actually do anything now (see T8307).

Test Plan:
Ran `arc patch --nobranch D12971` successfully.

Auditors: epriestley
2015-05-25 18:41:28 +10:00
Joshua Spence
be9dd352be Remove call to "arcanist.projectinfo" from arc export
Summary:
Ref T7604. Remove a call to `arcanist.projectinfo` from `arc export`. This Conduit call was only used to detect the repository encoding, which we should be able to do locally anyway.

I was considering removing the `$projectName` from `ArcanistBundle` as well, but I'm not convinved that this is a good idea. Specifically, doing so would make it difficult to issue the "This patch is for the 'X' project, but the working copy belongs to the 'Y' project" error. We could potentially use the repository callsign for this purposes, but this isn't portable across installs.

Test Plan: I'm not quite sure how to test this. I suspect that this functionality isn't widely used anyway.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12962
2015-05-25 18:31:09 +10:00
Joshua Spence
9b7c6786cd Change visibility of some linter methods
Summary: Change the visibility of the `raiseLintAtSomething` methods, mainly to allow linter rules to raise linter messages (see D10541).

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12976
2015-05-24 07:45:01 +10:00
Joshua Spence
6f86866104 phtize a bunch more strings
Summary: I found a few strings that I had missed, using a mostly-broken-but-somewhat-okay custom linter ruler (https://secure.phabricator.com/differential/diff/30988/).

Test Plan: Intense eyeballing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12888
2015-05-22 17:09:56 +10:00
Joshua Spence
9edcaadb2a Remove an unused variable
Summary: Ref T7604. Remove an unused variable from `ArcanistDiffWorkflow`.

Test Plan: This diff, I guess.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12972
2015-05-22 17:09:18 +10:00
Joshua Spence
8244b3582a Improve behavior for detecting the failure to parse external linter output
Summary:
Currently, a lot of `ArcanistExternalLinter` subclasses have something like this:

```lang=php
if ($err && !$messages) {
  return false;
}
```

We can avoid this code duplication by moving this check to the `ArcanistExternalLinter` class.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11321
2015-05-22 07:30:17 +10:00
Joshua Spence
26c4f12a21 Allow getXHPASTTreeForPath to return the tree for an arbitrary path
Summary: This allows `ArcanistBaseXHPASTLinter::getXHPASTTreeForPath` to return the parse tree for a file that wasn't explicitly linted. In my particular use case, I am writing a linter rule to determine if it is necessary to import a PHP file with `require_once` (i.e. the file consists only of class/interface definitions which are autoloadable).

Test Plan: Tested externally using a custom linter.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12271
2015-05-21 15:08:39 +10:00
Joshua Spence
e72a43a992 Remove "commit hook mode" workarounds for ArcanistXHPASTLinter
Summary: Ref T7674. `ArcanistXHPASTLinter` has some workarounds for running in "commit hook" mode (which has since been removed). This linter should always have a working copy.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12956
2015-05-21 15:08:39 +10:00
Joshua Spence
af343e4ca6 Remove deprecated linter configuration
Summary:
Removes the deprecated method of configuring linters (via the `.arcconfig` file). There is one main caveat here:

- There is currently no convenient method by which to change the path for an external linter (T5057). This means that there is no direct replacement for the deprecated `lint.ruby.prefix` configuration. The workaround is to symlink these binaries into `arcanist/externals/bin`.

Test Plan: Wait a sufficient amount of time before landing this.

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aik099, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10005
2015-05-21 07:01:37 +10:00
Joshua Spence
e3311f0832 Remove "arcanist projects" from arcanist
Summary: Ref T7604. Remove "arcanist projects". Depends on D12894.

Test Plan: This diff (so meta).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12901
2015-05-20 11:29:41 +10:00
Joshua Spence
097c894d08 Add linter rule for invalid modifiers
Summary: Add some linter rule to detect invalid modifiers for class methods/properties.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12922
2015-05-20 09:45:13 +10:00
Joshua Spence
753705b2c5 Rename ArcanistPhutilTestCase to PhutilTestCase and Remove ArcanistTestCase
Summary: Ref T7977. The `ArcanistTestCase` class is pointless and can be replaced by `ArcanistPhutilTestCase`. Furthermore, it sorta makes sense to just rename `ArcanistPhutilTestCase` to `PhutilTestCase`. Depends on D12664 and D12666.

Test Plan: `arc unit`

Reviewers: avivey, #blessed_reviewers, epriestley

Reviewed By: avivey, #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T7977

Differential Revision: https://secure.phabricator.com/D12665
2015-05-20 09:40:24 +10:00
Joshua Spence
399f040018 Improve getLink method for unit tests
Summary:
Ref T7977. The `PhutilTestCase::getLink` method currently relies on arcanist projects instead of repositories. Instead, make this logic a bit smarter by looking up the base URI from `phabricator.uri` (currently it is hardcoded to `https://secure.phabricator.com`).

Ideally, we would pass `?repositories=$REPOSITORY_PHID` to `DiffusionSymbolController` as well, but I don't know if this is worth pursuing.

Test Plan: This diff.

Reviewers: avivey, #blessed_reviewers, epriestley

Reviewed By: avivey, #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Maniphest Tasks: T7977

Differential Revision: https://secure.phabricator.com/D12664
2015-05-20 09:36:22 +10:00
Joshua Spence
1d72cfc944 Provide a getProjectRoot method for ArcanistLinter
Summary: Adds a `getProjectRoot()` method to the `ArcanistLinter` class, simplifying a bunch of code.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12474
2015-05-20 09:16:36 +10:00
Joshua Spence
9444072e21 Improve the robustness of the "alias function" linter rule
Summary: Improve the `ArcanistXHPASTLinter::LINT_ALIAS_FUNCTION` linter rule. Currently this rule does not correctly handle alias functions which are not strictly lowercase.

Test Plan: Added a test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12921
2015-05-20 08:36:36 +10:00
Joshua Spence
80691e0a66 Add a linter rule for modifier ordering
Summary: Fixes T7417. Adds `ArcanistXHPASTLinter::LINT_MODIFIER_ORDERING` for ensuring that method/property modifiers (`public`, `protected`, `private`, `static`, `abstract` and `final`) are consistently ordered. The modifier ordering that is enforced is consistent with [[http://www.php-fig.org/psr/psr-2 | PSR-2]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7417

Differential Revision: https://secure.phabricator.com/D12421
2015-05-20 07:26:16 +10:00
Joshua Spence
993166fa49 Further improvements to array comma linter rule
Summary:
Improve the `ArcanistXHPASTLinter::LINT_ARRAY_SEPARATOR` rule to be able to autofix the following code:

```lang=php
array(
  1,
  2,
  3, /* comment */ );
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12308
2015-05-20 07:05:34 +10:00
Joshua Spence
25855c4427 Don't explicitly use an interpreter for pep8
Summary: Depends on D9430. If we are using the system installation of `pep8`, then it probably unnecessary (and possibly wrong) to specify `python2.6` as the default interpreter.

Test Plan: Ran `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: vrusinov, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9474
2015-05-20 07:04:07 +10:00
Joshua Spence
5b2571f5ae Don't bundle PEP8
Summary: Currently, we bundle a specific version of `pep8` with Arcanist. Whilst maybe this made sense historically, as pointed out by @epriestley in D9412#6, there is no longer much point in doing so.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: talshiri, vrusinov, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D9430
2015-05-20 07:03:22 +10:00
Joshua Spence
73feffbe70 Remove the ArcanistConduitLinter
Summary: This linter is a relic from Facebook days. As Harbormaster becomes more useful (T1049) this linter should become obsolete. Instead of modernising this linter to be compatible with modern infrastructure, it is easier to just let it die.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10533
2015-05-20 07:02:43 +10:00
Joshua Spence
9862d7c0cb Move the getFunctionCalls method to ArcanistBaseXHPASTLinter
Summary: Move the `getFunctionCalls` method to the `ArcanistBaseXHPASTLinter` so that it can be used by subclasses.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12472
2015-05-20 07:00:29 +10:00
epriestley
ddfdfce3f5 Fix CPP Lint severity
Summary: Currently all CPPLint issues are hard-coded to warning level, which prevents customising the severity in .arclint. Change to pick up the configured severity. Note that getLintMessageSeverity will call getDefaultMessageSeverity if nothing is configured for that error category.

Test Plan: Tested manually to confirm configured categories display with the correct severity and that non-configured ones return with the default severity (ERROR).

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9682
2015-05-19 07:58:59 -07:00
Joshua Spence
60a5a24033 Add a linter rule for invalid default parameters
Summary: See http://www.phpwtf.org/default-arguments-and-type-hinting.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12855
2015-05-19 06:59:50 +10:00
Joshua Spence
d0d2cf903c Change parameters for diffusion.getlintmessages call
Summary: Ref T7604. Change the parameter for `diffusion.getlintmessages` from `arcanistProject` to `repositoryPHID`.

Test Plan: Ran `arc --conduit-uri='http://phabricator.local lint --only-new=1`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12900
2015-05-19 00:10:44 +10:00
Joshua Spence
4bb2eecdaf Add a linter rule for the instanceof operator
Summary: The `instanceof` operator expects the first argument to be an object instance. See http://www.phpwtf.org/instanceof-smart.

Test Plan: Added test case

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12856
2015-05-18 18:02:51 +10:00
Joshua Spence
0c9a037719 Fix arc which output
Summary: Fixes T8231. This was derped in some recent refactoring.

Test Plan: Ran `arc which` and saw expected output.

Reviewers: avivey, epriestley, #blessed_reviewers

Reviewed By: avivey, epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8231

Differential Revision: https://secure.phabricator.com/D12890
2015-05-18 09:40:43 +10:00
Joshua Spence
8c6e1284cc Improve ArcanistXHPASTLinter::LINT_TOSTRING_EXCEPTION
Summary:
The `ArcanistXHPASTLinter::LINT_TOSTRING_EXCEPTION` linter rule was introduced in D12854, but fails for the following:

  - Interfaces which declare the `__toString()` method.
  - Classes which mark the `__toString()` method as `abstract`.

Test Plan: Added test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12892
2015-05-18 09:14:55 +10:00
Joshua Spence
2422202ba4 Add a linter rule to prevent the __lambda_func function from being redeclared
Summary:
See http://phpsadness.com/sad/39. Declaring a function named `__lambda_func` prevents the `create_function` function from working. This is because `create_function` eval-declares the function `__lambda_func`, then modifies the symbol table so that the function is instead named `"\0lambda_".(++$i)`, and returns that name.

NOTE: Personally, I don't think that anyone should use `create_function`. However, despite this, I think it is reasonable that no function is named `__lambda_func` in case some external library relies on `create_function`.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12870
2015-05-18 08:24:49 +10:00
Joshua Spence
1e3073a4f8 Add a linter rule to prevent exceptions from being thrown in a toString method
Summary: Fixes T8207. It is not possible to throw an exception from within the `__toString()` method. Add a linter rule to prevent this from happening.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8207

Differential Revision: https://secure.phabricator.com/D12854
2015-05-18 08:18:34 +10:00
Joshua Spence
2e66d03c68 Add a linter rule for spacing after a cast
Summary: Ref T7409. Add a linter rule to ensure that a cast is not followed by a space. This is largely based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php | Generic_Sniffs_Formatting_NoSpaceAfterCastSniff]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12321
2015-05-18 08:07:43 +10:00
Joshua Spence
e1a057b4d9 Add a linter rule for alias functions
Summary: Ref T7409. Adds `ArcanistXHPASTLinter::LINT_ALIAS_FUNCTION` for linting the use of alias funtions. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php | Generic_Sniffs_PHP_ForbiddenFunctionsSniff]]. See [[http://php.net/manual/en/aliases.php | list of function aliases]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12422
2015-05-18 07:55:27 +10:00
Joshua Spence
e3a556af9b Improve error message from ArcanistXHPASTLinter::LINT_FORMATTED_STRING
Summary: Currently the error message from `ArcanistXHPASTLinter::LINT_FORMATTED_STRING` is slightly wrong, mentioning `xsprintf` instead of the actual `sprintf`-style function which was used. This diff changes the error message to be more correct.

Test Plan: Linted a file containing `sprintf('%s')` and saw a reasonable lint message.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12871
2015-05-18 07:48:03 +10:00
Joshua Spence
1df248cc2d Improve the "invalid parent scope" linter rule
Summary: This linter rule was introduced in D12420, but fails to handle a specific edge case.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12853
2015-05-18 07:47:19 +10:00
Joshua Spence
f9cefb7e2d Remove deprecated "base" classes
Summary: Ref T5655. After D9983, `ArcanistBaseWorkflow` and `ArcanistBaseUnitTestEngine` are deprecated.

Test Plan: Wait a sufficient amount of time before landing this.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D10004
2015-05-16 10:16:48 +10:00
Joshua Spence
e1a051a033 Improve linter rule for useless overriding methods
Summary: Ref T7409. This linter rule was added in D12419, but fails in some specific cases. Improve the handling of `n_DECLARATION_PARAMETER_LIST`.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12828
2015-05-15 07:10:28 +10:00
Joshua Spence
4864435a50 Minor linter fixes
Summary: Minor linter fixes.

Test Plan: `arc lint`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12836
2015-05-15 07:09:30 +10:00
epriestley
c6fa42b9c5 Improve translation of an "arc land" string
Summary: This lost formatting in a pht() conversion; give the bold back and make it properly translatable.

Test Plan: Will land.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12843
2015-05-14 10:58:22 -07:00
Andrew Finnemore
383633e63f Fix missing comma in sprintf() in ArcanistWorkflow.
Summary: Refs D12607. Fixes T8195. Replace period in the sprintf() arguments with a comma.

Test Plan: Ran `arc diff` in the patch applied, did not get the sprintf() error

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T8195

Differential Revision: https://secure.phabricator.com/D12837
2015-05-14 05:59:44 -07:00
Joshua Spence
f00d4219dd Add a linter rule for incorrect use of parent scope
Summary:
The following code is invalid:

```
final class MyClass {
  public function __construct() {
    parent::__construct(null);
  }
}

$x = new MyClass();
```

Running the above code will produce a fatal error:

```
PHP Fatal error:  Cannot access parent:: when current class scope has no parent
```

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12420
2015-05-14 18:05:14 +10:00
Joshua Spence
a6a26bb3a3 Modernize ArcanistPylintLinter
Summary:
Ref T2039. Convert the `ArcanistPylintLinter` to an `ArcanistExternalLinter` and make it compatible with `.arclint`. In doing so, it was necessary to drop support of older versions of `pylint` by setting the minimum version to be 1.0.0. I think that dropping support for older versions is reasonable because version 1.0.0 was released ~18 months ago. In the case than an incompatible version is detected, an `ArcanistMissingLinterException` is thrown.

One caveat here is that support for `lint.pylint.codes.(error|warning|advice)` is dropped. Any installs that are relying on this configuration will need to migrate to using the `.arclint` file for specifying linter severity. We could potentially continue to support this deprecated configuration, but I'm not sure if this is worthwhile.

Test Plan: Wrote and executed unit tests with `arc unit`. I ran the unit tests on all `pylint` releases after (and including) 1.0.0. Specifically, the tests were run on v1.0.0, v1.1.0, v1.2.0, v1.3.0 and v1.4.0.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9109
2015-05-14 17:58:55 +10:00
Joshua Spence
3ae1fed4f9 Use __CLASS__ instead of hardcoding class names
Summary: Use `__CLASS__` instead of hardcoding class names. Depends on D12804.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12805
2015-05-14 07:21:27 +10:00
Joshua Spence
6295134bc7 Add a linter rule for useless overriding methods
Summary: Ref T7409. Adds `ArcanistXHPASTLinter::LINT_USELESS_OVERRIDING_METHOD` for detecting method which only call their parent method. Based on [[https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php | Generic_Sniffs_CodeAnalysis_UselessOverridingMethodSniff]].

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12419
2015-05-13 21:07:47 +10:00
Joshua Spence
d2b38cdf94 pht all the things
Summary: `pht`ize almost all strings in rARC.

Test Plan: ¯\_(ツ)_/¯

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aurelijus, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12607
2015-05-13 21:00:53 +10:00