Page MenuHomePhabricator

arc linters: Filter by name, make display one-line
ClosedPublic

Authored by avivey on Oct 14 2014, 11:38 PM.
Tags
None
Referenced Files
F13347630: D10706.diff
Sat, Jun 22, 12:16 PM
F13343113: D10706.id28193.diff
Thu, Jun 20, 9:28 PM
F13342842: D10706.id28193.diff
Thu, Jun 20, 6:10 PM
F13308642: D10706.diff
Mon, Jun 10, 5:41 AM
F13299868: D10706.diff
Fri, Jun 7, 8:31 AM
F13262898: D10706.id27085.diff
May 27 2024, 4:49 AM
F13252989: D10706.diff
May 25 2024, 2:17 AM
F13231037: D10706.diff
May 20 2024, 11:50 PM
Subscribers

Details

Summary

allow searching/filtering linters displayed by name.

Test Plan

$ arc linters --verbose --search JSon --search ruby (Lots of text about many linters)
$ arc linters --search JSon ruby (error message)
$ arc linters python (no results, "try --search").
$ arc linters ruby (Verbose text about the "ruby" linter).

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

avivey retitled this revision from to arc linters: Filter by name.
avivey updated this object.
avivey edited the test plan for this revision. (Show Details)
avivey added a reviewer: epriestley.
avivey edited edge metadata.
joshuaspence edited edge metadata.

FWIW, I agree with the idea behind this diff. I would request a couple of minor changes however, although ultimately @epriestley has the final say.

src/workflow/ArcanistLintersWorkflow.php
58–59

This should maybe move to a getAllLinters method.

70–72

I think that this would be better written as:

$search = $this->getArgument('search');

if ($search) {
  $linter_info = $this->filterByNames($linter_info, $search);
}
216–230

A couple of points:

  • I don't think we should use regex matching. I'd prefer to use strpos.
  • The parameters ($linters and $search_terms) should be type-hinted as arrays.
  • I think that filterByNames($linters, array()) should return array() rather than $linters.
This revision now requires changes to proceed.Dec 30 2014, 9:05 AM
joshuaspence edited edge metadata.
avivey edited edge metadata.
  • use stripos
  • test before calling filter()
  • improve doc
  • extract getLintersInfo() out of run()
src/workflow/ArcanistLintersWorkflow.php
58–59

I'm not 100% sold on this, but I gave it a go.

joshuaspence edited edge metadata.

LGTM

src/workflow/ArcanistLintersWorkflow.php
216

These parameters should be type-hinted as you are assuming that they are arrays anyway.

avivey edited edge metadata.

Type-hint

also search full description, so "arc linters python" shows flake8, and "arc linters javascript" shows something.

The search feels a little weird to me as a default. In particular, I don't like that arc linters ruby may return a lot of results and there's no way to return exactly one hit (for example, if I'm debugging over IRC or something). What if we did something like this?

  • Default (non-verbose) output is one linter per line.
  • Arguments must match linter key case-insensitively (e.g., arc linters ruby can get info on a specific linter, even if many linters match "ruby").
  • If you still want it, put search on a --search flag? And have the error say "No linters match query exactly, try --search." or whatever.
  • Maybe arguments imply --verbose?

I don't feel strongly about this, the current signature just feels a little fuzzy and the relatively verbose default behavior of arc linters also doesn't seem especially useful.

epriestley edited edge metadata.

(Just kicking this into your queue for thoughts.)

This revision now requires changes to proceed.Aug 27 2015, 11:13 AM

The primary use-case I was thinking about is "Is there a linter installed that I can use here", so a general search is what I'm after; currently, I'd end up with arc linters | less and grep there. I'd like a --search option, which acts like this change.

I agree with your suggestions, provided we make that one line a little more informative than it currently is (i.e., replace flake8 (Flake8) with flake8 (Comprehensive Python linter) and jshint (JSHint) with jshint (Javascript)). I think I'll do that anyway.

avivey edited edge metadata.
  • Make non-verbose text one-liners
  • Use --search for search
  • make arc linters ruby show only exact match, and be verbose.

Making --search imply --verbose looks a little over-kill.

avivey retitled this revision from arc linters: Filter by name to arc linters: Filter by name, make display one-line.Aug 28 2015, 4:31 AM
avivey edited the test plan for this revision. (Show Details)
avivey edited edge metadata.
epriestley edited edge metadata.
This revision is now accepted and ready to land.Aug 28 2015, 10:26 AM
This revision was automatically updated to reflect the committed changes.