• Stars
    star
    265
  • Rank 154,577 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 10 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically expiring TODO notes in Ruby

DoBy

Build Status Code Climate

This is a proof-of-concept of automatically-expiring TODO notes.

TODO comments can be a plague on a software codebase. They begin as a good intention to go back and do something, but are easily forgotten or ignored. They can hang around in code for years. And unlike stale code, they're not excecuted, so they never cause anything to break.

DoBy makes your TODO comments complain when they become stale. You add a note using a special TODO method, providing a date which you to defer until. When your code runs, the expiry date on the TODO will be checked, and it will raise an error if it's overdue.

This forces you to look at the TODO task again. If it's no longer relevant, you can delete it. If you can fix it, you fix it. If you cannot fix it right now, change the date to something in the future to re-visit it again.

In addition to TODO, you could also add tasks for FIXME and OPTIMIZE

Example

You can add reminders to specs or the actual implementation, anywhere that will be executed:

class Article < ActiveRecord::Base
  TODO 'add named scopes', '2014-06-01'
  OPTIMIZE 'improve this code', '2014-10-01'
  FIXME 'some_method is broken', '2014-05-01'

  has_many :comments
  # ...
end

The date can be anything parseable by Ruby's DateTime.parse method - 2014-06, June, etc.

Enable DoBy checks by setting ENABLE_DO_BY=1 in the environment. (It's made that way so it doesn't run by default on production environments. You wouldn't want accidents to happen!)

Before that date, everything will run as normal. After that date, the code will raise an exception:

DoBy::LateTask: 'fix this' is overdue (2014-06-01)

FAQ

Why not just use the features my IDE/editor has for tracking TODOs?

You need to either remember to check these periodically, or choose to always display them when you run you tests. If these stick around for more than a short time you'll start ignoring them.

Enhancements

Several people have suggested that this concept could exist as a script which scans over the code for TODOs. That means the TODOs could stay as actual comments, supplemented with some metadata, e.g.:

# TODO [20140601] Fix Me

This script could run as part of a Continous Integration process so that it fails the build if there are overdue TODOs.

Installation

Add this line to your application's Gemfile:

gem 'do_by', github: 'andyw8/do_by'

And then execute:

$ bundle

Similar Projects

Coverage

Contributing

  1. Fork it ( https://github.com/andyw8/do_by/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

More Repositories

1

pocket-ruby

Ruby wrapper for the Pocket REST and Search APIs
Ruby
102
star
2

rubymotion_generators

Old and no longer maintained
Ruby
76
star
3

rubymotion_app_template

Blank RubyMotion project with sensible defaults
Ruby
43
star
4

capybara-page-object

Ruby
32
star
5

RubyMotion-Social-Example

An example of using the iOS 6 Social.framework with RubyMotion
Ruby
23
star
6

techradar

techradar.io
Ruby
23
star
7

setup-rails

A re-usable GitHub Actions CI workflow for verifying Rails apps
19
star
8

itunes_csv

Export iTunes Library XML data to CSV
Ruby
13
star
9

cucumber_scaffold

Cucumber Scaffold
Ruby
12
star
10

motion-json-decoder

Treat JSON nodes as rich objects.
Ruby
10
star
11

hexagonal_rails_rspec_example

Ruby
9
star
12

ruby-kata-template

A blank Ruby project with MiniTest, for both new and experienced developers to quickly get up and running on a kata
Ruby
6
star
13

cuki

Pulls acceptance criteria from a Confluence wiki into Cucumber feature files to keep them in sync
Ruby
6
star
14

codeclimate-engine-rb

A simple way to create issues in the JSON format described in the Code Climate Engine specification
Ruby
6
star
15

setup-rails-example-app

Example app for https://github.com/andyw8/setup-rails
Ruby
5
star
16

depot

The Rails 3.2 version of the finished Depot application from the Agile Web Development With Rails book
Ruby
4
star
17

growing-rails-controllers

Example controller specs for the approach described in the book Growing Rails Applications in Practice.
Ruby
4
star
18

mocha_to_rspec

A set of RuboCop cops to help migrate from Mocha to rspec-mocks
Ruby
4
star
19

rubymotion_parse_example

Ruby
4
star
20

townhallapp

Rails clone of Google Moderator
Ruby
3
star
21

Parse.framework

Unofficial mirror of Parse.framework so that it can be used as a git submodule. May not be the latest release.
Objective-C
3
star
22

checklists

Basic CRUD example app written using Lucky framework (Crystal)
Crystal
3
star
23

WidgetMagic

Example project for GitHub talk
Ruby
2
star
24

dehumanize

A simple plugin to perform the reverse of the 'humanize' string method in Rails
Ruby
2
star
25

flipper-echo

Extensible event notifier for Flipper gem
Ruby
1
star
26

confreaks-rss

RSS for confreaks, because they don't do it.
Ruby
1
star
27

employee-report-kata

https://codingdojo.org/kata/Employee-Report/
Ruby
1
star
28

coffeescript_hello_world

Hello World in CoffeeScript
CoffeeScript
1
star
29

auto-page-objects

Ruby
1
star
30

project_euler_ruby

My solutions in Ruby to Project Euler problems
Ruby
1
star
31

sustainable-rails

1
star
32

googletastic

ActiveRecord-like ORM to the Google Data API
Ruby
1
star
33

node_hello_world

1
star
34

rlit-mob

Ruby
1
star
35

toronto-fire-api-data-scrape

1
star
36

andyw8.github.com-old

Blog
HTML
1
star
37

rmagick-heroku-demo

I thought getting RMagick running on Heroku might be tricky but it was actually very easy.
Ruby
1
star
38

bundle_info

Command-line tool to display information about all the gems in a project's Gemfile
Ruby
1
star
39

99-bottles-2022-03-13

Ruby
1
star
40

pragpub_magazine_downloader

Download back issues of the PragPub magazines
Ruby
1
star
41

jumpstart-setup-rails

Ruby
1
star
42

BlankProject

1
star
43

new_rails_3_app

An empty app configured with a bunch of common gems
Ruby
1
star