danger-todoist 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -2
- data/CHANGELOG.md +5 -0
- data/danger-todoist.gemspec +2 -1
- data/lib/todoist/diff_todo_finder.rb +19 -10
- data/lib/todoist/gem_version.rb +1 -1
- data/spec/diff_todo_finder_spec.rb +21 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a33fddd5d6ffb7debff88c5442cebbde6b43c8
|
4
|
+
data.tar.gz: 9656c5631440b96e047f2ee8a6cb849a58994601
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f773004d5e5af4b71485a829bfdfd61302b1cbcb874e4c1773f2dfe139b2d3fbba6138c5c2065c7b7a28613ea925fcb8b0bbf079c07b6f6b355b6b5d575e076
|
7
|
+
data.tar.gz: 4818dfaeb0f66de2bbaefded44b78ea26703ae090981c344fe5ccc95bce002582f7dc81e7ffcfcec52a1fa17b137e0733dd3090451627fc6fa317b0797dea1e3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/danger-todoist.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = ">= 2.0.0"
|
20
21
|
|
21
22
|
spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
|
22
23
|
|
@@ -27,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
27
28
|
# Testing support
|
28
29
|
spec.add_development_dependency "rspec", "~> 3.4"
|
29
30
|
spec.add_development_dependency "simplecov", "~> 0.12"
|
30
|
-
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0
|
31
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0"
|
31
32
|
|
32
33
|
# Linting code and docs
|
33
34
|
spec.add_development_dependency "rubocop", "~> 0.41"
|
@@ -13,7 +13,7 @@ module Danger
|
|
13
13
|
next if matches.empty?
|
14
14
|
|
15
15
|
matches.each do |match|
|
16
|
-
todos << Danger::Todo.new(diff.path, match
|
16
|
+
todos << Danger::Todo.new(diff.path, clean_todo_text(match))
|
17
17
|
end
|
18
18
|
end
|
19
19
|
todos
|
@@ -21,17 +21,26 @@ module Danger
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
+
def clean_todo_text(match)
|
25
|
+
comment_indicator, _, entire_todo = match
|
26
|
+
entire_todo.gsub(comment_indicator, "")
|
27
|
+
.delete("\n")
|
28
|
+
.strip
|
29
|
+
end
|
30
|
+
|
31
|
+
# this is quite a mess now ... I knew it would haunt me.
|
32
|
+
# to aid debugging, this online regexr can be
|
33
|
+
# used: http://rubular.com/r/DPkoE2ztpn
|
34
|
+
# the regexp uses backreferences to match the comment indicator multiple
|
35
|
+
# times if possible
|
24
36
|
def todo_regexp
|
25
37
|
/
|
26
|
-
|
27
|
-
\s
|
28
|
-
[
|
29
|
-
(
|
30
|
-
\s
|
31
|
-
|
32
|
-
[\s:]{1} # followed by a space or colon
|
33
|
-
(?<text>.*)$ # matching any text until the end of the line
|
34
|
-
/ix
|
38
|
+
(?<comment_indicator>^\+\s*[^a-z0-9\+\s]+)
|
39
|
+
(\n\+)?\s+
|
40
|
+
(?<todo_indicator>#{@keywords.join("|")})[\s:]{1}
|
41
|
+
(?<entire_text>(?<text>[^\n]*)
|
42
|
+
(?<rest>\n\k<comment_indicator>\s*[\w .]*)*)
|
43
|
+
/ixm
|
35
44
|
end
|
36
45
|
end
|
37
46
|
end
|
data/lib/todoist/gem_version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.expand_path("../spec_helper", __FILE__)
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/ModuleLength
|
3
4
|
module Danger
|
4
5
|
# rubocop:disable Metrics/BlockLength
|
5
6
|
describe Danger::DiffTodoFinder do
|
@@ -94,9 +95,7 @@ module Danger
|
|
94
95
|
+ # FIXME: with you the force is
|
95
96
|
PATCH
|
96
97
|
|
97
|
-
|
98
|
-
|
99
|
-
todos = subject.find_diffs_containing_todos([diff])
|
98
|
+
todos = subject.find_diffs_containing_todos([sample_diff(patch)])
|
100
99
|
|
101
100
|
expect(todos.map(&:text))
|
102
101
|
.to eql(["practice you must", "with you the force is"])
|
@@ -113,12 +112,28 @@ PATCH
|
|
113
112
|
+ */
|
114
113
|
PATCH
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
todos = subject.find_diffs_containing_todos([diff])
|
115
|
+
todos = subject.find_diffs_containing_todos([sample_diff(patch)])
|
119
116
|
|
120
117
|
expect(todos.map(&:text)).to eql(%w(something another))
|
121
118
|
end
|
119
|
+
|
120
|
+
it "can extract multiline todo text" do
|
121
|
+
patch = <<PATCH
|
122
|
+
+ /**
|
123
|
+
+ * TODO: this should be parsed as
|
124
|
+
+ * a single item.
|
125
|
+
+ */
|
126
|
+
+ # TODO: this is a
|
127
|
+
+ # multiline comment as well
|
128
|
+
+ function bla() {};
|
129
|
+
PATCH
|
130
|
+
|
131
|
+
todos = subject.find_diffs_containing_todos([sample_diff(patch)])
|
132
|
+
|
133
|
+
expect(todos.map(&:text))
|
134
|
+
.to eql(["this should be parsed as a single item.",
|
135
|
+
"this is a multiline comment as well"])
|
136
|
+
end
|
122
137
|
end
|
123
138
|
end
|
124
139
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-todoist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannes Käufler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.0
|
89
|
+
version: '1.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0
|
96
|
+
version: '1.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
218
|
requirements:
|
219
219
|
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
221
|
+
version: 2.0.0
|
222
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
223
|
requirements:
|
224
224
|
- - ">="
|