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

25 commits

Author SHA1 Message Date
epriestley
50dfc9cc41 [Wilds] Update "arc shell-complete" for toolsets
Summary:
Ref T13098. Major changes:

`arc shell-complete` now installs itself to your `~/.profile`. Running `arc shell-complete` again will update the hook and update the completion rules.

Completion rules work for all toolsets, so you can install once and then autocomplete in `arc`, `phage`, etc.

This code supports other shells in theory, and I developed most of it with ZSH support next to the Bash support. However, while actually testing ZSH support, I couldn't get it to even slightly work and found myself falling down a very, very deep rabbit hole of ZSH being entirely written in bash script and `${0🅰️h}` being a legitimate script construction. The existing ZSH support comes from one guy in 2012 and also does not work for me on `master`, so I ultimately removed it. Open to restoring it but I wasn't able to figure it out in 10 minutes of Googling and I'm not convinced it's worth 11 minutes of Googling.

I left a few rough edges here with notes on how to improve/fix them, but the basics all work.

Test Plan:
- Ran `arc shell-complete` under various stages of `~/.profile`, couldn't get it to do anything bad.
- Ran `arc lib<tab>`, `arc shell-complete --curr<tab>`, etc. Got sensible suggestions and completions.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13098

Differential Revision: https://secure.phabricator.com/D19700
2018-09-25 16:02:13 -07:00
epriestley
c05bbd7be6 [Wilds] Allow "arc liberate" to liberate itself again
Summary:
Ref T13098. After libphutil/ and arcanist/ merged, some paths need to be adjusted. Try to organize things a little better, too.

Also, make `arc liberate` with no arguments just liberate all the libraries it can find.

Test Plan: Ran `arc liberate` and got a valid map rebuild, although I needed to apply some hacks on top of this to make the workflow reachable.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13098

Differential Revision: https://secure.phabricator.com/D19690
2018-09-21 16:50:58 -07:00
epriestley
8e0e07664a [Wilds] Remove libphutil
Summary:
Ref T13098. Historically, Phabricator was split into three parts:

  - Phabricator, the server.
  - Arcanist, the client.
  - libphutil, libraries shared between the client and server.

One imagined use case for this was that `libphutil` might become a general-purpose library that other projects would use.

However, this didn't really happen, and it seems unlikely to at this point: Phabricator has become a relatively more sophisticated application platform; we didn't end up seeing or encouraging much custom development; what custom development there is basically embraces all of Phabricator since there are huge advantages to doing so; and a general "open source is awful" sort of factor here in the sense that open source users often don't have goals well aligned to our goals.

Turning "arc" into a client platform and building package management solidify us in this direction of being a standalone platform, not a standalone utility library.

Phabricator also depends on `arcanist/`. If it didn't, there would be a small advantage to saying "shared code + client for client, shared code + server for server", but there's no such distinction and it seems unlikely that one will ever exist. Even if it did, I think this has little value.

Nowadays, I think this separation has no advantages for us and one significant cost: it makes installing `arcanist` more difficult for end-users.

This will need some more finesssing (Phabricator will need some changes for compatibility, and a lot of stuff that still says "libphutil" or "phutil" may eventually want to say "arcanist"), and some stuff (like xhpast) is probably straight-up broken right now and needs some tweaking, but I don't anticipate any major issues here. There was never anything particularly magical about libphutil as a separate standalone library.

Test Plan: Ran `arc`, it gets about as far as it did before.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13098

Differential Revision: https://secure.phabricator.com/D19688
2018-09-21 16:38:53 -07:00
epriestley
2372863517 Add some more spelling corrections to Spelling linter
Summary: Fixes T6773. See also the shameful `PhabricatorDestructableInterface` debacle.

Test Plan: go go dictionary power

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T6773

Differential Revision: https://secure.phabricator.com/D11033
2014-12-22 16:08:02 -08:00
Joshua Spence
7de6549338 Move PhutilLibraryMapBuilder to libphutil
Summary: See D9813 for a detailed explanation.

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

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

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

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

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9805
2014-07-04 08:18:33 +10:00
Joshua Spence
2f3e5e48ef Read extension classes and functions from php_compat_info.json.
Summary: Consolidate `php_extension_classes.txt` and `php_extension_functions.txt` with `php_compat_info.json`. Given that `php_extension_classes.txt` and `php_extension_functions.txt` are manually generated whereas `php_compat_info.json` is generated automatically, this should make maintenance easier.

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

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

Test Plan: Fixed up and ran unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5385

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

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

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

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

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

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

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5377

Differential Revision: https://secure.phabricator.com/D9568
2014-06-17 00:30:16 +10:00
Joshua Spence
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
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
epriestley
b6ccfd4ef5 Add some example .arclint files to un-lie the pending documentation
Summary: Ref T2039. Provide some examples to help users figure out how to write these things.

Test Plan: Checked them with `jsonlint`.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9065
2014-05-11 20:22:57 -07:00
Joshua Spence
9fbf316d38 Various linter fixes
Summary:
Fixed various linter issues that were identified by running `arc lint --everything`.

- Removed trailing whitespace.
- Added newline at EOF.
- Added whitespace after `if` statement

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: aurelijus, Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D8337
2014-02-25 07:53:07 -08:00
Jakub Vrana
eb449a40b4 Update PHP compat info
Summary: Also warn against functions not available on Windows at all.

Test Plan: Compared old and new file.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5975
2013-05-22 11:36:41 -07:00
vrana
66d204be81 Delete license headers from files
Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).

We are removing the headers for these reasons:

- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.

This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).

Test Plan: Verified that the license survived only in unit tests and LICENSE file.

Reviewers: epriestley, btrahan, edward

Reviewed By: epriestley

CC: aran, Korvin, davidrecordon

Maniphest Tasks: T2035

Differential Revision: https://secure.phabricator.com/D3881
2012-11-05 11:16:24 -08:00
vrana
c8687a0c79 Lint functions not available on Windows on PHP 5.2
Summary: Also use absolute paths.

Test Plan: Linted Arcanist, libphutil, Phabricator, found no false positives and one real error in [[ https://secure.phabricator.com/diffusion/PHU/browse/master/src/channel/PhutilSocketChannel.php;42d8e8447c8b5d6a$92 | PhutilSocketChannel ]].

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3504
2012-09-17 13:51:06 -07:00
vrana
67c772d919 Warn about PHP 5.3 only functions and parameters
Test Plan:
Linted:

  json_decode('{}', true, 1, 1);
  gethostname();

Also linted all Phabricator repositories and found no occurrence.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1158

Differential Revision: https://secure.phabricator.com/D2806
2012-06-22 15:52:10 -07:00
epriestley
81976ff2ff Provide a simpler analyzer script for killing __init__.php
Summary:
The `phutil_analyzer.php` script currently analyzes entire modules and is fairly complex. We don't need or want this in a post-__init__.php world.

This is basically a simplified version of `phutil_analyzer.php`, which takes one file and emits symbols.

Test Plan:
```$ ./scripts/phutil_symbols.php resources/test/diverse_symbols.php
{
  "have" : {
    "function"  : {
      "f" : 348
    },
    "class"     : {
      "L"      : 308,
      "A"      : 497,
      "C"      : 509,
      "D"      : 531,
      "CLocal" : 627
    },
    "interface" : {
      "ILocal" : 593
    }
  },
  "need" : {
    "function"  : {
      "g" : 402,
      "h" : 462
    },
    "class"     : {
      "B"         : 519,
      "INonlocal" : 642,
      "U"         : 552,
      "X"         : 421,
      "V"         : 557,
      "W"         : 565,
      "P"         : 572
    },
    "interface" : {
      "IForeign" : 608
    }
  }
}```

Reviewers: vrana, nh, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1103

Differential Revision: https://secure.phabricator.com/D2561
2012-05-24 10:56:56 -07:00
epriestley
587368e9ea Remove git commit template from Arcanist
Summary: Out of date an no longer referenced.

Test Plan: Grepped for references.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D2387
2012-05-07 06:06:53 -07:00
Mark Lewandowski
0c7c52381d Add support for zsh completion to bash-completion 2012-01-09 11:52:51 -08:00
Chris Piro
2a78b2bffa bash completion: work around PHP CLI readline in command substitution
Summary: (At least my build of) PHP tries to do readline magic on the terminal
when invoked from the shell, even inside bash's command substitution operator.
Work around it by piping the output of ##echo## to ##php##, so the input isn't a
terminal.

Test Plan: ##bash$ arc li<TAB>## now gives me possible completions rather than
breaking and inserting a literal tab

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1096
2011-11-09 16:53:46 -08:00
epriestley
4818892841 Basic 'shell-complete' workflow.
Summary:
Adds data-driven shell completion help to arcanist.

Test Plan:
ran various commands in git and svn working copies,
output seemed reasonable

Differential Revision: 201754
Reviewed By: adonohue
Reviewers: mroch, adonohue
Commenters: crackerjack
CC: epriestley, adonohue, achao
Revert Plan:
OK
2011-01-17 20:18:27 -08:00
epriestley
7d54ecb885 Provide a git commit template.
Summary: adds a Differential-suitable git commit template.

Test Plan: meta

Reviewers:

CC:
2011-01-09 20:42:37 -08:00