lazylead 0.9.1 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Rakefile +1 -2
  4. data/lazylead.gemspec +13 -13
  5. data/lib/lazylead/confluence.rb +1 -2
  6. data/lib/lazylead/os.rb +55 -0
  7. data/lib/lazylead/task/accuracy/accuracy.rb +2 -3
  8. data/lib/lazylead/task/accuracy/attachment.rb +1 -0
  9. data/lib/lazylead/task/accuracy/environment.rb +3 -8
  10. data/lib/lazylead/task/accuracy/logs_link.rb +52 -0
  11. data/lib/lazylead/task/accuracy/records.rb +1 -1
  12. data/lib/lazylead/task/accuracy/required.rb +43 -0
  13. data/lib/lazylead/task/accuracy/screenshots.rb +2 -3
  14. data/lib/lazylead/task/accuracy/servers.rb +7 -7
  15. data/lib/lazylead/task/accuracy/testcase.rb +27 -20
  16. data/lib/lazylead/task/fix_version.rb +5 -8
  17. data/lib/lazylead/task/loading.rb +3 -2
  18. data/lib/lazylead/task/micromanager.rb +27 -3
  19. data/lib/lazylead/task/svn/diff.rb +9 -9
  20. data/lib/lazylead/task/svn/grep.rb +8 -71
  21. data/lib/lazylead/task/svn/svn.rb +107 -0
  22. data/lib/lazylead/task/svn/touch.rb +5 -7
  23. data/lib/lazylead/version.rb +1 -1
  24. data/lib/messages/illegal_assignee_change.erb +1 -2
  25. data/lib/messages/illegal_duedate_change.erb +5 -3
  26. data/lib/messages/loading.erb +2 -2
  27. data/lib/messages/svn_diff.erb +29 -29
  28. data/lib/messages/svn_diff_attachment.erb +5 -7
  29. data/lib/messages/svn_grep.erb +34 -32
  30. data/readme.md +8 -5
  31. data/test/lazylead/system/jira_test.rb +8 -0
  32. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  33. data/test/lazylead/task/accuracy/logs_link_test.rb +50 -0
  34. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  35. data/test/lazylead/task/accuracy/screenshots_test.rb +2 -4
  36. data/test/lazylead/task/accuracy/testcase_test.rb +34 -0
  37. data/test/lazylead/task/alert/alertif_test.rb +2 -1
  38. data/test/lazylead/task/assignment_test.rb +2 -1
  39. data/test/lazylead/task/created_recently_test.rb +2 -1
  40. data/test/lazylead/task/duedate_test.rb +2 -2
  41. data/test/lazylead/task/fix_version_test.rb +2 -1
  42. data/test/lazylead/task/loading_test.rb +6 -2
  43. data/test/lazylead/task/micromanager_test.rb +8 -1
  44. data/test/lazylead/task/missing_comment_test.rb +1 -1
  45. data/test/lazylead/task/svn/diff_test.rb +1 -1
  46. data/test/lazylead/task/svn/grep_test.rb +2 -1
  47. data/test/test.rb +4 -3
  48. metadata +31 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cbd092ef55bfdcf7887c4e0fcf5e5838a70b91eac82011893dc9423b22a0b74
4
- data.tar.gz: 5d71b27626fbf5e9d60ea38cce1e06ab6637aa874daa057ff9b9f8451b095dbf
3
+ metadata.gz: ddf0f9e22eff50a83a0161cc969c6397c326d88a21dcc0a191634645a22bff67
4
+ data.tar.gz: ed262c75c351a8bdfc317123b04de69c854af92fe79234b01e85c3664e16a576
5
5
  SHA512:
6
- metadata.gz: 748f97ab75655642143bd13d562aab38693df3f6496429d794e75f4c6bb9f0315537ad656027f639a9481ed0399345b3cef0f9ebcd83af680c69f5cf3be6380d
7
- data.tar.gz: ea40e803198075657c05df31b251599aac4dbb55bf628a01e1d68bcffeedd09c713ca9d0858d153301ab88f518e5ab50a1486fbc58be3801e5a57264611d915c
6
+ metadata.gz: dc478328e0831adf45af81deaf82427e6f279607d3547fafe5c9593707eb3d39642426fc5f0239a0147fd0d007931e2712337a73da49dd33e6e423c16b947f9c
7
+ data.tar.gz: 930bb2edee338509549c3afe7d9d0dcea5f5391e7f5f6b6bf9cdfc9f2263cb723efedc0596df4e33babdf9d4c02af1401442dfa1ab7f5ffac6b13dccfb2b160b
data/.rubocop.yml CHANGED
@@ -42,7 +42,7 @@ Metrics/MethodLength:
42
42
  - "test/**/*"
43
43
 
44
44
  Metrics/ParameterLists:
45
- Max: 3
45
+ Max: 4
46
46
 
47
47
  Layout/HashAlignment:
48
48
  EnforcedColonStyle:
data/Rakefile CHANGED
@@ -114,8 +114,7 @@ task :sqlint do
114
114
  if total.positive?
115
115
  abort "#{total.colorize(:red)} SQL violations found."
116
116
  else
117
- puts "#{src.size} files inspected, #{'no offenses'.colorize(:green)} " \
118
- "detected"
117
+ puts "#{src.size} files inspected, #{'no offenses'.colorize(:green)} detected"
119
118
  end
120
119
  end
121
120
 
data/lazylead.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.rubygems_version = "2.2"
33
33
  s.required_ruby_version = ">=2.6.5"
34
34
  s.name = "lazylead"
35
- s.version = "0.9.1"
35
+ s.version = "0.10.1"
36
36
  s.license = "MIT"
37
37
  s.summary = "Eliminate the annoying work within bug-trackers."
38
38
  s.description = "Ticketing systems (Github, Jira, etc.) are strongly
@@ -45,7 +45,7 @@ tasks instead of solving technical problems."
45
45
  s.authors = ["Yurii Dubinka"]
46
46
  s.email = "yurii.dubinka@gmail.com"
47
47
  s.homepage = "http://github.com/dgroup/lazylead"
48
- s.post_install_message = "Thanks for installing Lazylead v0.9.1!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.10.1!
49
49
  Read our blog posts: https://lazylead.org
50
50
  Stay in touch with the community in Telegram: https://t.me/lazylead
51
51
  Follow us on Twitter: https://twitter.com/lazylead
@@ -58,7 +58,7 @@ tasks instead of solving technical problems."
58
58
  s.add_runtime_dependency "activerecord", "6.1.3"
59
59
  s.add_runtime_dependency "backtrace", "0.3"
60
60
  s.add_runtime_dependency "colorize", "0.8.1"
61
- s.add_runtime_dependency "faraday", "1.4.1"
61
+ s.add_runtime_dependency "faraday", "1.5.1"
62
62
  s.add_runtime_dependency "get_process_mem", "0.2.7"
63
63
  s.add_runtime_dependency "inifile", "3.0.0"
64
64
  s.add_runtime_dependency "jira-ruby", "2.1.5"
@@ -69,9 +69,9 @@ tasks instead of solving technical problems."
69
69
  s.add_runtime_dependency "openssl", "2.1.2"
70
70
  s.add_runtime_dependency "railties", "6.1.3"
71
71
  s.add_runtime_dependency "require_all", "3.0.0"
72
- s.add_runtime_dependency "rubyzip", "2.3.0"
72
+ s.add_runtime_dependency "rubyzip", "2.3.2"
73
73
  s.add_runtime_dependency "rufus-scheduler", "3.7.0"
74
- s.add_runtime_dependency "slop", "4.8.2"
74
+ s.add_runtime_dependency "slop", "4.9.1"
75
75
  s.add_runtime_dependency "sqlite3", "1.4.2"
76
76
  s.add_runtime_dependency "tempfile", "0.1.1"
77
77
  s.add_runtime_dependency "tilt", "2.0.10"
@@ -80,21 +80,21 @@ tasks instead of solving technical problems."
80
80
  s.add_runtime_dependency "vcs4sql", "0.1.1"
81
81
  s.add_runtime_dependency "viewpoint", "1.1.1"
82
82
  s.add_development_dependency "codecov", "0.5.2"
83
- s.add_development_dependency "guard", "2.16.2"
83
+ s.add_development_dependency "guard", "2.17.0"
84
84
  s.add_development_dependency "guard-minitest", "2.4.6"
85
85
  s.add_development_dependency "minitest", "5.14.4"
86
86
  s.add_development_dependency "minitest-fail-fast", "0.1.0"
87
87
  s.add_development_dependency "minitest-hooks", "1.5.0"
88
88
  s.add_development_dependency "minitest-reporters", "1.4.3"
89
89
  s.add_development_dependency "net-ping", "2.0.8"
90
- s.add_development_dependency "rake", "13.0.3"
90
+ s.add_development_dependency "rake", "13.0.6"
91
91
  s.add_development_dependency "random-port", "0.5.1"
92
- s.add_development_dependency "rdoc", "6.3.0"
93
- s.add_development_dependency "rubocop", "1.13.0"
94
- s.add_development_dependency "rubocop-minitest", "0.12.1"
95
- s.add_development_dependency "rubocop-performance", "1.11.0"
96
- s.add_development_dependency "rubocop-rake", "0.5.1"
97
- s.add_development_dependency "rubocop-rspec", "2.3.0"
92
+ s.add_development_dependency "rdoc", "6.3.2"
93
+ s.add_development_dependency "rubocop", "1.18.3"
94
+ s.add_development_dependency "rubocop-minitest", "0.14.0"
95
+ s.add_development_dependency "rubocop-performance", "1.11.4"
96
+ s.add_development_dependency "rubocop-rake", "0.6.0"
97
+ s.add_development_dependency "rubocop-rspec", "2.4.0"
98
98
  s.add_development_dependency "sqlint", "0.2.0"
99
99
  s.add_development_dependency "tempfile", "0.1.1"
100
100
  s.add_development_dependency "xcop", "0.6.2"
@@ -76,8 +76,7 @@ module Lazylead
76
76
  return "" if resp.blank?
77
77
  pages = JSON.parse(resp)
78
78
  return "" if pages["results"].empty?
79
- "#{@conf.url}/pages/viewpage.action?"\
80
- "pageId=#{pages['results'].first['id']}"
79
+ "#{@conf.url}/pages/viewpage.action?pageId=#{pages['results'].first['id']}"
81
80
  end
82
81
  end
83
82
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ module Lazylead
26
+ #
27
+ # Represents a native, operation system.
28
+ #
29
+ # Author:: Yurii Dubinka (yurii.dubinka@gmail.com)
30
+ # Copyright:: Copyright (c) 2019-2020 Yurii Dubinka
31
+ # License:: MIT
32
+ class OS
33
+ #
34
+ # Run OS-oriented command
35
+ # @param cmd
36
+ # The command could be a single string or array of strings.
37
+ # Examples Final command to OS
38
+ # run("ls") "ls" => stdout
39
+ # run("ls", "-lah") "ls -lah" => stdout
40
+ # run() N/A => ""
41
+ # run("ls", nil, "-lah") N/A => ""
42
+ # run("ls", "", "-lah") "ls -lah" => stdout
43
+ #
44
+ # @return stdout
45
+ # Please note, that this is not a raw stdout.
46
+ # The output will be modified by String#scrub! in order to avoid invalid byte sequence
47
+ # in UTF-8 (https://stackoverflow.com/a/24037885/6916890).
48
+ def run(*cmd)
49
+ return "" if cmd.empty? || cmd.any?(&:nil?)
50
+ todo = cmd
51
+ todo = [cmd.first] if cmd.size == 1
52
+ `#{todo.join(" ")}`.scrub!
53
+ end
54
+ end
55
+ end
@@ -86,7 +86,7 @@ module Lazylead
86
86
  "Hi [~#{reporter}],",
87
87
  "",
88
88
  "The triage accuracy is '{color:#{color}}#{@score}{color}'" \
89
- " (~{color:#{color}}#{@accuracy}%{color}), here are the reasons why:",
89
+ " (~{color:#{color}}#{@accuracy}%{color}), here are the reasons why:",
90
90
  "|| Ticket requirement || Status || Field ||"
91
91
  ]
92
92
  @opts[:rules].each do |r|
@@ -94,8 +94,7 @@ module Lazylead
94
94
  end
95
95
  comment << docs_link
96
96
  comment << ""
97
- comment << "Posted by [lazylead v#{Lazylead::VERSION}|" \
98
- "https://bit.ly/2NjdndS]."
97
+ comment << "Posted by [lazylead v#{Lazylead::VERSION}|https://bit.ly/2NjdndS]."
99
98
  comment.join("\r\n")
100
99
  end
101
100
 
@@ -28,6 +28,7 @@ module Lazylead
28
28
  # Check that ticket has an attachment.
29
29
  class Attachment < Lazylead::Requirement
30
30
  def passed(issue)
31
+ return false if issue.nil? || issue.attachments.nil?
31
32
  issue.attachments.any? { |a| matches?(a) }
32
33
  end
33
34
 
@@ -22,18 +22,13 @@
22
22
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
- require_relative "requirement"
25
+ require_relative "required"
26
26
 
27
27
  module Lazylead
28
28
  # A requirement that Jira field "Environment" provided by the reporter.
29
- class Environment < Requirement
29
+ class Environment < Lazylead::Required
30
30
  def initialize(score = 0.5)
31
- super "Environment details (URL, patches)", score, "Environment"
32
- end
33
-
34
- # @return true if an issue has non-empty "Environment" field
35
- def passed(issue)
36
- non_blank? issue, "environment"
31
+ super "Environment details (URL, patches)", score, "Environment", "environment"
37
32
  end
38
33
  end
39
34
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "logs"
26
+ require_relative "attachment"
27
+
28
+ module Lazylead
29
+ # Check that ticket has link/reference to log record(s) in another system like ELK, GrayLog, etc.
30
+ # or attachment with plain log file
31
+ class LogsLink < Lazylead::Logs
32
+ def initialize(link)
33
+ super
34
+ @link = link
35
+ end
36
+
37
+ def passed(issue)
38
+ super(issue) || link?(issue)
39
+ end
40
+
41
+ # Ensure that ticket has a link to external logs system like ELK, GrayLog, etc.
42
+ def link?(issue)
43
+ return false if issue.description.nil?
44
+ issue.description
45
+ .split("\n")
46
+ .reject(&:blank?)
47
+ .flat_map(&:split)
48
+ .reject(&:blank?)
49
+ .any? { |word| word.start_with? @link }
50
+ end
51
+ end
52
+ end
@@ -28,7 +28,7 @@ module Lazylead
28
28
  # Check that ticket has video record(s) with reproducing results.
29
29
  class Records < Lazylead::Attachment
30
30
  def initialize(ext = [])
31
- super("Recorded internal reproducing results", 5, "Attachments")
31
+ super("Internal reproducing results (video)", 5, "Attachments")
32
32
  @ext = ext
33
33
  return unless @ext.empty?
34
34
  @ext = %w[.webm .mkv .flv .flv .vob .ogv .ogg .drc .gif .gifv .mng .avi
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "requirement"
26
+
27
+ module Lazylead
28
+ #
29
+ # Check that ticket has mandatory non-blank field(s).
30
+ #
31
+ class Required < Lazylead::Requirement
32
+ def initialize(desc, score, msg, *fields)
33
+ super desc, score, msg
34
+ @fields = fields
35
+ end
36
+
37
+ def passed(issue)
38
+ return false if @fields.nil? || @fields.empty?
39
+ return true if @fields.all? { |f| non_blank?(issue, f) }
40
+ false
41
+ end
42
+ end
43
+ end
@@ -35,15 +35,14 @@ module Lazylead
35
35
  class Screenshots < Lazylead::Requirement
36
36
  # @param minimum The number of expected screenshots
37
37
  def initialize(minimum: 1, score: 2, ext: %w[.jpg .jpeg .exif .tiff .tff .bmp .png .svg])
38
- super "Screenshots", score, "Description,Attachments"
38
+ super "Internal reproducing results (screenshots)", score, "Description,Attachments"
39
39
  @minimum = minimum
40
40
  @ext = ext
41
41
  end
42
42
 
43
43
  def passed(issue)
44
44
  return false if issue.attachments.nil? || blank?(issue, "description")
45
- ref = references(issue)
46
- ref.size < @minimum ? false : ref.all? { |r| pictures(issue).any? { |file| r.include? file } }
45
+ references(issue).count { |r| pictures(issue).any? { |file| r.include? file } } >= @minimum
47
46
  end
48
47
 
49
48
  # Detect all references in ticket description to attachments (including web links).
@@ -32,18 +32,18 @@ module Lazylead
32
32
  # @param envs regexp expressions to match servers in description.
33
33
  #
34
34
  def initialize(score: 2, envs: [], desc: "Internal reproducing results")
35
- super desc, score, "Description/Environment"
35
+ super desc, score, "Description"
36
36
  @envs = envs
37
37
  end
38
38
 
39
39
  def passed(issue)
40
40
  return true if @envs.empty?
41
- "#{issue['environment']}\n#{issue.description}".split("\n")
42
- .reject(&:blank?)
43
- .map(&:strip)
44
- .flat_map { |l| l.split.map(&:strip) }
45
- .select { |u| url?(u) }
46
- .any? { |u| match?(u) }
41
+ issue.description.split("\n")
42
+ .reject(&:blank?)
43
+ .map(&:strip)
44
+ .flat_map { |l| l.split.map(&:strip) }
45
+ .select { |u| url?(u) }
46
+ .any? { |u| match?(u) }
47
47
  end
48
48
 
49
49
  # Ensure that particular text contains web url
@@ -37,11 +37,11 @@ module Lazylead
37
37
  def passed(issue)
38
38
  return false if issue.description.nil?
39
39
  @tc = @ar = @er = -1
40
- issue.description.split("\n").reject(&:blank?).each_with_index do |l, i|
41
- line = escape l.downcase.gsub(/(\s+|\*|\+)/, "")
42
- detect_tc line, i
43
- detect_ar line, i
44
- detect_er line, i
40
+ issue.description.split("\n").reject(&:blank?).map(&:downcase).each_with_index do |l, i|
41
+ line = escape l.gsub(/(\s+|\*|\+)/, "")
42
+ detect_tc i, l, line
43
+ detect_ar i, l, line
44
+ detect_er i, l, line
45
45
  break if with_tc_ar_er?
46
46
  end
47
47
  with_tc_ar_er?
@@ -63,30 +63,37 @@ module Lazylead
63
63
  end
64
64
 
65
65
  # Detect index of line with test case
66
- def detect_tc(line, index)
66
+ # @param index The line number in description
67
+ # @param src The whole line in lower case from description
68
+ # @param strip The escaped line in lower case from description without special symbol(s)
69
+ def detect_tc(index, src, strip)
67
70
  return unless @tc.negative?
68
- @tc = index if eql? line,
69
- %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases steps]
71
+ keywords = %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases steps usecase
72
+ pre-requisitesandsteps:]
73
+ @tc = index if keywords.any? { |k| strip.eql? k }
74
+ @tc = index if keywords.any? { |k| src.include? k }
70
75
  end
71
76
 
72
77
  # Detect index of line with actual result
73
- def detect_ar(line, index)
78
+ # @param index The line number in description
79
+ # @param src The whole line in lower case from description
80
+ # @param strip The escaped line in lower case from description without special symbol(s)
81
+ def detect_ar(index, src, strip)
74
82
  return unless @ar.negative? && index > @tc
75
- @ar = index if starts? line, %w[ar: actualresult: ar= [ar]]
83
+ keywords = %w[ar: actualresult: ar= [ar] actualresult]
84
+ @ar = index if keywords.any? { |k| strip.start_with? k }
85
+ @ar = index if keywords.any? { |k| src.include? k }
76
86
  end
77
87
 
78
88
  # Detect index of line with expected result
79
- def detect_er(line, index)
89
+ # @param index The line number in description
90
+ # @param src The whole line in lower case from description
91
+ # @param strip The escaped line in lower case from description without special symbol(s)
92
+ def detect_er(index, src, strip)
80
93
  return unless @er.negative? && index > @tc
81
- @er = index if starts? line, %w[er: expectedresult: er= [er]]
82
- end
83
-
84
- def starts?(line, text)
85
- text.any? { |t| line.start_with? t }
86
- end
87
-
88
- def eql?(line, text)
89
- text.any? { |t| t.eql? line }
94
+ keywords = %w[er: expectedresult: er= [er] expectedresult]
95
+ @er = index if keywords.any? { |k| strip.start_with? k }
96
+ @er = index if keywords.any? { |k| src.include? k }
90
97
  end
91
98
  end
92
99
  end
@@ -39,15 +39,12 @@ module Lazylead
39
39
  def run(sys, postman, opts)
40
40
  allowed = opts.slice("allowed", ",")
41
41
  silent = opts.key? "silent"
42
- issues = sys.issues(
43
- opts["jql"], opts.jira_defaults.merge(expand: "changelog")
44
- )
42
+ issues = sys.issues(opts["jql"], opts.jira_defaults.merge(expand: "changelog"))
43
+ .map { |i| Version.new(i, allowed, silent) }
44
+ .select(&:changed?)
45
+ .each(&:add_label)
45
46
  return if issues.empty?
46
- postman.send opts.merge(
47
- versions: issues.map { |i| Version.new(i, allowed, silent) }
48
- .select(&:changed?)
49
- .each(&:add_label)
50
- )
47
+ postman.send opts.merge(versions: issues)
51
48
  end
52
49
  end
53
50