2016-04-28 12:37:06 +03:00
|
|
|
name: unused
|
2016-06-10 12:32:36 +03:00
|
|
|
version: 0.3.0.0
|
2016-05-11 12:28:01 +03:00
|
|
|
synopsis: A command line tool to identify unused code.
|
2016-04-28 12:37:06 +03:00
|
|
|
description: Please see README.md
|
|
|
|
homepage: https://github.com/joshuaclayton/unused#readme
|
|
|
|
license: MIT
|
|
|
|
license-file: LICENSE
|
|
|
|
author: Josh Clayton
|
|
|
|
maintainer: sayhi@joshuaclayton.me
|
|
|
|
copyright: 2016 Josh Clayton
|
2016-05-11 12:28:01 +03:00
|
|
|
category: Development
|
2016-04-28 12:37:06 +03:00
|
|
|
build-type: Simple
|
|
|
|
-- extra-source-files:
|
|
|
|
cabal-version: >=1.10
|
2016-05-18 18:11:49 +03:00
|
|
|
data-files: data/config.yml
|
2016-04-28 12:37:06 +03:00
|
|
|
|
|
|
|
library
|
|
|
|
hs-source-dirs: src
|
2016-04-29 00:42:58 +03:00
|
|
|
exposed-modules: Unused.TermSearch
|
2016-05-24 00:21:08 +03:00
|
|
|
, Unused.TermSearch.Types
|
2016-05-14 15:04:35 +03:00
|
|
|
, Unused.TermSearch.Internal
|
2016-04-29 05:21:18 +03:00
|
|
|
, Unused.Parser
|
|
|
|
, Unused.Types
|
2016-04-29 16:58:03 +03:00
|
|
|
, Unused.Util
|
2016-05-03 13:41:18 +03:00
|
|
|
, Unused.Regex
|
Initial support of aliases based on wildcard matching
Why?
====
Dynamic languages, and Rails in particular, support some fun method
creation. One common pattern is, within RSpec, to create matchers
dynamically based on predicate methods. Two common examples are:
* `#admin?` gets converted to the matcher `#be_admin`
* `#has_active_todos?` gets converted to the matcher `#have_active_todos`
This especially comes into play when writing page objects with predicate
methods.
This change introduces the concept of aliases, a way to describe the
before/after for these transformations. This introduces a direct swap
with a wildcard value (%s), although this may change in the future to
support other transformations for pluralization, camel-casing, etc.
Externally, aliases are not grouped together by term; however, the
underlying counts are summed together, increasing the total occurrences
and likely pushing the individual method out of "high" likelihood into
"medium" or "low" likelihood.
Closes #19.
2016-05-29 14:49:22 +03:00
|
|
|
, Unused.Aliases
|
2016-05-07 12:56:46 +03:00
|
|
|
, Unused.ResponseFilter
|
2016-05-18 18:11:49 +03:00
|
|
|
, Unused.ResultsClassifier
|
|
|
|
, Unused.ResultsClassifier.Types
|
|
|
|
, Unused.ResultsClassifier.Config
|
2016-05-13 22:57:07 +03:00
|
|
|
, Unused.Grouping
|
|
|
|
, Unused.Grouping.Internal
|
|
|
|
, Unused.Grouping.Types
|
2016-05-07 12:56:46 +03:00
|
|
|
, Unused.LikelihoodCalculator
|
2016-05-15 14:51:54 +03:00
|
|
|
, Unused.Cache
|
|
|
|
, Unused.Cache.DirectoryFingerprint
|
2016-05-26 22:25:43 +03:00
|
|
|
, Unused.Cache.FindArgsFromIgnoredPaths
|
2016-05-21 17:20:25 +03:00
|
|
|
, Unused.TagsSource
|
2016-05-05 05:55:09 +03:00
|
|
|
, Unused.CLI
|
|
|
|
, Unused.CLI.Search
|
|
|
|
, Unused.CLI.Util
|
2016-05-27 12:52:56 +03:00
|
|
|
, Unused.CLI.Views
|
|
|
|
, Unused.CLI.Views.NoResultsFound
|
|
|
|
, Unused.CLI.Views.AnalysisHeader
|
|
|
|
, Unused.CLI.Views.MissingTagsFileError
|
Allow developer-authored configurations
This enables per-user and per-project configs, located in:
* ~/.unused.yml
* APP_ROOT/.unused.yml
Configurations stack upon each other, not replace; unused provides a
very base config, but additional configurations can be defined.
Per-user configs are best used to suit common types of projects at a
generic level. For example, a developer commonly working in Rails
applications might have a config at ~/.unused.yml for patterns like
Policy objects from Pundit, ActiveModel::Serializers, etc.
Per-project config would be less-generic patterns, ones where re-use
isn't likely or applicable.
See unused's global config:
https://github.com/joshuaclayton/unused/blob/master/data/config.yml
The structure is as follows:
- name: Rails
autoLowLikelihood:
- name: Pundit
pathStartsWith: app/policies
pathEndsWith: .rb
termEndsWith: Policy
classOrModule: true
- name: Pundit Helpers
pathStartsWith: app/policies
allowedTerms:
- Scope
- index?
- new?
- create?
- show?
- edit?
- destroy?
- resolve
- name: Other Language
autoLowLikelihood:
- name: Thing
pathEndsWith: .ex
classOrModule: true
Name each item, and include an autoLowLikelihood key with multiple named
matchers. Each matcher can look for various formatting aspects,
including termStartsWith, termEndsWith, pathStartsWith, pathEndsWith,
classOrModule, and allowedTerms.
2016-06-05 14:40:47 +03:00
|
|
|
, Unused.CLI.Views.InvalidConfigError
|
2016-05-27 12:52:56 +03:00
|
|
|
, Unused.CLI.Views.SearchResult
|
|
|
|
, Unused.CLI.Views.SearchResult.ColumnFormatter
|
2016-05-13 15:03:26 +03:00
|
|
|
, Unused.CLI.ProgressIndicator
|
|
|
|
, Unused.CLI.ProgressIndicator.Internal
|
|
|
|
, Unused.CLI.ProgressIndicator.Types
|
2016-05-18 18:11:49 +03:00
|
|
|
other-modules: Paths_unused
|
2016-04-28 12:37:06 +03:00
|
|
|
build-depends: base >= 4.7 && < 5
|
2016-04-29 00:42:58 +03:00
|
|
|
, process
|
2016-04-29 12:28:03 +03:00
|
|
|
, containers
|
2016-04-30 23:05:12 +03:00
|
|
|
, filepath
|
2016-05-15 14:51:54 +03:00
|
|
|
, directory
|
2016-05-03 13:41:18 +03:00
|
|
|
, regex-tdfa
|
2016-05-05 05:55:09 +03:00
|
|
|
, terminal-progress-bar
|
|
|
|
, ansi-terminal
|
2016-05-10 00:45:42 +03:00
|
|
|
, unix
|
2016-05-13 21:46:23 +03:00
|
|
|
, parallel-io
|
2016-05-18 18:11:49 +03:00
|
|
|
, yaml
|
|
|
|
, bytestring
|
|
|
|
, text
|
|
|
|
, unordered-containers
|
2016-05-24 00:21:08 +03:00
|
|
|
, cassava
|
|
|
|
, vector
|
|
|
|
, mtl
|
|
|
|
, transformers
|
2016-05-11 12:32:42 +03:00
|
|
|
ghc-options: -Wall -Werror -O2
|
2016-04-28 12:37:06 +03:00
|
|
|
default-language: Haskell2010
|
|
|
|
|
|
|
|
executable unused
|
|
|
|
hs-source-dirs: app
|
|
|
|
main-is: Main.hs
|
2016-05-09 15:29:09 +03:00
|
|
|
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Werror -O2
|
2016-04-28 12:37:06 +03:00
|
|
|
build-depends: base
|
|
|
|
, unused
|
2016-05-05 05:55:09 +03:00
|
|
|
, optparse-applicative
|
Allow developer-authored configurations
This enables per-user and per-project configs, located in:
* ~/.unused.yml
* APP_ROOT/.unused.yml
Configurations stack upon each other, not replace; unused provides a
very base config, but additional configurations can be defined.
Per-user configs are best used to suit common types of projects at a
generic level. For example, a developer commonly working in Rails
applications might have a config at ~/.unused.yml for patterns like
Policy objects from Pundit, ActiveModel::Serializers, etc.
Per-project config would be less-generic patterns, ones where re-use
isn't likely or applicable.
See unused's global config:
https://github.com/joshuaclayton/unused/blob/master/data/config.yml
The structure is as follows:
- name: Rails
autoLowLikelihood:
- name: Pundit
pathStartsWith: app/policies
pathEndsWith: .rb
termEndsWith: Policy
classOrModule: true
- name: Pundit Helpers
pathStartsWith: app/policies
allowedTerms:
- Scope
- index?
- new?
- create?
- show?
- edit?
- destroy?
- resolve
- name: Other Language
autoLowLikelihood:
- name: Thing
pathEndsWith: .ex
classOrModule: true
Name each item, and include an autoLowLikelihood key with multiple named
matchers. Each matcher can look for various formatting aspects,
including termStartsWith, termEndsWith, pathStartsWith, pathEndsWith,
classOrModule, and allowedTerms.
2016-06-05 14:40:47 +03:00
|
|
|
, mtl
|
|
|
|
, transformers
|
2016-04-28 12:37:06 +03:00
|
|
|
default-language: Haskell2010
|
|
|
|
|
|
|
|
test-suite unused-test
|
|
|
|
type: exitcode-stdio-1.0
|
|
|
|
hs-source-dirs: test
|
|
|
|
main-is: Spec.hs
|
|
|
|
build-depends: base
|
|
|
|
, unused
|
2016-05-08 13:29:55 +03:00
|
|
|
, hspec
|
|
|
|
, containers
|
|
|
|
other-modules: Unused.ParserSpec
|
|
|
|
, Unused.ResponseFilterSpec
|
|
|
|
, Unused.TypesSpec
|
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-08 15:16:32 +03:00
|
|
|
, Unused.LikelihoodCalculatorSpec
|
2016-05-13 22:57:07 +03:00
|
|
|
, Unused.Grouping.InternalSpec
|
2016-05-14 15:04:35 +03:00
|
|
|
, Unused.TermSearch.InternalSpec
|
2016-05-15 12:53:29 +03:00
|
|
|
, Unused.UtilSpec
|
2016-06-05 14:42:18 +03:00
|
|
|
, Unused.Cache.FindArgsFromIgnoredPathsSpec
|
2016-06-05 15:09:02 +03:00
|
|
|
, Unused.AliasesSpec
|
2016-05-18 18:11:49 +03:00
|
|
|
, Paths_unused
|
2016-05-07 13:23:38 +03:00
|
|
|
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Werror
|
2016-04-28 12:37:06 +03:00
|
|
|
default-language: Haskell2010
|
|
|
|
|
|
|
|
source-repository head
|
|
|
|
type: git
|
|
|
|
location: https://github.com/joshuaclayton/unused
|