It's common to see TODO
s in code. It's also common for TODO
s to remain as to-dos for a long time. One way we can solve this problem is to have a service that runs through all files in a given directory and checks for any instances of the key-phrase TODO
, flagging each one of them out for humans to continue working on them.
This repository contains a Ruby script that, when given a directory, produces a list of all files (using their absolute paths) containing the keyword TODO
in them. This includes files in the immediate directory, sub-directories, and so on.
- Clone this repository from the following URL:
https://github.com/LeowWB/ace-todo-finder.git
- Navigate to the repository root directory (
ace-todo-finder
) using your shell - Ensure you have Ruby installed on your device, as well as an internet connection
- Execute
gem install bundler
- Execute
bundler install
If you get a success message, you're done! Otherwise, if you get the following error message: Can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
after step 5, then:
- Execute
gem update --system
- Execute
bundle update --bundler
- Navigate to the repository root directory (
ace-todo-finder
) using your shell - Execute
ruby src/main.rb [d]
, where[d]
is the directory in which you wish to run the script, enclosed by quotation marks
Example: ruby src/main.rb "."
Files related to testing can be found in ace-todo-finder/test
. The spec
subdirectory contains RSpec test cases, while the test_cases
directory contains a mock filesystem to be used for testing.
To run all tests:
- Navigate to the repository root directory (
ace-todo-finder
) using your shell - Execute
rspec test/spec
- The script, by design, ignores all files and directories which begin with
.
(such as.git
or.gitignore
) - The script only finds instances of the string
TODO
- strings such astodo
, while similar, will not be flagged - If more than one argument is provided, the script will run once over each argument