todo_finder 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/todo_finder.rb +4 -2
- data/lib/todo_finder/version.rb +1 -1
- metadata +1 -1
data/lib/todo_finder.rb
CHANGED
@@ -5,6 +5,8 @@ module TodoFinder
|
|
5
5
|
class Finder
|
6
6
|
attr_accessor :matches
|
7
7
|
|
8
|
+
TODO_REGEX = /(\*|\/\/|#)\s*\[?todo(\]|:| \-)\s+/i
|
9
|
+
|
8
10
|
def initialize
|
9
11
|
@matches = Hash.new { |h,k| h[k]=[] }
|
10
12
|
end
|
@@ -17,7 +19,7 @@ module TodoFinder
|
|
17
19
|
all_files.each do |file_name|
|
18
20
|
File.open(file_name, :encoding => 'ISO-8859-1') do |file|
|
19
21
|
file.each_with_index do |line, i|
|
20
|
-
@matches[file_name] << [i + 1, line] if line =~
|
22
|
+
@matches[file_name] << [i + 1, line] if line =~ TODO_REGEX
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -33,7 +35,7 @@ module TodoFinder
|
|
33
35
|
|
34
36
|
lines.each do |i, line|
|
35
37
|
line_num = i.to_s.green
|
36
|
-
formatted_line = line.sub(
|
38
|
+
formatted_line = line.sub(TODO_REGEX, '')
|
37
39
|
puts " - [#{line_num}] " << formatted_line.strip
|
38
40
|
end
|
39
41
|
|
data/lib/todo_finder/version.rb
CHANGED