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

494 commits

Author SHA1 Message Date
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
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
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
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
epriestley
0a0aa6d718 Restore the --edit workflow somewhat properly. (2)
Summary: summary999

Test Plan: test2

Reviewers:

CC:

Differential Revision: 219938
2011-03-04 16:37:41 -08:00
epriestley
482db3a83c Possible workaround for null 'changes'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-28 11:33:22 -08:00
epriestley
6b2c8c6bbb Fix a couple of warnings raised by HipHop.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-26 20:54:06 -08:00
adonohue
cc8c7d4997 Respect @nolint
Summary:
Respect @nolint annotations

Test Plan:
New "test case"

Differential Revision: 41
Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
2011-02-26 20:54:06 -08:00
epriestley
651f567f96 Improve error messages when trying to parse bad .arcconfig files.
Summary: Haiping is getting a pretty confusing error message when trying to
commit.

Test Plan: Created a mock repository, installed the hook, made commits against
directories with bad .arcconfigs.

Reviewers:

CC:
2011-02-24 16:34:27 -08:00
epriestley
c13147cf53 Stop arc from destroying files under HPHPi.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-24 14:08:49 -08:00
epriestley
309609169d Make arcanist more flexible about SVN base revisions
Summary: When running "arc diff" in a mixed-base-revision working copy, we
prevent the operation. Relax this restriction so that having a different root
revision is okay, so long as all affected files share the same revision. This
facilitates multiple similar edits without updates.

Test Plan: Reverted a file to an older revision in an SVN working copy, ran
"arc diff", was rejected. Applied patch, ran "arc diff", diff went through and
was recorded with the right SVN base revision in the database.

Reviewers:

CC:
2011-02-23 12:06:22 -08:00
epriestley
ed53f98e9e Merge branch 'master' of github.com:facebook/arcanist 2011-02-21 17:00:05 -08:00
epriestley
fe256c59f4 Correctly parse conflicted files out of SVN XML.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-21 16:59:37 -08:00
epriestley
a4d30cc42b Partially restore --edit to stop it from stomping all over everything.
Summary: We sync from local right now, which is fairly terrible. But
fixing this correctly is also not trivial and I don't have the right
primitives yet.

Test Plan:

Reviewers:

CC:
2011-02-19 22:14:53 -08:00
epriestley
5099b005cf Some documentation.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-19 11:36:08 -08:00
epriestley
b50acb5129 Provide a "--conduit-uri" override for testing, and tweak some documentation.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-18 22:17:41 -08:00
epriestley
0eecd3108f Resolve further subtlety with untracked files.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-18 17:08:10 -08:00
epriestley
0ac9b6c27b Merge branch 'master' of github.com:facebook/arcanist 2011-02-18 16:52:52 -08:00
epriestley
c921e20272 Don't send untracked files to lint or unit workflows when running 'arc diff'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-18 16:52:27 -08:00
epriestley
58a2720785 Don't reject commits which fail to trigger any linters.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-17 12:45:15 -08:00
epriestley
a3466fcb6d Prep this for actual production installs.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 23:14:55 -08:00
epriestley
8dc45eac97 Merge branch 'master' of github.com:facebook/arcanist 2011-02-16 21:04:16 -08:00
epriestley
40349b6b26 Basic documentation for ".arcconfig".
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 21:03:32 -08:00
epriestley
e0de194e11 Move this block into a more sensible branch.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 18:49:45 -08:00
epriestley
4b1c4238bc Fix two common points of confusion:
- show "push upstream" instructions after arc amend
	- parse 'diffcamp revision'

Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 18:47:17 -08:00
epriestley
ba6091f945 Add @nocommit and tests to Text linter.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 17:26:51 -08:00
epriestley
2354d544e3 Restore hook configuration in lint unit tests. Make working copy setup an
external.

Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 11:53:34 -08:00
epriestley
2f37912946 Expose the already-functional "--engine" flag for the unit workflow.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 11:53:13 -08:00
epriestley
834b375e47 Improve bash completion for commands like 'arc lint' and 'arc unit'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 11:51:06 -08:00
epriestley
7ef47d3e15 More SVN hook docs.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 10:06:44 -08:00
epriestley
026269a707 Inch toward a defensibly documented project state.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-15 15:10:53 -08:00
epriestley
ca98fc175f Add lint support to 'arc svn-hook-pre-commit'.
Summary: The biggest blocker on getting rid of arc in trunk is that the lint
rules in the commit hooks are still running the old version. Push arc
commit hook support toward some reasonable state of approximately working.

Test Plan:

Reviewers:

CC:
2011-02-15 14:57:24 -08:00
epriestley
d2b5d9108b Provide coverage for the xhpast $a->b->c parsing bug exposed by tautolinting the
codebase.

Summary:

Test Plan:

Reviewers:

CC:
2011-02-13 16:43:32 -08:00
epriestley
b3b2da4608 Fix greediness in Apache License linter.
Summary: The multi-line comment regexp was potentially too greedy. See
"greedy.lint-test".
	- Made it less greedy.
	- Added test coverage.
	- Fixed an issue with the Apache license getting applied with too much
	  whitespace against C files.

Test Plan: Ran unit tests.

Reviewers: aran

CC:

Differential Revision: 36
2011-02-13 16:03:05 -08:00
adonohue
e0bc910dda Tweak license linter to support licenses on line immediately after <?php
Summary:
Tweak license linter to support licenses on line immediately after <?php

Test Plan:
Corrupt an apache license and re-lint twice.

Differential Revision: 34
Reviewed By: epriestley
Reviewers: epriestley
2011-02-11 17:51:55 -08:00
adonohue
f22d74f88d Refactor Apache license linter to parameterize the license itself.
Summary:
Refactor Apache license linter to parameterize the license itself.

Test Plan:
meta

- begin *PUBLIC* platform impact section -
Bugzilla: #
- end platform impact -

Differential Revision: 33
Reviewed By: epriestley
Reviewers: epriestley
2011-02-11 16:36:09 -08:00
epriestley
16db51bc3c Don't try to mark committed when running "arc amend --show". 2011-02-09 09:39:17 -08:00
epriestley
f938293ea8 Make Arcanist understand a phid-based response from
differential.parsecommitmessage.
2011-02-09 09:19:22 -08:00
epriestley
6082b89eb4 Use the '(?P<' syntax instead of '(?<' for capturing named subgroups. 2011-02-09 09:12:21 -08:00
epriestley
4b51720ba1 Tautological expression lint. 2011-02-06 13:04:01 -08:00
epriestley
c97b736a21 Treat empty update message as user abort on 'arc diff' workflow
Summary:
"-m ''" will still let you do a truly empty update if
you are insistent on that.

Test Plan:
meta

Differential Revision: 209194
Reviewed By: dschleimer
Reviewers: dschleimer
CC: epriestley
Revert Plan:
OK
2011-02-04 16:08:53 -08:00
epriestley
89a3606406 Merge branch 'master' of github.com:facebook/arcanist 2011-02-03 16:00:05 -08:00
epriestley
d7219a1619 Add a missing 'static' qualifier. 2011-02-03 15:59:45 -08:00
epriestley
83a0083b3b Improve argument passthru behavior to make added args available to test engines.
Summary:
When you add new arguments to the unit command, they need to be
threaded through to the unit engine. This enables you to specify passthru
command which will be shipped through the callstack.

Test Plan:
Ran 'arc diff --maxtests 8 --apply-patches --trace' and verified
resulting behavior was correct.

Differential Revision: 207877
Reviewed By: dschleimer
Reviewers: dschleimer
CC: dschleimer
Revert Plan:
OK
2011-02-01 20:45:32 -08:00
epriestley
9a699f261a Make change amending explicit in arc lint
Summary:
This should only happen on the 'diff' workflow.

Test Plan:
ran 'arc lint' and didn't get prompted to amend, ran 'arc diff' and got yelled
at for uncommitted changes, committed, ran 'arc diff' and got prompted to amend

Differential Revision: 206696
Reviewed By: adonohue
Reviewers: adonohue
CC: adonohue
Revert Plan:
OK
2011-01-29 17:28:57 -08:00
epriestley
100c55cf45 Make "arc export" work from a local git repo
Summary:

Test Plan:

Reviewers:

CC:
2011-01-29 12:45:37 -08:00
epriestley
9affcb0db2 Expose XHPAST parse tree down the line to other parsers.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-28 15:18:19 -08:00
epriestley
042081b47f Merge branch 'master' of github.com:facebook/arcanist 2011-01-28 11:38:45 -08:00
epriestley
ac7fd22061 Fix a bogus idx() call.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-28 11:37:44 -08:00
epriestley
072833dcb4 Merge branch 'master' of github.com:facebook/arcanist 2011-01-26 17:47:00 -08:00
epriestley
777c69699b Don't apply apache license lint rules if there is no copyright holder. 2011-01-26 17:46:17 -08:00
adonohue
c896d3814f [easy] remove no-op from ArcanistLinter#raiseLintAtPath
Summary:
Remove extra call to getActivePath

Test Plan:
Inspection

Differential Revision: 205579
Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
Revert Plan:
OK
2011-01-26 17:33:35 -08:00
epriestley
d933f20005 Blanket exclude 'externals/' directory from linting in the PhutilLintEngine. 2011-01-26 09:58:16 -08:00
epriestley
d46a138eb0 Don't issue lint about strangely named classes just because they have some
word character in them.
2011-01-26 07:03:52 -08:00
epriestley
210b4fe07d Include CSS and JS in PhutilLintEngine. 2011-01-25 11:32:57 -08:00
epriestley
7f4e6692cd Add ArcanistDiffUtils.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-24 16:48:20 -08:00
epriestley
adef7d4975 Expose diff IDs to post-diff workflows.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-21 16:17:30 -08:00
epriestley
746768e779 Enable PhutilModuleLinter to recover more gracefully from broken modules.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-17 20:18:42 -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
adonohue
026a322dd2 Implement lint check that filename matches only declared interface/class.
Differential Revision: 201593
Reviewed By: epriestley
2011-01-14 15:30:11 -08:00
adonohue
59f48f7901 Disable phutil filename check. To be implemented as a more pervasive check.
Differential Revision: 201587
Reviewed By: epriestley
2011-01-14 15:21:39 -08:00
epriestley
2c4b453757 Correct some references to '--diff-only', now '--preview'.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-13 15:31:37 -08:00
epriestley
50f42aad8d Provide a better error message for 'arc patch' when patches fail.
Summary:
Be more clear about what happened.

Test Plan:
ran 'arc patch' on good/bad patches

Differential Revision: 201085
Reviewed By: adonohue
Reviewers: adonohue
CC: adonohue
Revert Plan:
OK
2011-01-13 13:40:09 -08:00
epriestley
8c73ed915d Fix a typo ish.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-12 17:20:45 -08:00
epriestley
3f13e36182 Update arcanist to use the PhutilSymbolLoader.
Summary: This should also fix the bug with double help for certain commands

Test Plan:

Reviewers:

CC:
2011-01-12 16:02:28 -08:00
epriestley
c8b303bc90 Add SVN pre-commit hook support.
Summary: Basic support for an SVN pre-commit hook. Still very skeletal.

Test Plan:

Reviewers:

CC:
2011-01-12 03:02:05 -08:00
epriestley
7d36705215 Ship unresolved unit test information to Differential.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-11 22:37:06 -08:00
epriestley
bb7e649fa5 Ship lint warnings to Differential.
Summary: Send skipped lint warnings to Differential. This also fixes a nasty
bug with lint excluding too many warnings based on line changes.

Test Plan: meta

Reviewers:

CC:

Differential Revision: 200387
2011-01-11 20:45:36 -08:00
epriestley
964630facc Integrate with file.upload over conduit to ship binary changes to Differential.
Summary: support binary upload in the new arc so we can show image diffs, e.g.

Test Plan:

Reviewers:

CC:
2011-01-11 15:39:40 -08:00
epriestley
e508504ddf Fix an issue in Subversion with a root working copy which is actually a symlink.
Summary: lol svn lol

Test Plan:

Reviewers:

CC:
2011-01-11 14:26:21 -08:00
epriestley
b7ccb78ece Work around an issue with older diffs in the Facebook database.
Summary: We have some diffs which predate property tracking and are shipping
down sketch data, work around it in the client for now.

Test Plan:

Reviewers:

CC:
2011-01-10 14:15:08 -08:00
epriestley
9e77d3b3ba Add --never-apply-patches and --apply-patches to lint.
Summary: These flags let you force the behavior of 'arc lint' instead of
prompting. Also made the amend behavior default to false since I've screwed
this up about 300 times in the mere hours I've been using git as a primary VCS.

Test Plan: ran arc lint with these flags

Reviewers:

CC:
2011-01-10 14:04:51 -08:00
epriestley
f071a55266 Avoid path change collision issue when diffing an unusual edge case out of
svn.

Summary: when you "svn cp" with a revision, we end up with some path collision
problems. This isn't a complete fix but it gets the change to Differential,
at least.

Test Plan:

Reviewers:

CC:
2011-01-10 12:41:58 -08:00
epriestley
10b0a553b4 Improve phutil module linter behavior for vanished modules and missing or
broken __init__.php.

Summary: This allows phutilmodulelinter to generate missing __init__.php and
recover from missing modules without horrible fataltown.

Test Plan:

Reviewers:

CC:
2011-01-10 00:07:58 -08:00
epriestley
12f1ba1d77 Remove XHPAST from arcanist.
Summary: see corresponding commit in libphutil

Test Plan: linted and analyzed both libraries, got more sensible build behavior

Reviewers:

CC:
2011-01-09 22:13:30 -08:00
epriestley
efb8219196 Fix some problems with the module linter that would cause various conflicting
warnings raised in __init__.php to overwrite eachother in uncomfortable ways.
2011-01-09 20:40:31 -08:00
epriestley
2c235bdf38 Fix a couple of lint issues, and update to version 2 (github). 2011-01-09 15:51:04 -08:00
epriestley
2e73916fa2 Initial commit. 2011-01-09 15:22:25 -08:00