danger-todoist 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/todoist/diff_todo_finder.rb +14 -1
- data/lib/todoist/gem_version.rb +1 -1
- data/spec/diff_todo_finder_spec.rb +6 -0
- data/spec/fixtures/preexisting_todo.diff +16 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4afb3ce622171a380007204479eedb0aefca4df4ef76b5ea8fb06d9892499db1
|
4
|
+
data.tar.gz: 32524a2b719ab4facc971623599f39213139a6dbd448ec1825b35097c67e640c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76900a481490c824961e518c5186035cf76508fed553145cfc999b20b6c9c9c061cbb35fea6859d67ff50c4b359b9f167ba4d494bf5c3769c1cec39bcc0d925f
|
7
|
+
data.tar.gz: aedc837ec910921a8cfd963539e340eeb8da2ee4b1bed364402c4077d9843118818655cf19b7a7dcc01d13e0a71b0929766f3172e726400808b0713a08a379cf
|
data/CHANGELOG.md
CHANGED
@@ -5,13 +5,26 @@ module Danger
|
|
5
5
|
@regexp = todo_regexp(keywords)
|
6
6
|
end
|
7
7
|
|
8
|
+
# rubocop:disable Metrics/MethodLength
|
8
9
|
def call(diffs)
|
9
10
|
diffs
|
10
|
-
.map
|
11
|
+
.map do |diff|
|
12
|
+
# Should only look for matches *within* the changed lines of a patch
|
13
|
+
# (lines that begin with "+"), not the entire patch.
|
14
|
+
# The current regexp doesn't enforce this correctly in some cases.
|
15
|
+
patch = MatchesInDiff::Patch.new(diff.patch)
|
16
|
+
matches = patch.changed_lines
|
17
|
+
.map(&:content)
|
18
|
+
.join
|
19
|
+
.scan(@regexp)
|
20
|
+
|
21
|
+
MatchesInDiff.new(diff, matches)
|
22
|
+
end
|
11
23
|
.select(&:todo_matches?)
|
12
24
|
.map(&:all_todos)
|
13
25
|
.flatten
|
14
26
|
end
|
27
|
+
# rubocop:enable Metrics/MethodLength
|
15
28
|
|
16
29
|
private
|
17
30
|
|
data/lib/todoist/gem_version.rb
CHANGED
@@ -140,6 +140,12 @@ PATCH
|
|
140
140
|
"I'd rather not have this here ... because it's probably "\
|
141
141
|
"just a bit of code that we can reimplement or steal"])
|
142
142
|
end
|
143
|
+
|
144
|
+
it "ignores pre-existing todos found in the context lines of a patch" do
|
145
|
+
diff = sample_diff_fixture("preexisting_todo.diff")
|
146
|
+
todos = subject.call([diff])
|
147
|
+
expect(todos).to be_empty
|
148
|
+
end
|
143
149
|
end
|
144
150
|
end
|
145
151
|
# rubocop:enable Metrics/BlockLength
|
@@ -0,0 +1,16 @@
|
|
1
|
+
diff --git a/lib/todoist/diff_todo_finder.rb b/lib/todoist/diff_todo_finder.rb
|
2
|
+
index b58809b..1ecc4f0 100644
|
3
|
+
--- a/lib/todoist/diff_todo_finder.rb
|
4
|
+
+++ b/lib/todoist/diff_todo_finder.rb
|
5
|
+
@@ -54,9 +53,11 @@ def all_todos
|
6
|
+
|
7
|
+
def line_number(match)
|
8
|
+
_, todo_indicator = match
|
9
|
+
GitDiffParser::Patch.new(diff.patch).changed_lines.each do |line|
|
10
|
+
return line.number if line.content =~ /#{todo_indicator}/
|
11
|
+
end
|
12
|
+
+ # introducing a change with a newline right above a pre-existing TODO
|
13
|
+
+
|
14
|
+
# TODO: thats not gonna fly
|
15
|
+
-1
|
16
|
+
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: 2.0.
|
4
|
+
version: 2.0.1
|
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: 2019-
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- spec/diff_inline_todo_finder_spec.rb
|
208
208
|
- spec/diff_todo_finder_spec.rb
|
209
209
|
- spec/fixtures/multiline_todo_patch.diff
|
210
|
+
- spec/fixtures/preexisting_todo.diff
|
210
211
|
- spec/fixtures/sample_patch.diff
|
211
212
|
- spec/matches_in_diff_spec.rb
|
212
213
|
- spec/spec_helper.rb
|
@@ -230,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
231
|
- !ruby/object:Gem::Version
|
231
232
|
version: '0'
|
232
233
|
requirements: []
|
233
|
-
rubygems_version: 3.0.
|
234
|
+
rubygems_version: 3.0.6
|
234
235
|
signing_key:
|
235
236
|
specification_version: 4
|
236
237
|
summary: Marking something with a todo is very common during implementing a new feature.
|
@@ -239,6 +240,7 @@ test_files:
|
|
239
240
|
- spec/diff_inline_todo_finder_spec.rb
|
240
241
|
- spec/diff_todo_finder_spec.rb
|
241
242
|
- spec/fixtures/multiline_todo_patch.diff
|
243
|
+
- spec/fixtures/preexisting_todo.diff
|
242
244
|
- spec/fixtures/sample_patch.diff
|
243
245
|
- spec/matches_in_diff_spec.rb
|
244
246
|
- spec/spec_helper.rb
|