debtective 0.2.3.3 → 0.2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/debtective +2 -19
- data/lib/debtective/command.rb +32 -0
- data/lib/debtective/comments/build_comment.rb +49 -0
- data/lib/debtective/comments/command.rb +61 -0
- data/lib/debtective/comments/comment/base.rb +104 -0
- data/lib/debtective/comments/comment/fixme.rb +20 -0
- data/lib/debtective/comments/comment/magic.rb +27 -0
- data/lib/debtective/comments/comment/note.rb +12 -0
- data/lib/debtective/comments/comment/offense.rb +12 -0
- data/lib/debtective/comments/comment/shebang.rb +27 -0
- data/lib/debtective/comments/comment/todo.rb +20 -0
- data/lib/debtective/comments/comment/yard.rb +28 -0
- data/lib/debtective/comments/export.rb +132 -0
- data/lib/debtective/comments/find_commit.rb +66 -0
- data/lib/debtective/comments/find_end_of_statement.rb +61 -0
- data/lib/debtective/comments/print.rb +83 -0
- data/lib/debtective/stderr_helper.rb +1 -0
- data/lib/debtective/version.rb +1 -1
- data/lib/debtective.rb +1 -15
- metadata +31 -12
- data/lib/debtective/configuration.rb +0 -8
- data/lib/debtective/find_commit.rb +0 -66
- data/lib/debtective/find_end_of_statement.rb +0 -72
- data/lib/debtective/railtie.rb +0 -10
- data/lib/debtective/todos/build.rb +0 -69
- data/lib/debtective/todos/find.rb +0 -43
- data/lib/debtective/todos/list.rb +0 -59
- data/lib/debtective/todos/output.rb +0 -65
- data/lib/debtective/todos/print_table.rb +0 -89
- data/lib/debtective/todos/todo.rb +0 -71
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "debtective/find_commit"
|
4
|
-
|
5
|
-
module Debtective
|
6
|
-
module Todos
|
7
|
-
# Hold todo information
|
8
|
-
class Todo
|
9
|
-
class << self
|
10
|
-
# @return [Debtective::Todos::Todo]
|
11
|
-
def build(pathname, index)
|
12
|
-
Build.new(pathname, index).call
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
attr_accessor :pathname, :todo_boundaries, :statement_boundaries
|
17
|
-
|
18
|
-
# @param pathname [Pathname]
|
19
|
-
# @param lines [Array<String>]
|
20
|
-
# @param todo_boundaries [Range]
|
21
|
-
# @param statement_boundaries [Range]
|
22
|
-
def initialize(pathname, lines, todo_boundaries, statement_boundaries)
|
23
|
-
@pathname = pathname
|
24
|
-
@lines = lines
|
25
|
-
@todo_boundaries = todo_boundaries
|
26
|
-
@statement_boundaries = statement_boundaries
|
27
|
-
end
|
28
|
-
|
29
|
-
# location in the codebase
|
30
|
-
# @return [String]
|
31
|
-
def location
|
32
|
-
"#{@pathname}:#{@todo_boundaries.min + 1}"
|
33
|
-
end
|
34
|
-
|
35
|
-
# size of the todo code
|
36
|
-
# @return [Integer]
|
37
|
-
def size
|
38
|
-
@statement_boundaries.size
|
39
|
-
end
|
40
|
-
|
41
|
-
# return commit that introduced the todo
|
42
|
-
# @return [Git::Object::Commit]
|
43
|
-
def commit
|
44
|
-
@commit ||= Debtective::FindCommit.new(@pathname, @lines[@todo_boundaries.min]).call
|
45
|
-
end
|
46
|
-
|
47
|
-
# @return [Integer]
|
48
|
-
def days
|
49
|
-
return if commit.time.nil?
|
50
|
-
|
51
|
-
((Time.now - commit.time) / (24 * 60 * 60)).round
|
52
|
-
end
|
53
|
-
|
54
|
-
# @return [Hash]
|
55
|
-
def to_h
|
56
|
-
{
|
57
|
-
pathname: pathname,
|
58
|
-
location: location,
|
59
|
-
todo_boundaries: todo_boundaries.minmax,
|
60
|
-
statement_boundaries: statement_boundaries.minmax,
|
61
|
-
size: size,
|
62
|
-
commit: {
|
63
|
-
sha: commit.sha,
|
64
|
-
author: commit.author.to_h,
|
65
|
-
time: commit.time
|
66
|
-
}
|
67
|
-
}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|