Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Releases: joshuaclayton/unused

0.10.0.0

30 Oct 00:53
1699c25
Compare
Choose a tag to compare

This release bumps dependencies on external packages to ensure successful builds via Homebrew and Stack.

v0.9.0.0

29 Aug 00:57
514eb94
Compare
Choose a tag to compare

This release bumps dependencies on external packages to ensure successful builds via Homebrew and Stack.

v0.8.0.0

24 Apr 22:12
0d9a89a
Compare
Choose a tag to compare

0.8.0.0 introduces one flag, --search rg, to use ripgrep as the search backend. This has the potential for substantial speed improvements on large codebases. If you're installing with Homebrew, a --with-rg option is now available to install the rg optional dependency.

v0.7.0.0

12 Jan 13:41
eddea2d
Compare
Choose a tag to compare

This release removes count numbers from output in standard view to remove clutter and improve readability of outcomes.

0.7.0.0 also provides explicit dependencies (updating the inflections package along the way), allowing it to be installed correctly with Homebrew.

v0.6.1.1

14 Oct 13:44
7d9c923
Compare
Choose a tag to compare

This release updates the cabal file to include data/config.yml in the list of data-files, ensuring distribution via cabal works correctly.

v0.6.1.0

20 Aug 09:32
d81f324
Compare
Choose a tag to compare

This release:

  • Addresses an issue where compiling via Homebrew was broken
  • Leverages FileEmbed to avoid reading lib configuration from the FS

v0.6.0.0

19 Jul 20:42
7e3b91d
Compare
Choose a tag to compare

In addition to improved documentation and safer file-reads, this prepares custom configuration for vim-projectionist style aliases. This is very much an alpha feature, and allows for matching terms present and not present in ctags.

One example introduced into the default configs is Rails validators, which follow the pattern:

class AbsoluteUriValidator < ActiveModel::EachValidator
  # ...
end

class Whatever < ActiveRecord::Base
  validates :url, presence: true, absolute_uri: true
end

In this case, absolute_uri isn't captured by ctags since it's a key in a Hash; however, the use of AbsoluteUriValidator can be probabilistically determined by whether this key is present in the codebase. This introduces the alias format in the config file as:

- name: Rails
  aliases:
  - from: "*Validator"
    to: "{snakecase}"

This will match AbsoluteUri with *, and swap the value out, performing a transformation to snakecase, and link results together so their aggregate counts towards usage.

This also works for non-transformed values, where it's a direct replacement:

- name: Rails
  aliases:
  - from: "*?"
    to: "be_{}"
  - from: "has_*?"
    to: "have_{}"

v0.5.0.2

25 Jun 00:41
b852cff
Compare
Choose a tag to compare
v0.5.0.2

v0.4.0.0

10 Jun 11:08
Compare
Choose a tag to compare

This release introduces custom configuration support. Please see https://github.com/joshuaclayton/unused#custom-configuration for more information on where configuration files should exist, and what the format is.

v0.3.0.0

04 Jun 10:55
Compare
Choose a tag to compare

Performance Improvements

This release includes a couple hefty performance increases, one of which drastically reduces fingerprinting of directories to determine cache read viability. With this in place, caching is now re-enabled by default. 🎉

The nitty-gritty: previously, the fingerprinting code was using find(1) without many limitations on the directories it was crawling. For projects using front-end frameworks like Ember or React, crawling node_modules/ would crash my machine after tens or hundreds of seconds. This was unacceptable.

The changes made now do two things: leverage ReaderT to calculate the fingerprint once (since it's need both to determine if a cache file currently exists, and again to write to the file if it doesn't) and pass that information to both the read and write aspects of the program, as well as read the .gitignore and factor that into find(1) by not running against those files/paths. It attempts to norm on file names/paths to ensure all cases are covered.

My experiences personally have been that calculating/reading/writing are roughly 10% to 20% of the previous iteration.

Aliases

This release introduces a basic implementation for aliasing terms. Even though custom configurations aren't supported currently, this change lays the groundwork and provides aliases for a very common case in our Rails applications: RSpec predicate matchers.

RSpec's predicate matchers aren't captured in the ctags file, so by default, unused wouldn't even know to look for them. On top of that, it previously had no way to link matches together. This is important because, apart from special cases, unused determines likelihood of removal based on the number of occurrences a certain token has within a codebase.

A common example that comes up is, within page objects, predicate methods written to be used as matchers. This would allow a developer to write:

# spec/features/create_todo_spec.rb
expect(todos_list).to have_todo(buy_milk)

Based on a page object:

class TodosList
  # ...
  def has_todo?(todo_on_page)
    # ... assert presence on page
  end
end

Because TodoList#has_todo? only existed for RSpec to generate a matcher, it was being bucketed incorrectly as a high likelihood for removal.

This release will likely increase the number of tokens searched for within a codebase, but the performance impacts should be negligible (based on codebase size and number of predicates, of course).