Commit Graph

87 Commits

Author SHA1 Message Date
Joshua Clayton
2d65555b60 Wrap cursor management into one function 2016-05-15 16:14:40 -04:00
Joshua Clayton
233f83bdf8 Have withInterruptHandler be more transparent 2016-05-15 16:02:21 -04:00
Joshua Clayton
790b62c999 Render base header as soon as we have tokens 2016-05-15 08:35:27 -04:00
Joshua Clayton
e70a7e4e0b Move line handling to occur when binding to results 2016-05-15 08:05:41 -04:00
Joshua Clayton
0e966c9302 Test Util.groupBy 2016-05-15 05:53:29 -04:00
Joshua Clayton
97f083fc2c Use regex in ag for simple words
Why?
====

ag supports using regular expressions for searches; however, the -Q
flag, which was previously always used, resulted in literal search
results.

By searching literal matches, it would potentially return too many
results. For example, with a `me` method in a controller, it'd match
words like `awesome` or `method`.

This introduces a check where, if the token being searched is only
composed of word characters (`[A-Za-z0-9_]`), it'll switch over to use
regular expressions with ag and surround the token with non-word matches
on either end. The goal here is to reduce false-positives in matches.
2016-05-14 08:14:54 -04:00
Joshua Clayton
3851c98d59 Initial Haskell support for allowed tokens
This is based off of tags generated by Hasktags:

https://hackage.haskell.org/package/hasktags
2016-05-14 06:37:48 -04:00
Joshua Clayton
bcbc1b6462 Allow search result grouping
Why?
====

Grouping results can be helpful to view information differently, e.g. to
see highest-offending files or to remove grouping entirely.

This introduces a flag to allow overriding the default group (two levels
of directory)
2016-05-14 06:36:01 -04:00
Joshua Clayton
a8a9d250e3 Parallelize search
Why?
====

Searching hundreds or thousands of tokens with ag can be slow; this
introduces parallel processing of search so results are returned more
quickly.
2016-05-13 14:46:23 -04:00
Joshua Clayton
bbb178f7d5 Extract ioOps calculation 2016-05-13 14:44:03 -04:00
Joshua Clayton
2ec73ac3b3 Consolidate progress indicator handling 2016-05-13 14:18:23 -04:00
Joshua Clayton
86cdd114d5 Be more explicit about usage during liklihood 2016-05-13 12:42:05 -04:00
Joshua Clayton
4097ac4aa8 Bump version to 0.1.1.0 2016-05-12 18:11:14 -04:00
Joshua Clayton
7f0e701823 Extract internal parsing handling to separate module
Why?
====

Parsing lines of results was somewhat unreliable, and terms with odd
characters were causing problems. This:

* extracts parsing into an Unused.Parser.Internal module for ease of
  testing
* fixes cases where certain tokens weren't matching
2016-05-12 18:02:59 -04:00
Joshua Clayton
1457bf0100 Allow Mixfile and __using__ for Elixir 2016-05-12 18:01:16 -04:00
Gabe Berke-Williams
985d876ff5 Use applicative style in Parsec
This commit also moves `eol` into the `parseTermMatch` parser, which should be
safe since `parseTermMatches` is the only place that `parseTermMatch` is used.
2016-05-12 13:59:58 -04:00
Joshua Clayton
3ff26fceea Try to point people in the right direction better 2016-05-12 06:40:29 -04:00
Joshua Clayton
7d2caa3f2d Outline the recommended way of using Unused 2016-05-12 06:38:48 -04:00
Joshua Clayton
731381a0f8 Discuss what it can be used on 2016-05-12 06:37:30 -04:00
Joshua Clayton
b90cddf460 Print message when no results are found 2016-05-12 05:25:53 -04:00
Joshua Clayton
95fc86eaef Include TravisCI build status 2016-05-11 23:24:42 -04:00
Joshua Clayton
51be1c86ae Test unused on TravisCI 2016-05-11 23:09:35 -04:00
Joshua Clayton
a18d921f6a Document installation via Homebrew 2016-05-11 22:32:19 -04:00
Joshua Clayton
9ffc78f721 Initial release v0.1.0.0 2016-05-11 21:36:21 -04:00
Joshua Clayton
ca694df50e Use void 2016-05-11 21:30:30 -04:00
Joshua Clayton
5b69d45caf Include features/ in the list of directories counting as tests 2016-05-11 11:31:52 -04:00
Joshua Clayton
19b72c123f Update readme to include information about ag 2016-05-11 11:31:52 -04:00
Joshua Clayton
8d5e13c89e Use sensible defaults for the CLI
Why?
====

By default, people want to see an actionable, comprehensive list without
having to pass any flags into the program.

Previously, to see everything with high likelihood you'd need to provide
`-a --likelihood high`. This commit changes the program so that's the default.

It also introduces a `--all-likelihoods` flag (shorthand is `-a`) to see
everything, so if you want to opt into see it, you can. Finally, this
changes `-a` (to see everything) to `-s` (to see only single
occurrences, which was the previous default).
2016-05-11 11:31:52 -04:00
Joshua Clayton
56c083097d Fix indentation 2016-05-11 10:46:18 -04:00
Joshua Clayton
9407b91b3b Update help docs 2016-05-11 09:22:29 -04:00
Joshua Clayton
cf542044df Warn on everything, error on anything 2016-05-11 05:32:42 -04:00
Joshua Clayton
4b60a06438 Resolve remaining warnings 2016-05-11 05:32:10 -04:00
Joshua Clayton
86146ad4a4 Update cabal file to reflect proper information 2016-05-11 05:28:01 -04:00
Joshua Clayton
2650e1f040 Improve likelihood calculation and include reasons for evaluation
Why?
====

A simple calculation ("yes, this should be removed" or "no, this is
probably fine") is frankly not enough information for someone evaluating
their codebase to understand why we made the decision.

This introduces a removal reason, so a user understands why we ranked it
the way we did, and adds additional logic around a method and its tests
to determine if a method exists and is only being used in the tests (if
so, it should probably be deleted).

This is done with an Occurrances record, which is created for total
files, test code, and non-test code. The test code logic is somewhat
naive but works in most cases. It doesn't ensure a particular directory,
in the case that tests live alongside source code (e.g. Go), and
captures RSpec cases as well.
2016-05-11 05:18:55 -04:00
Joshua Clayton
cbd5af5954 Add notes about the test suite 2016-05-10 21:03:56 -04:00
Joshua Clayton
64cea7b146 Include usage image 2016-05-10 17:24:28 -04:00
Joshua Clayton
4947e54f27 Better manage column formatting
Why?
====

Formatting each column requires context on the column, as well as
information on alignment. This extracts the column formatting logic to a
specific formatter.

ColumnFormatter is coupled to the order of columns/data displayed to the
user.
2016-05-10 06:37:31 -04:00
Joshua Clayton
11d35a6263 Hook into interrupt to trigger other behavior
Why?
====

Unused hides the cursor and potentially does other things to the window that
may leave it in an odd state. This introduces a hook to run any state
cleanup, including re-enabling the cursor, when a user sends a SIGINT to
the program.
2016-05-10 05:35:28 -04:00
Joshua Clayton
5952306873 Run optimizations 2016-05-09 08:29:09 -04:00
Joshua Clayton
6883fc8e01 Cover all possible RemovalLikelihoods when rendering results 2016-05-09 08:15:54 -04:00
Joshua Clayton
3b627ee1c3 Allow multiple matches with single-occurring appropriate tokens 2016-05-08 22:25:48 -04:00
Joshua Clayton
f7a2e1a287 Add Hspec and tests around parsing 2016-05-08 06:54:34 -04:00
Joshua Clayton
7756359eda Increase the spinner speed 2016-05-07 16:49:55 -04:00
Joshua Clayton
ba8159f08d Ignore file and directory patterns 2016-05-07 16:28:41 -04:00
Joshua Clayton
ee1c4cd0f6 Add flag to filter by likelihood 2016-05-07 16:25:54 -04:00
Joshua Clayton
cb6eb12af4 Add switch to display all term results 2016-05-07 16:18:49 -04:00
Joshua Clayton
4fc984ce75 Fully extract parseSearchRunner 2016-05-07 16:07:43 -04:00
Joshua Clayton
9436f733b2 Extract option filtering to separate function 2016-05-07 15:39:09 -04:00
Joshua Clayton
8fe09791c0 Extract updateMatches 2016-05-07 15:10:26 -04:00
Joshua Clayton
95b4e13173 Remove unnecessary additional filter by matching paths
This additional filter can be removed as filtering out matches by
matching path already occurs
2016-05-07 14:53:12 -04:00