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

1241 commits

Author SHA1 Message Date
Andrew Gallagher
399c505f1a arc lint: fix/enable PEP8 linter
Summary:
This diff:
- Adds the PEP8 linter to the externals directory
- Changes the path for finding pep8.py
- Removes use of execx since pep8.py return an errors code
  when it finds PEP8 violations

Test Plan:
tested linting python code

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley
Differential Revision: 309
2011-05-18 16:47:23 -07:00
Adam Simpkins
10bdc77f96 arc diff: --only doesn't conflict with --nounit or --nolint
Summary:
The --only flag implies --nounit and --nolint, so there's really no
conflict if these flags are specified together.

(My wrapper around arc diff automatically specifies --nounit in some
cases.  It is useful to be able to manually add --only in some cases,
and not have it fail because it conflicts with the automatically
specified --nounit flag.)

Test Plan:
Ran "arc diff --only --nounit".

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley, simpkins
Differential Revision: 298
2011-05-17 13:08:21 -07:00
Adam Simpkins
952fa69f72 lint: fail early if no lint engine is defined
Summary:
Update the lint workflow to exit immediately it there is no lint engine
configured.  Previously it scanned the repository to find the paths to
check before failing in this case.  Scanning the repository can be
relatively slow on large repositories.

Test Plan:
Ran "arc lint" in a large repository with no lint engine configured.
Verified that it failed quickly, without scanning the repository first.

Reviewed By: jungejason
Reviewers: jungejason, epriestley
CC: aran, jungejason
Differential Revision: 297
2011-05-17 12:59:49 -07:00
epriestley
3a559ddd13 'arc liberate', convenience wrapper for various libphutil operations
Summary:
The story for creating and maintaining libphutil libraries and modules
is pretty terrible right now: you need to know a bunch of secret scripts and
dark magic. Provide 'arc liberate' which endeavors to always do the right thing
and put a library in the correct state.

Test Plan:
Ran liberate on libphutil, arcanist, phabricator; created new
libphutil libraries, added classes to them, liberated everything, introduced
errors etc and liberated that stuff, nothing was obviously broken in a terrible
way..?

Reviewed By: aran
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, epriestley
Differential Revision: 269
2011-05-17 09:53:19 -07:00
epriestley
ade681e0db Update arcanist to use PhutilServiceProfiler.
Summary:
Switch to the new PhutilServiceProfiler API.

Test Plan:
Ran "arc" with "--trace", got mostly reasonable output. I'll clean up conduit
output in a followup.

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran
Differential Revision: 292
2011-05-16 17:09:54 -07:00
epriestley
3edd525f83 Stop undeclared variable warning for $obj->{$prop} syntax
Summary:
This isn't necessarily a root-cause solution but this syntax is really really
bad. If we want to fix the root cause, I'd recommend making its use a lint
error?

Test Plan:
Unit tests failed before patch, passed afterward.

Reviewed By: aran
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran
Differential Revision: 270
2011-05-11 22:06:03 -07:00
epriestley
23afdb99f0 Allow ArcanistLinter to load files not directly affected by lint
Summary:
This is necessary for the Javelin linters. The libphutil and flib linters do it
implicitly, so there's no real tradeoff here.

Test Plan:
Ran javelin linters.

Reviewed By: tuomaspelkonen
Reviewers: tomo, aran, jungejason, tuomaspelkonen
CC: aran, tuomaspelkonen, epriestley
Differential Revision: 238
2011-05-08 01:43:49 -07:00
epriestley
71d233410b mark remote hooks 2011-05-06 15:35:07 -07:00
epriestley
caed8a2830 Restore "arc patch D12345" syntax
Summary:
I only dropped this because it's slightly inconvient to accommodate, but
empirically it's pretty confusing to users (who often use --diff 12345 when they
mean --revision 12345).

Test Plan:
Ran "arc patch D45", "arc patch --revision 45", "arc help patch"

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
CC: aran, tuomaspelkonen
Differential Revision: 241
2011-05-06 12:40:16 -07:00
epriestley
1fdead8c20 Provide 'arc call-conduit' to facilitate script integration with Phabricator
Summary:
Provide a formal mechanism for making conduit calls from other scripts.

Test Plan:
Called 'conduit.ping'.

Reviewed By: jungejason
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran, jungejason
Differential Revision: 239
2011-05-06 11:56:21 -07:00
jungejason
8f59aff31a Make the rule for applying git diff less restrict
Summary:
the current command to apply a git diff is 'git apply --index',
which will fail the whole patch and does not touch the working tree when
some of the hunks do not apply. We want to allow the user to patch the
ones which apply.

Test Plan:
run 'arc apply' against a diff whcih partially applies and
verify that the hunks which apply are applied, and .rej files are
generated for the rest.

Reviewed By: simpkins
Reviewers: simpkins, epriestley
Commenters: ju
CC: aran, slawekbiel, simpkins, ju
Differential Revision: 235
2011-05-05 20:33:23 -07:00
jungejason
64ecf63680 init invest 2011-05-03 23:33:21 -07:00
tuomaspelkonen
e04ea5c7d8 Added 'edit' field to 'getcommitmessage' conduit calls.
Summary:
Server log was showing errors for undefined index 'edit'.

Test Plan:
arc lint

Reviewed By: jungejason
Reviewers: jungejason, grglr
Commenters: grglr
CC: aran, epriestley, grglr, jungejason, tuomaspelkonen
Differential Revision: 217
2011-05-03 11:26:01 -07:00
epriestley
17ac4d9ab1 Provide setup/teardown hooks for ArcanistPhutilTestCase
Summary:
I'm making a move on Lisk stubbability and need these so I can set up
Lisk isolation unconditionally in Phabricator tests. Also document and organize
this class.

Test Plan:
Changed the expected counts in the meta-tests and got failures. Ran
all unit tests.

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran
Differential Revision: 192
2011-04-30 12:04:11 -07:00
slawekbiel
d70e5db39e Aggregate display of postponed tests
Summary:
Displaying each postponed test separately was spammy.
Now it will only display a single line with the total count

Test Plan:
~/local/arcanist/bin/arc unit --sandcastle-tests
35 tests to run.
Completed 'ParentInfoTestCase.php'
Interrupted 'MentionsUntagTestCase.php'
    PASS  ParentInfoTestCase
  POSTPONED  34 tests

Reviewed By: sgrimm
Reviewers: jungejason, sgrimm
CC: sgrimm
Revert Plan:
sure

Other Notes:

Differential Revision: 173
2011-04-28 12:05:00 -07:00
slawekbiel
8332d86ad2 add short option for fetching git revision hash
Summary:
Sometimes we need to show abbreviated hashes, passing --short is more
reliable than substring of fixed number of characters.

Test Plan:
- called with and without the parameter, got correct results
           -

Reviewed By: jungejason
Reviewers: jungejason
CC: jungejason
Revert Plan:
sure

Other Notes:

Differential Revision: 170
2011-04-27 15:26:20 -07:00
epriestley
8ffba323ea Stop this from failing on directories, etc.; u-u-u-u-ultra clown. 2011-04-11 16:13:22 -07:00
epriestley
c00da5bf4f Load more context for lint only if the files actually exist. 2011-04-11 14:54:17 -07:00
tuomaspelkonen
d67a081243 Arc cover handles a file that is added and modified correctly.
Summary:
Modifying a new file and running 'arc cover' before committing the
modifications confused arc. The problem was that 'unstaged' status
erased 'added' status and this caused problems.

Test Plan:
Tested that arc cover ignores added files when they are modified, but
old files that are modified are still handled correctly by arc cover.

Reviewed By: epriestley
Reviewers: epriestley
CC: jungejason, epriestley
Differential Revision: 122
2011-04-11 14:08:54 -07:00
epriestley
2cf1393219 Load files which we don't directly examine, since there are some common cases
where we either generate an entire file or an external script examines it.
2011-04-10 16:05:44 -07:00
epriestley
d87fda8561 Improve workflow for missing certificates. 2011-04-10 13:09:47 -07:00
adonohue
0472a5ff95 Improve lint rendering
Summary:
Declare victory like it's the United States.

Test Plan:
www copyright, apache copyright, control keyword whitespace and trailing
whitespace lint warnings

Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
Differential Revision: 117
2011-04-08 19:18:34 -07:00
epriestley
b1acee6ee5 Fix repository UUID parsing. 2011-04-05 22:27:32 -07:00
epriestley
ceb8a42003 Ship up repository UUIDs with diffs. 2011-04-05 21:09:59 -07:00
epriestley
1139eb1a73 Correctly detect uncommitted files in Git
Summary:
I simplified this code at some point and broke it horribly
in the process. Mask in the right flag here and combine the maps
correctly. This solves the great mystery of increased developer
clowniness.

Test Plan:
Ran 'arc diff' in a working copy with staged but
uncommitted files, got an error message (previously, I didn't).

Reviewed By: aran
Reviewers: mroch, aran
CC: aran
Differential Revision: 104
2011-04-05 21:08:55 -07:00
jungejason
1dd69bdbee Improve 'arc' error message when failing to load a library
Summary:
display better message about the .arcconfig. The message will
be something like this now:
  Usage Exception: Failed to load library "phabricator" at location
  "srcaaaaa/". Please check the "phutil_libraries" setting in your
  .arcconfig file. Refer to page
  http://phabricator.com/docs/arcanist/article/Setting_Up_.arcconfig.html
  for more info.

Test Plan:
modify the .arcconfig file to test it. Also make sure it
works for correct settings.

Reviewed By: epriestley
Reviewers: epriestley
CC: jungejason, epriestley
Differential Revision: 99
2011-04-04 16:44:09 -07:00
Aran Donohue
76c45a74f3 JSON output for Lint
Summary:
Refactor ArcanistLintRenderer into three independent classes, and let
the Workflow select between them based on its 'output' parameter.

Test Plan:
Introduce a Lint warning and lint with no --output, with --output summary and
with --output JSON.

Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Differential Revision: 96
2011-04-04 10:07:06 -07:00
epriestley
4bce8732e5 Expand ArcanistDiffParser to accept awkward Diffusion + SVN workflows. 2011-03-30 19:33:50 -07:00
epriestley
11e25f5840 Add an empty file lint test. 2011-03-22 20:51:45 -07:00
epriestley
b8e7e9017a Special case ArcanistTextLinter for completely empty files. 2011-03-22 11:09:28 -07:00
slawekbiel
aa44db2f96 [Adding postpone status for unittests]
Summary:
That's for the tests that will be run asynchronously.

Test Plan:
run arc unit with some tests that returned postponed status - they showed up.
Background was yellow.

Reviewed By: epriestley
CC: epriestley
Revert Plan:
sure

Other Notes:

Differential Revision: 77
2011-03-21 19:11:58 -07:00
jungejason
51b371481b Improve the error message for ERR-NO-CERTIFICATE
Summary:
list the hosts for which the .arcrc file have certificate and
which conduit-uri the user is trying to access.

Test Plan:
test the case where a cert is missing.

Reviewed By: epriestley
CC: epriestley
Differential Revision: 76
2011-03-21 16:40:57 -07:00
epriestley
bdde006484 Detect SVN 1.6 "tree-conflicts". 2011-03-20 15:06:55 -07:00
epriestley
efcd70c2d7 Use phutil_console_confirm() correctly, not vestigal $this->confirm().
Summary:

Test Plan:
$ arc patch --diff 553961

    Patch deletes file 'html/miniprofile.php', but the file does not exist in
    the working copy. Continue anyway? [y/N] y

    Patch deletes file 'html/index.php', but the file does not exist in the
    working copy. Continue anyway? [y/N] y

 OKAY  Successfully applied patch to the working copy.

Reviewers:

CC:
2011-03-19 12:16:47 -07:00
epriestley
b7be6dbf32 Fix symbol reference in arcconfig.diviner (thanks, jason!) 2011-03-17 19:19:31 -07:00
epriestley
9b6e8aa6e1 Resolve paths when running "--lintall"
Summary: this was all kinds of fail when running from a subdirectory or on
invalid paths. Detect nonexistent paths; resolve valid paths.

Test Plan: ran "arc lint --lintall" on a file from a subdirectory, and on a
file which did not exist. Received patches and an error, respectively

Reviewers: arudolph

CC:

Differential Revision: 72
2011-03-15 18:59:48 -07:00
epriestley
eb58ed1b8b asukhachev's patch for 'arc amend' not being overeager. 2011-03-14 17:39:12 -07:00
epriestley
628de7d7a1 Make all the working-copy-paths errors extremely explicit. 2011-03-12 18:23:52 -08:00
epriestley
982e482290 Make some UI things less confusing and reduce the amount of horrific torture
that arc apparently inflicts upon users.

Summary:

Test Plan: .

Reviewers:

CC:

Differential Revision: 223104
2011-03-12 17:59:15 -08:00
epriestley
fd19dfaebc Detect use of "+" on a string literal in PHP.
Summary:
This is realistically always wrong and the author means "."

Test Plan:
lint / unit

Reviewed By: crackerjack
Reviewers: crackerjack, aran
CC: crackerjack
Differential Revision: 68
2011-03-10 15:15:45 -08:00
epriestley
692d2a8b6f Arcanist: Apply symlink patches correctly
Summary:
When an arcbundle includes a symlink, we fail to apply it correctly
when applying to a subversion working copy.

Test Plan:
created a diff which added a symlink, removed it locally, bundled
and applied the patch, got a good symlink out

Reviewed By: aran
Reviewers: aran
CC: epriestley, aran
Differential Revision: 63
2011-03-09 00:47:01 -08:00
epriestley
12aa487790 Merge branch 'patch' 2011-03-07 22:09:11 -08:00
epriestley
02627b1762 Fix 'arc patch' when adding files in new directories
Summary:
If you apply an arcbundle to a subversion working copy which adds
files in new subdirectories, we fail to create and add the parent directories
so the whole operation fails. Make sure we create and add any missing parent
directories before apply patches.

Test Plan:
Applied Facebook diff #542056 to www@rE349795 cleanly, while it
failed previously.

Reviewed By: aran
Reviewers: aran
CC: aran
Differential Revision: 62
2011-03-07 22:09:02 -08:00
epriestley
66099afd91 Merge branch 'master' of github.com:facebook/arcanist 2011-03-07 22:04:29 -08:00
epriestley
f794418ba9 Arcanist: parse SVN "replaced" status
Summary:
SVN has a special 'replaced' status which was not being parsed
correctly. Parse it correctly.

Test Plan:
Replaced a file, ran arc diff, got a sensible diff.

Reviewed By: aran
Reviewers: aran
CC: aran
Differential Revision: 60
2011-03-07 22:04:22 -08:00
epriestley
b891519d3d Merge branch 'master' of github.com:facebook/arcanist 2011-03-07 20:21:09 -08:00
epriestley
0eba67ce9f Get rid of explicit timezone silliness.
Summary:

Test Plan:

Reviewers:

CC:
2011-03-07 20:20:48 -08:00
epriestley
71016a09f8 Explicitly use "--format=medium" when running 'git log'
Summary:
Git (the world's hardest revision control system) allows you to change
output formats by accident and/or without your direct knowledge. Protect users
from themselves.

Test Plan:
Changed "pretty" in [format] to "format:quack" so every log just
outputs the word "quack". Ran "arc diff" successfully.

Reviewed By: aran
Reviewers: aran
CC: epriestley, aran
Differential Revision: 56
2011-03-07 16:13:06 -08:00
epriestley
4b30319747 Make XHPAST parse-depth warning an actual warning.
Summary:
XHPAST encounters a parse-depth problem on some files because PHP
5.2 has an un-overridable parse depth limit for JSON. The text of this error
says it is a "warning" but we currently raise an error. Make it a warning
instead.

The JSON depth is 20 until PHP 5.2.3, where it becomes 128. After PHP 5.3
it defaults to 512 and is user-configurable, which will allow us to resolve
this issue in nearly all cases.

Since I made if/else express as a list in the AST, this only actually arises
in long binary chains, most commonly string concatenation, like:

  $out = 'a'.'a'.'a'.'a'...

...where each string is a variable or HTML tag and the program is constructing
a complicated document.

At some point I'll add some PHP 5.3 massaging to the XHPAST decoder itself to
raise this limit to something more huge.

Test Plan:
Ran "arc lint --lintall" on a file with a very deep binary
expression tree ("1 + 1 + 1 ...") and received a warning instead of an error.

Reviewed By: aran
Reviewers: pad, aran
CC: epriestley, aran
Differential Revision: 54
2011-03-07 11:44:11 -08:00
epriestley
61e16d9cc3 Fix issue with svn-hook-pre-commit when resolving .arcconfig for nested
directories

Summary:
If you had changes to a directory covered by a .arcconfig residing
inside another directory also covered by an .arcconfig, the hook would
incorrectly attribute the first file it attempted to resolve to the topmost
.arcconfig because it failed to break out of the loop after resolving it.

All other files would be correctly attributed, because they'd hit the cache.

Test Plan:
Created an svn repository and checked it out locally. Created a
structure like this:

  .arcconfig
  shallow
  a/
   b/
    c/
     .arcconfig
     d/
      deep
      deep2
      deep3

Made modifications to "deep", "deep2", and "deep3". Received an error message
about multiple .arcconfig changes, attributing one file to the topmost
arcconfig and the other two to the deeper one.

Applied patch.

Commit now goes through. Made a commit affecting 'shallow' and 'deep' and
'deep2', commit was correctly blocked and files were attributed to the
corresponding .arcconfigs.

Reviewed By: mroch
Reviewers: mroch
CC: mroch
Differential Revision: 50
2011-03-05 00:49:52 -08:00