Debtective
Find legacy code so you don't forget to pay off your debts! 💰
Usage
#️⃣ Comments
Overall, comments are a good clue to find smelly code that could be rewritten to become understandable without comments.
Morehover, TODO and FIXME comments indicate a debt that needs to be repaid.
Run it with:
bundle exec debtective --commentsThis outputs the comments in the stdout and in a comments.json file, with useful information such as<<>> author and date, type, size of the associated statement, etc.
If you are only interested in the comments.json file, pass the --quiet option so that nothing is logged to stdout.
You can filter comments by including and excluding paths:
# find only comments in app/models and app/controllers
# excepting those in app/models/concerns and app/controllers/concerns
bundle exec debtective --comments \
--include app/models app/controllers \
--exclude app/models/concerns app/controllers/concernsYou can filter comments by author:
# find only your comments (rely on local git configuration)
bundle exec debtective --comments --me
# find only Jane Doe's comments
bundle exec debtective --comments --user "Jane Doe"You can filter comments by type:
| type | example |
|---|---|
todo |
# TODO: do that |
fixme |
# FIXME: do that |
yard |
# @return Float |
offense |
# rubocop:disable Metrics/MethodLength |
magic |
# frozen_string_literal: true |
shebang |
#!/usr/bin/env ruby |
note |
# hello world (any other comment) |
Use --<type> to include a type or --no-<type> to exclude a type:
# find only todo and fixme comments
bundle exec debtective --comments --todo --fixme
# find all comments except magic and shebang ones
bundle exec debtective --comments --no-magic --no-shebangOf course all options can be comined together:
# find only your todo and fixme comments in app/models and app/controllers
# except those in app/models/concerns and app/controllers/concerns
bundle exec debtective --comments --me --todo --fixme \
--include app/models app/controllers \
--exclude app/models/concerns app/controllers/concerns💎 Gems
Find gems that are not maintained anymore.
⚠️ Upcoming feature!
Installation
Add this line to your application's Gemfile:
group :development do
gem "debtective"
endAnd then execute:
$ bundleOr install it yourself as:
$ gem install debtectiveContributing
This gem is still a work in progress. You can use GitHub issue to start a discussion.
License
The gem is available as open source under the terms of the MIT License.