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

2031 commits

Author SHA1 Message Date
epriestley
f1ba27ffed Add "arc diff --draft"
Summary:
Experimental branch. Ref T2543. Depends on D18742.

Add an "arc diff --draft" flag which holds revisions as drafts indefinitely.

Test Plan: Ran "arc diff --draft" when creating; ran "arc diff --draft" to try to update a revision and got a failure.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T2543

Differential Revision: https://secure.phabricator.com/D18743
2017-10-31 09:39:55 -07:00
epriestley
98cc64302e If possible, use "differential.revision.edit" in "arc diff"
Summary:
Depends on D18741. Switches to "differential.revision.edit" if we get a transaction list back from parsing (added by D18740).

This will allow us to use new transactions, notably "Hold as Draft" for "--draft".

Test Plan: Ran `arc diff`, got a revision via `differential.revision.edit`.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18742
2017-10-30 15:19:41 -07:00
epriestley
52992b9550 Rename "arc diff --preview" to "arc diff --only"
Summary:
Experimental branch. Depends on D18739. Ref T2543.

To prepare for `--draft`, consolidate `--preview` and `--only`.

The old `--preview` is now `arc diff --only`.

The old `--only` is now `arc diff --only --nounit --nolint`.

I think this is more clear than other ways we could do it, since the difference between "draft" and "preview" seems less clear than the difference between "draft" and "only".

Test Plan: Ran `arc diff --only` and `arc diff --only --nounit --nolint`.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T2543

Differential Revision: https://secure.phabricator.com/D18740
2017-10-30 15:18:32 -07:00
epriestley
4c4f2e6674 Remove "arc diff --only"
Summary:
Experimental branch. Depends on D18738. Ref T2543.

To prepare for adding `--draft`, clean up some of the flags behaviors.

`--only` currently means `--preview --nolint --nounit`. I'm going to:

  - Remove `--only`.
  - Rename `--preview` to `--only`, since I think `--only` is a better flag for this behavior than `--preview`.
  - If you want the old `--only`, you can `arc alias` it to `arc diff --only --nolint --nounit --browse` or similar.

Test Plan: Grepped for `'only'`, `only`, etc.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T2543

Differential Revision: https://secure.phabricator.com/D18739
2017-10-30 15:17:22 -07:00
epriestley
ccd648b4c4 Remove "arc diff --plan-changes"
Summary: Experimental branch. Ref T2543. To be replaced with "arc diff --draft". Depends on D18737.

Test Plan: Grepped for `plan-changes`.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T2543

Differential Revision: https://secure.phabricator.com/D18738
2017-10-30 15:16:20 -07:00
epriestley
856f79bba5 (experimental) Merge branch 'master' into experimental 2017-10-24 14:06:44 -07:00
epriestley
0989343a4e Correct some lint console renderer issues with files missing trailing newlines
Summary:
See PHI162. This corrects a couple more bugs:

  - If the old file didn't end in a newline, we could end up printing two lines next to each other in the output.
  - If the patch targeted "Line 6, character 1" instead of "line 5, character 3" in a file "1\n2\n3\n4\n5\n", we would fail to figure out what that meant when computing an offset because the last line has 0 characters on it.

Test Plan: Added failing unit tests, made them pass. Also tested with some fake linters similar to the ones described in PHI162.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18716
2017-10-20 10:49:07 -07:00
epriestley
617c2e46d6 Make "line" and "char" strictly optional in ArcanistLintMessage
Summary: See PHI136. These are already optional on the server side in `HarbormasterBuildLintMessage`, and effectively mean "file-level issue", which is a bit niche but not unreasonable.

Test Plan: Checked that `HarbormasterBuildLintMessage` doesn't care if these keys exist, created this revision.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18711
2017-10-17 14:30:31 -07:00
epriestley
76b54ce0a9 Fix parsing of Git branches with common and useful name "0"
Summary: See <https://discourse.phabricator-community.org/t/arc-has-a-spurious-failure-on-arc-diff/521>. Oh, PHP!

Test Plan: Created a branch named "0", ran `arc diff`. Before: fatal. After: this beautiful revision.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18678
2017-10-04 10:20:48 -07:00
epriestley
ba12102eb6 Support automatic "Depends On" detection in Mercurial
Summary: Depends on D18651. Allows Mercurial to auto-detect depends-on revisions.

Test Plan: See D18652 and D18653. Didn't actually test the empty repository states but they're probably okay. The `experimental` branch is an untamed wild. ¯\_(ツ)_/¯

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18654
2017-09-27 10:46:43 -07:00
epriestley
5ddc573223 Make "arc diff" sort of detect dependent revisions
Summary:
Depends on D18645. Fixes T11343. Currently, when you "arc diff", we don't detect dependencies even if your working copy is on top of another open revision you authored.

Use the new Ref/Hardpoint infrastructure from the `experimental` branch to look up the revision associated with the base commit when you run `arc diff`. If it exists and there's exactly one open revision you authored associated with it, add "Depends on ..." to the summary. This is a bit rough but the whole `experimental` branch is a bit of a wilderness for now.

Also remove `--cache` (passthru flag for `arc lint --cache`, which I removed in D18643) and `getUnderlyingWorkingCopyRevision()` (no callsites).

(This won't yet work in Mercurial, and does not make sense in SVN.)

Test Plan: Created this revision, got an auto "depends on" up top there.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T11343

Differential Revision: https://secure.phabricator.com/D18651
2017-09-27 10:46:23 -07:00
epriestley
7af60b07cb Modularize "arc lint" renderers
Summary:
Ref T12996. `arc lint` can render in different formats with `--output <format>`.

Previously, these were a big `switch()` statement and a bunch of hard-coded stuff.

Modularize them so that that third parties could add new renderers, and this code can be refactored toward parallelizing the `lint` step.

This has a small behavioral change: we no longer hide "autofix" messages. I'd like to generally simplify the number of amend/autofix flags here, so this edges us toward that slightly.

Test Plan: Ran `arc lint` with all the `--output` flags in states with warnings and no warnings, saw sensible-seeming behavior.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12996

Differential Revision: https://secure.phabricator.com/D18645
2017-09-27 10:24:19 -07:00
epriestley
a053fcc4d5 Remove "arc lint --only-changed"
Summary:
Ref T12996. See also T9749. This option is the opposite of `--lintall`, and means "don't show warnings on changed lines".

However, it's confusing (and I think no one uses it), and we can reasonably infer what you mean if you give us `--rev`. Simplify this logic a bit and choose the "all / only changed" behavior based on the only sensible thing we can reasonably do given the flags.

As with all the other cruft here, I'm pretty sure this came from FB.

Test Plan: Grepped for `only-changed`, `lintAll`, created this revision.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12996

Differential Revision: https://secure.phabricator.com/D18644
2017-09-27 08:22:23 -07:00
epriestley
be7987b25a Remove "arc lint --cache"
Summary: Ref T12996. This is another half-baked Facebook-specific feature. Clear it out of the way so `arc lint` can be modernized more easily.

Test Plan: Grepped for `cache`, created this revision.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12996

Differential Revision: https://secure.phabricator.com/D18643
2017-09-27 08:21:38 -07:00
epriestley
074dd8f3a6 Remove "arc lint --only-new"
Summary:
Ref T12996. Fixes T9749. This is a very old Facebook-specific thing which relies on other server-side Facebook-specific things and doesn't work properly anyway.

I don't actually remember what the use case for this flag was. It was either "the codebase has a million warnings, so showing warnings on files/lines you touched isn't good enough", or "weird warnings that raise lint on other lines", or some variation of those.

Regardless, I believe this feature benefits at most one install (Facebook circa 2011), and likely zero. It occasionally confuses normal users.

T9749 suggests a possible replacement workflow which is likely more practical, but I'd like to see a real problem description before considering this again.

Test Plan: Created this revision, grepped for `only-new`.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12996, T9749

Differential Revision: https://secure.phabricator.com/D18642
2017-09-27 08:20:58 -07:00
epriestley
3453ef8358 Remove "async lint" from arc lint
Summary: Ref T12996. This was a very old FB-specific feature that caused some kind of server-side lint thing to run. You can/should do this now with Harbormaster instead. Nothing else ever used it and it has no role in the upstream.

Test Plan: Grepped for `asynclint`, created this revision.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12996

Differential Revision: https://secure.phabricator.com/D18641
2017-09-27 08:18:16 -07:00
epriestley
d446517d5e Remove "arc diff --no-diff"
Summary: Ref T12996. See PHI84. This is a remnant from long ago that no longer functions.

Test Plan: Created this revision. Grepped for `no-diff`. Grepped for `diff-result`.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12996

Differential Revision: https://secure.phabricator.com/D18640
2017-09-27 08:17:23 -07:00
epriestley
56e3232c56 (experimental) Merge branch 'master' into experimental 2017-09-27 08:16:31 -07:00
Alex Vandiver
c804c50260 Don't show a blank line if there is no user data
Summary:
SKIP lines, for instance, often have no UserData; there is no
reason to display a content-less blank line.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D18632
2017-09-20 17:54:40 -07:00
epriestley
b836557b12 Correct lint rendering when patching trailing whitespace in files
Summary: Ref PHI48. If a patch removes all of the lines at the end of a file, we can get some array index errors.

Test Plan: Added failing test, made it pass.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18631
2017-09-20 12:07:41 -07:00
Austin McKinley
df81d79d77 Add explicit limits to unit test/lint error names
Summary:
Fixes T12981.

See new `arc lint` output: P2071

See new `arc unit` output: P2072

Test Plan: Ran `arc unit/lint/diff` and observed new error instead of a Conduit error

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12981

Differential Revision: https://secure.phabricator.com/D18603
2017-09-14 12:12:08 -07:00
Austin McKinley
14150123ac Add explicit limits to unit test/lint error names
Summary:
Fixes T12981.

See new `arc lint` output: P2071

See new `arc unit` output: P2072

Test Plan: Ran `arc unit/lint/diff` and observed new error instead of a Conduit error

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12981

Differential Revision: https://secure.phabricator.com/D18603
2017-09-14 11:42:25 -07:00
epriestley
cbc785ddce Fix a similar lint rendering issue when trimming identical lines out of patches
Summary: Ref T9846. See PHI48. See D18538 for a similar fix. We can contract the suffix lines too much if, e.g, a newline after another newline is removed. Prevent contraction to fewer than 0 lines.

Test Plan: Added a failing test, made it pass.

Reviewers: chad

Reviewed By: chad

Subscribers: alexmv

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18541
2017-09-05 17:12:23 -07:00
epriestley
7371277d20 Fix a prefix/suffix counting issue in Arcanist lint rendering
Summary: Ref T9846. See PHI48. For replacing text in the form "ABC" with "ABBC", the trimmer had a bug.

Test Plan: Added failing tests, fixed 'em.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18538
2017-09-05 13:09:46 -07:00
epriestley
d9cb5b18fb Cheat our way through arc version on Windows for the moment
Summary: Fixes T8291. See PHI52. This is papering over the real issue (T8298) but it's a 10-second patch so just improve things slightly for now.

Test Plan: Ran `arc version` locally; patch confirmed on a Windows system by an affected user.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8291

Differential Revision: https://secure.phabricator.com/D18518
2017-09-01 18:06:00 -07:00
epriestley
ad8214456a Restore ANSI highlighting of lint sections to lint output
Summary: Fixes T9846. This restores the last missing feature, ANSI highlighting of diff sections.

Test Plan:
Added a mode so we can actually test this stuff, activated that mode, wrote unit tests.

Did a bunch of actual lint locally too and looked at it, all seemed sane.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18512
2017-08-31 13:29:18 -07:00
epriestley
213ed3ff15 Restore the caret pointer ("^") for lint lines which only have a character offset
Summary: Ref T9846. This was dropped when I refactored how things are rendered; restore it.

Test Plan: Added unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18511
2017-08-31 13:28:47 -07:00
epriestley
86779b1526 Render lint patches which have newlines in a less misleading way
Summary:
Ref T9846. This rewrites the rendering algorithm in a mostly-compatible way and fixes the major issue.

  - Includes test coverage for removing a newline, from T12765.
  - Includes test coverage for mangling an XML tag, from T9846.

This omits two features, which I'll port forward separately:

  - For one-line patches, highlighting the patched section.
  - For zero-line patches, putting a little caret ("^") under the character where the warning occurred.

I'll restore these features in a followup change.

Test Plan: Ran unit tests, linted a few things.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18510
2017-08-31 13:28:31 -07:00
epriestley
be67df6118 Extract and cover the logic for "trimming" a lint message
Summary:
Ref T9846. Sometimes, a lint message says to replace "the big bad wolf" with "the huge bad wolf": that is, the original and replacement text are the same at the beginning, or the end, or both.

To make this easier for humans to understand, we want to just show that "big" is being replaced with "huge", not that the entire phrase is being replaced.

This logic currently happens inline in console rendering. Pull it out and cover it so a future change can simplify console rendering.

Test Plan: Ran unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18509
2017-08-31 13:28:01 -07:00
epriestley
ab0d81bca2 Add basic test coverage for lint console rendering
Summary: Ref T9846. The algorithm here is fairly invovled, so lay down some test coverage before breaking it.

Test Plan: Ran tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9846

Differential Revision: https://secure.phabricator.com/D18508
2017-08-31 13:27:44 -07:00
Alex Vandiver
5eda40337b Fix missing whitespace in arc linters --help message
Test Plan: Ran `arc linters --help`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D18344
2017-08-04 13:12:59 -07:00
Asher Baker
836768bdcc Fix ArcanistPHPCloseTagXHPASTLinterRule always bailing out
Summary:
D13794 changed ArcanistPHPCloseTagXHPASTLinterRule to ignore inline HTML blocks, but selectDescendantsOfType returns an AASTNodeList (which always exists).

Instead, check that the count() of the node list is > 0.

empty.lint-test had to be changed, it wouldn't have been accepted had this rule not been broken before it was commited.

Added tests to cover ArcanistPHPCloseTagXHPASTLinterRule in the future.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D18271
2017-07-22 03:48:37 +01:00
epriestley
7bb8dbabce Reduce the strength of "arc executing on arc" from an error to a warning
Summary:
See PHI13. This was introduced a very, very long time ago in D311 and D312, and I think T168 was the original report.

It prevents `arc` from being used in some semi-reasonable (maybe?) automation workflows where you're hooking some version of "Land Revision" up to `arc land`. This isn't necessarily the right approach, but I think the concession here to make this work is small.

Running `arc` against another copy of `arc` makes `arc unit` not work, but we provide a good error message. Most other `arc` operations still work correctly.

All of these situations are bizarre edge cases but I think we can safely warn and continue here. Even if we revert this behavior later, almost no one should be affected, since this essentially only impacts users developing `arc` itself.

Test Plan: Ran one copy of `arc` against another, saw a warning instead of an error. `arc unit` failed, but with a good error.

Reviewers: chad, jmeador

Reviewed By: jmeador

Differential Revision: https://secure.phabricator.com/D18264
2017-07-21 12:09:59 -07:00
Stephanie Ren
165df12046 Consistently use phutil_console_confirm().
Summary:
`PhutilConsole->confirm()` is vestigial as noted in efcd70c, as
`PhutilConsole` may be deprecated sometime in the future. `PhutilConsole`
was developed as a tool for T4281 but the feature has been removed
since.

Replace existing occurences of the `PhutilConsole->confirm()` pattern with
`phutil_console_confirm()`. There should be no change in functionality
since the two functions are interchangeable.

Test Plan: Manually tested by running `bin/arc lint`, `bin/arc diff --preview`, `bin/arc land --preview`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, alexmv

Differential Revision: https://secure.phabricator.com/D18185
2017-07-06 16:27:36 -07:00
epriestley
c04f141ab0 Remove obsolete "arc land" flags: --update-with-merge/rebase, --delete-remote
Summary:
Fixes T12815. During the last update to "arc land", some flags were disabled but remained in place in case we needed to retain them.

It now seems reasonably clear that we do not. The "rebase" and "merge" strategies for landing were replaced by a better "headless" strategy which seems to avoid the original issues, so these flags no longer do anything or reasonably could do anything.

`--delete-remote` is slightly more ambiguous (e.g., see T12650 and maybe others) but the only real use case is "git push = save changes".

Test Plan:
Ran `arc land --update-with-rebase`, was told the flag does not exist.
Grepped for affected flags/symbols.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12815

Differential Revision: https://secure.phabricator.com/D18108
2017-06-09 08:12:37 -07:00
Alex Vandiver
129d51fa09 If the base commit for arc patch does not exist locally, try to fetch it
Summary:
If the commit does not exist locally, aborting still leaves
the user checked out on the branch.  In nearly all cases, all that is
necessary is a fetch -- but the branch must also be cleaned up.  This
leads to the pattern of:
```
arc patch D12345
[...base commit does not exist...]
^C
git checkout master
git branch -D arcpatch-D12345
git fetch
arc patch D12345
```

Solve this common problem by simply trying to fetch once if the commit does not
exist locally.

Test Plan: Ran `arc patch` on a recent diff.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17949
2017-05-18 13:13:22 -04:00
Hubert Kowalski
3c4735795a Detect trailing spaces and tabs
Summary: Ref T12655 - this change properly detects trailing spaces or tabs (or combinations of thereof) on end of lines.

Test Plan: Use Text lint with trailing whitespace rule on files with spaces, tabs or combinations of thereof. Should properly detect and fix all those.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, Itms

Maniphest Tasks: T12655

Differential Revision: https://secure.phabricator.com/D17814
2017-05-03 03:29:14 -07:00
epriestley
27b51e6192 Fix two minor issues with "arc download"
Summary:
Ref T12651. Ran into these during D17799:

  - Use `getStatusCode()` to put the actual status code into the message.
  - If we fail but wrote an empty file to reserve the filename, clean it up.

Test Plan:
  - Faked the error, `phlog()`'d the exception.
  - Saw sensible exception message.
  - Saw empty file get cleaned up.

Reviewers: chad, amckinley

Reviewed By: chad

Maniphest Tasks: T12651

Differential Revision: https://secure.phabricator.com/D17800
2017-04-28 07:45:25 -07:00
Austin McKinley
5d0f5afca8 Add ArcanistRaggedClassTreeEdgeXHPASTLinterRule to Phutil linter map
Summary: Fixes T12555.

Test Plan:
Added this class to the codebase and ran `arc liberate`:
```
<?php

class FooBar {
    public static function doTheFoo() {
        return 'foobar';
    }
}
```

Ran `arc lint` and observed this warning:
```
   Warning  (XHP87) Class Not `abstract` Or `final`
    This class is neither `final` nor `abstract`, and does not have a
    docblock marking it `@concrete-extensible`.

               1 <?php
               2
    >>>        3 class FooBar {
               4     public static function doTheFoo() {
               5         return "foobar";
               6     }
```

Added a `final` modifier to `FooBar`'s declaration and observed the warning went away.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12555

Differential Revision: https://secure.phabricator.com/D17787
2017-04-25 10:58:21 -07:00
Alex Vandiver
146693307f Make exception reporting from arc be in red
Summary:
Many other status updates (such as "Builds passed!") show up
in bright background colors, making them more salient than a final
fatal "Exception".

Make exception reporting be just as colorful, so it stands out.

Test Plan:
Added an explicit `throw new Exception("!!!")` and saw it
in red.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17748
2017-04-20 15:20:15 -07:00
epriestley
a59cfca5f1 Upgrade "arc upload" to use SHA256
Summary: Fixes T12464. Moves "arc upload" to SHA256 where applicable.

Test Plan: Ran `arc upload` against a server with D17620 twice, saw it skip the actual upload the second time.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12464

Differential Revision: https://secure.phabricator.com/D17622
2017-04-04 16:56:35 -07:00
epriestley
c4e84550fc Allow "arc upload" to work correctly if it can not hash content
Summary:
Ref T12464. This is similar to D17619 and prepares us to move to SHA256 in the client.

Note that it's fine if `arc` and Phabricator disagree about hashing algorithms. We don't really trust the client anyway, so if things are mismatched clients will just end up transferring a bit more data instead of getting to cheat when Phabricator already has copies of data.

Test Plan: Ran `arc upload`, got a clean upload.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12464

Differential Revision: https://secure.phabricator.com/D17621
2017-04-04 16:24:27 -07:00
epriestley
82b7cd778a Make "arc download" use "file.search" if available
Summary: Fixes T8348. Just use normal HTTP GET to download files if the server is sufficiently modern.

Test Plan: Downloaded various files with `--as`, `--show`, large files, small files, old server, new server.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8348

Differential Revision: https://secure.phabricator.com/D17614
2017-04-04 16:16:11 -07:00
Jon Parise
d1db9a72b5 Improve the flake8 line-matching regex
Summary:
Because the character offset group is optional, the logic for dealing
with the previous index-based match object was more complex than it
needs to be. Switching to named groups makes this clearer.

As an example of how this was causing a problem, when the character
group *was* present (at index 3), it was being appending to the linter's
name in the call to ->setName(), resulting in confusing linter output.
We may have also been setting the character offset to the error code's
string, too, which is further nonsense.

Because we reliably capture the flake8 error code, I don't think there's
a need to append it to the linter's name at all now, so I removed that
part (so it's always just `flake8`), but it's not a problem to restore.

Lastly, I hoisted `$regex` out of the loop because it's a constant and
de-indenting it gave me enough room to continuing writing it all on one
line.

Test Plan: Tested primarily with flake8 3.3.0

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17552
2017-03-24 09:19:06 -07:00
Jakub Vrana
3b6b523c2b Fix errors found by PHPStan
Test Plan: None.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17376
2017-02-18 09:24:19 +00:00
epriestley
dc65bfbe54 Put a Phage skeleton command on the Arcanist experimental branch
Summary:
Ref T2794. This doesn't do anything useful, but since I'm planning to start using this stuff to do real deployments I don't want to lose it if my laptop gets hit by a bus.

This just adds a skeletal `bin/phage` with enough code that I can add actual workflows to Phacility repositories and get `bin/phage remote --hosts ...` working without the code only existing on my laptop.

Test Plan: Ran `bin/phage`, saw nothin'.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2794

Differential Revision: https://secure.phabricator.com/D17379
2017-02-17 16:58:13 -08:00
Jakub Vrana
d0353d2381 Fix errors found by PHPStan
Test Plan:
Ran `phpstan analyze -a autoload.php arcanist/src` with `autoload.php` containing:

  <?php
  require_once 'libphutil/src/__phutil_library_init__.php';
  require_once 'arcanist/src/__phutil_library_init__.php';

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17367
2017-02-16 13:54:43 +00:00
epriestley
460b0e46ee Fix a property name collision in ArcanistHgServerChannel
Summary:
See D2665. Here, `channel` is the Mercurial wire protocol channel name ("o" = "output", "e" = "error", etc), not the underlying channel from `PhutilProxyChannel`.

Rename the property so there's no collision.

Test Plan:
```
$ ../../core/lib/arcanist/scripts/hgdaemon/hgdaemon_client.php . --trace --skip-hello
array(3) {
  [0]=>
  int(0)
  [1]=>
  string(103) "capabilities: getencoding runcommand
encoding: UTF-8
pid: 73263e20cf21273d50f1f66cab6e0f7c74f4864e67f0f"
  [2]=>
  string(0) ""
}

Executed in 30647 us.
```

Reviewers: vrana, chad

Reviewed By: vrana

Differential Revision: https://secure.phabricator.com/D17366
2017-02-16 05:44:10 -08:00
Aviv Eyal
13596cd10f Add back pht()s and tsprintf()s to arg set-config
Summary: See D17357

Test Plan: invoke and still see output in English?

Reviewers: #blessed_reviewers, joshuaspence, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17362
2017-02-16 11:08:45 +00:00
Aviv Eyal
bc9b70508e arc set-config: warn about unknown keys
Summary: See T12266. Warn when the user tries to set a value we will probably not read.

Test Plan: `arc set-config foo bar`, see fancy warning.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D17357
2017-02-15 13:38:57 +00:00