Sha256: d1384d2bf5ac2e3b1cefc3b8624871a9fce7dcd7b653fd85eff780814525f0bf
Contents?: true
Size: 864 Bytes
Versions: 2
Compression:
Stored size: 864 Bytes
Contents
module Danger # Identify todos in a set of diffs class DiffTodoFinder TODO_REGEXP = / ^\+ # we only look at additions, marked by + in diffs \s* # followed by optional space [^a-z0-9\+]* # anything looking like a comment indicator, not a + \s+ # followed by at least one space (TODO|FIXME) # our todo indicator [\s:]{1} # followed by a space or colon (?<text>.*)$ # matching any text until the end of the line /ix def find_diffs_containing_todos(diffs) todos = [] diffs.each do |diff| matches = diff.patch.scan(TODO_REGEXP) next if matches.empty? matches.each do |match| todos << Danger::Todo.new(diff.path, match.first.strip) end end todos end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danger-todoist-1.0.0 | lib/todoist/diff_todo_finder.rb |
danger-todoist-0.3.0 | lib/todoist/diff_todo_finder.rb |