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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d941d9cf8a4d93953bd2fdd630461f6c40c6b900
4
- data.tar.gz: f2b5c54ec7d8f496f72305e5d1aed1e12ff82b5e
3
+ metadata.gz: e5a33fddd5d6ffb7debff88c5442cebbde6b43c8
4
+ data.tar.gz: 9656c5631440b96e047f2ee8a6cb849a58994601
5
5
  SHA512:
6
- metadata.gz: c48ca6ecb0f9cb8953314f1f8e80c2ba62b9e340ab7c513286849e26a17359b40e62eb681405f5b07bc9250450c8464fa5bc5f34746d5572571cc31270d31dc9
7
- data.tar.gz: a93783d880b1e71d429e324490bed8b6e4fa1752ac9368a2fb9100c6ed0a3be3f137037999836fb00378382b64d662df05410ef9724ba0baa23f2bf7474282b7
6
+ metadata.gz: 7f773004d5e5af4b71485a829bfdfd61302b1cbcb874e4c1773f2dfe139b2d3fbba6138c5c2065c7b7a28613ea925fcb8b0bbf079c07b6f6b355b6b5d575e076
7
+ data.tar.gz: 4818dfaeb0f66de2bbaefded44b78ea26703ae090981c344fe5ccc95bce002582f7dc81e7ffcfcec52a1fa17b137e0733dd3090451627fc6fa317b0797dea1e3
@@ -5,8 +5,13 @@ cache:
5
5
 
6
6
  rvm:
7
7
  - 2.0
8
- - 2.1.3
9
- - 2.3.1
8
+ - 2.1.10
9
+ - 2.3.3
10
+ - 2.4.0
11
+
12
+ before_install:
13
+ - gem update --system
14
+ - gem install bundler
10
15
 
11
16
  before_script:
12
17
  - bundle exec danger
@@ -1,5 +1,10 @@
1
1
  ## master
2
2
 
3
+ ## 1.2.3
4
+
5
+ * Update rubies to run in CI - hanneskaeufler
6
+ * support multiline todo text - hanneskaeufler
7
+
3
8
  ## 1.2.2
4
9
 
5
10
  rescue from exception in git gem - hanneskaeufler
@@ -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.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.first.strip)
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
- ^\+ # we only look at additions, marked by + in diffs
27
- \s* # followed by optional space
28
- [^a-z0-9\+\s]+ # anything looking like a comment indicator
29
- (\n\+)? # allow multiline comment markers
30
- \s+ # followed by at least one space
31
- (#{@keywords.join("|")}) # our todo indicator
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
@@ -1,3 +1,3 @@
1
1
  module Todoist
2
- VERSION = "1.2.2".freeze
2
+ VERSION = "1.2.3".freeze
3
3
  end
@@ -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
- diff = sample_diff(patch)
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
- diff = sample_diff(patch)
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.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-02-05 00:00:00.000000000 Z
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.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.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: '0'
221
+ version: 2.0.0
222
222
  required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  requirements:
224
224
  - - ">="