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
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
Summary: Ref T4725.
Test Plan: add some files that have unsupported constructs all over the place and run `arc liberate`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Maniphest Tasks: T4725
Differential Revision: https://secure.phabricator.com/D9585
Summary: Depends on D9586. The progress bar is written to stderr which results in bad stuff happening when you try run `lint` (`PhutilLibraryLinter` calls it)
Test Plan: run `arc lint`, see no more errors
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D9587
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
Summary: .. Instead of dots that are hard to count.
Test Plan: remove `.phutil_module_cache` and do `arc liberate`
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D9584
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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