lazylead 0.8.3 → 0.10.0

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.docker/docker-compose.yml +1 -1
  3. data/.rubocop.yml +1 -0
  4. data/Rakefile +2 -3
  5. data/bin/lazylead +3 -0
  6. data/lazylead.gemspec +14 -14
  7. data/lib/lazylead/confluence.rb +1 -2
  8. data/lib/lazylead/log.rb +11 -0
  9. data/lib/lazylead/os.rb +55 -0
  10. data/lib/lazylead/system/jira.rb +10 -7
  11. data/lib/lazylead/task/accuracy/accuracy.rb +6 -7
  12. data/lib/lazylead/task/accuracy/attachment.rb +1 -0
  13. data/lib/lazylead/task/accuracy/logs_link.rb +52 -0
  14. data/lib/lazylead/task/accuracy/screenshots.rb +10 -6
  15. data/lib/lazylead/task/accuracy/testcase.rb +4 -4
  16. data/lib/lazylead/task/assignment.rb +9 -13
  17. data/lib/lazylead/task/fix_version.rb +5 -8
  18. data/lib/lazylead/task/loading.rb +6 -1
  19. data/lib/lazylead/task/micromanager.rb +111 -0
  20. data/lib/lazylead/task/svn/diff.rb +11 -11
  21. data/lib/lazylead/task/svn/grep.rb +8 -71
  22. data/lib/lazylead/task/svn/svn.rb +107 -0
  23. data/lib/lazylead/task/svn/touch.rb +5 -7
  24. data/lib/lazylead/version.rb +1 -1
  25. data/lib/messages/illegal_assignee_change.erb +1 -2
  26. data/lib/messages/illegal_duedate_change.erb +122 -0
  27. data/lib/messages/loading.erb +9 -8
  28. data/lib/messages/svn_diff.erb +29 -29
  29. data/lib/messages/svn_diff_attachment.erb +5 -7
  30. data/lib/messages/svn_grep.erb +34 -32
  31. data/readme.md +8 -5
  32. data/test/lazylead/system/jira_test.rb +8 -0
  33. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  34. data/test/lazylead/task/accuracy/logs_link_test.rb +50 -0
  35. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  36. data/test/lazylead/task/accuracy/screenshots_test.rb +16 -4
  37. data/test/lazylead/task/accuracy/testcase_test.rb +27 -0
  38. data/test/lazylead/task/alert/alertif_test.rb +2 -1
  39. data/test/lazylead/task/assignment_test.rb +2 -1
  40. data/test/lazylead/task/created_recently_test.rb +2 -1
  41. data/test/lazylead/task/duedate_test.rb +2 -2
  42. data/test/lazylead/task/fix_version_test.rb +2 -1
  43. data/test/lazylead/task/loading_test.rb +9 -4
  44. data/test/lazylead/task/micromanager_test.rb +61 -0
  45. data/test/lazylead/task/missing_comment_test.rb +1 -1
  46. data/test/lazylead/task/svn/diff_test.rb +1 -1
  47. data/test/lazylead/task/svn/grep_test.rb +2 -1
  48. data/test/test.rb +4 -3
  49. metadata +36 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81d974a6e2fd3b5417524a420005f1d12714fabab71ead5dd7c9fc6e04582981
4
- data.tar.gz: a181d093106c36c8d57a47a802fd21bd2a7c0b9ce4bbf09622721ed648481c07
3
+ metadata.gz: 487f4f5deba01c6b85f9730f2652d5b70af87822206acd256de236051f8f3af9
4
+ data.tar.gz: f8ac846170c9bade03fa003b16bd27b86b0565a0218afdc315a1ae1b1ca7794f
5
5
  SHA512:
6
- metadata.gz: 82388742ae4f14b8012b034631beb488ecdef5632c189ffa45fc1cc1947992051eef45d4444a2bef7d950b71e7e634f1c1ab8a63be77e355596ec87a3879cfd4
7
- data.tar.gz: c1d297f36c42b0e4676211c52da716d05cca80561706d2e38406076d4b5ccd83834f431919803fd576428dae1d422c95f79473c3643e95d1a54bbf8278ec9fbd
6
+ metadata.gz: 81c5cfc1ccb93691b58250b5a27b41963e37f2c375195483dbd8e21e1da3fbbe0c94944cef83b38c821a10297d62152e20dc36eb39ed50d1724f5badae4bd3af
7
+ data.tar.gz: cb01af60779d0555610ea2f2b993ad61880863fe3515154bbcf0415f4e003a30a7a461bbc1907f8ff61461aaf6715fbe4190eecc4a2fa1210c36dc171d59cba7
@@ -20,4 +20,4 @@ services:
20
20
  volumes:
21
21
  - .local/dumps:/lazylead/dumps
22
22
  - .local/logs:/lazylead/logs
23
- entrypoint: bin/lazylead --trace --verbose
23
+ entrypoint: bin/lazylead --trace --verbose --log-file /lazylead/logs/ll{{.%Y-%m-%dT%H:%M:%S}}.log
data/.rubocop.yml CHANGED
@@ -15,6 +15,7 @@ Layout/LineLength:
15
15
  Exclude:
16
16
  - "*.gemspec"
17
17
  - "test/**/*"
18
+ - "bin/lazylead"
18
19
 
19
20
  Metrics/AbcSize:
20
21
  Max: 21
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ def version
45
45
  Gem::Specification.load(Dir["*.gemspec"].first).version
46
46
  end
47
47
 
48
- task default: %i[clean test rubocop sqlint xcop copyright docker]
48
+ task default: %i[clean rubocop test sqlint xcop copyright docker]
49
49
 
50
50
  require "rake/testtask"
51
51
  desc "Run all unit tests"
@@ -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/bin/lazylead CHANGED
@@ -70,6 +70,9 @@ Available options:"
70
70
  o.bool "--testdata",
71
71
  "Apply the database VCS migration with test data",
72
72
  default: false
73
+ o.string "--log-file", "The path to the log file"
74
+ o.string "--rolling-age", "The maximum age (in seconds) of a log file before it is rolled. The age can also be given as 'daily', 'weekly', or 'monthly'"
75
+ o.string "--rolling-files", "The number of rolled log files to keep."
73
76
  o.on "--verbose", "Enable extra logging information" do
74
77
  log.verbose
75
78
  end
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.8.3"
35
+ s.version = "0.10.0"
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.8.3!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.10.0!
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.3.0"
61
+ s.add_runtime_dependency "faraday", "1.5.0"
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"
@@ -79,22 +79,22 @@ tasks instead of solving technical problems."
79
79
  s.add_runtime_dependency "tzinfo-data", "1.2021.1"
80
80
  s.add_runtime_dependency "vcs4sql", "0.1.1"
81
81
  s.add_runtime_dependency "viewpoint", "1.1.1"
82
- s.add_development_dependency "codecov", "0.5.1"
83
- s.add_development_dependency "guard", "2.16.2"
82
+ s.add_development_dependency "codecov", "0.5.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.4"
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.12.1"
94
- s.add_development_dependency "rubocop-minitest", "0.11.1"
95
- s.add_development_dependency "rubocop-performance", "1.10.2"
96
- s.add_development_dependency "rubocop-rake", "0.5.1"
97
- s.add_development_dependency "rubocop-rspec", "2.2.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.3"
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
 
data/lib/lazylead/log.rb CHANGED
@@ -74,6 +74,15 @@ module Lazylead
74
74
  )
75
75
  )
76
76
 
77
+ if ARGV.include? "--log-file"
78
+ name = ARGV[ARGV.find_index("--log-file") + 1]
79
+ age = "daily"
80
+ age = ARGV[ARGV.find_index("--rolling-age") + 1] if ARGV.include? "--rolling-age"
81
+ files = 7
82
+ files = ARGV[ARGV.find_index("--rolling-files") + 1] if ARGV.include? "--rolling-files"
83
+ FILE_APPENDER = Logging.appenders.rolling_file("file", filename: name, age: age, keep: files)
84
+ end
85
+
77
86
  # Nothing to log
78
87
  NOTHING = Logging.logger["nothing"]
79
88
  NOTHING.level = :off
@@ -83,12 +92,14 @@ module Lazylead
83
92
  DEBUG = Logging.logger["debug"]
84
93
  DEBUG.level = :debug
85
94
  DEBUG.add_appenders "stdout"
95
+ DEBUG.add_appenders(FILE_APPENDER) if ARGV.include? "--log-file"
86
96
  DEBUG.freeze
87
97
 
88
98
  # Alerts/errors
89
99
  ERRORS = Logging.logger["errors"]
90
100
  ERRORS.level = :error
91
101
  ERRORS.add_appenders "stdout"
102
+ ERRORS.add_appenders(FILE_APPENDER) if ARGV.include? "--log-file"
92
103
  ERRORS.freeze
93
104
  end
94
105
  end
@@ -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
@@ -129,11 +129,7 @@ module Lazylead
129
129
  end
130
130
 
131
131
  def to_s
132
- inspect
133
- end
134
-
135
- def inspect
136
- "#{@opts['site']} (#{@opts['username']})"
132
+ "#{name} (#{id})"
137
133
  end
138
134
  end
139
135
 
@@ -257,13 +253,20 @@ module Lazylead
257
253
 
258
254
  # Update the labels for a particular issue
259
255
  def labels!(lbl)
260
- return if lbl.nil? || lbl.empty?
261
- save!("fields" => { "labels" => lbl.uniq })
256
+ save!("fields" => { "labels" => lbl.uniq }) unless lbl.empty?
262
257
  end
263
258
 
264
259
  def save!(opts)
265
260
  @issue.save(opts)
266
261
  end
262
+
263
+ def sprint(field = "customfield_10480")
264
+ @sprint ||= if fields[field].nil? || fields[field].empty?
265
+ ""
266
+ else
267
+ fields[field].first.split(",").find { |text| text.starts_with? "name=" }[5..]
268
+ end
269
+ end
267
270
  end
268
271
 
269
272
  # The jira issue comments
@@ -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
 
@@ -139,11 +138,11 @@ module Lazylead
139
138
  # If ticket created by some automatic/admin user account then reporter is the first non-system
140
139
  # user account who modified the ticket.
141
140
  def reporter
142
- return @issue.reporter.id unless @opts.key? "system-users"
143
141
  sys = @opts.slice("system-users", ",")
144
- return @issue.reporter.id if sys.empty? || sys.none? { |susr| @issue.reporter.id.eql? susr }
145
- @issue.history
146
- .find { |h| sys.none? { |susr| susr.eql? h["author"]["key"] } }["author"]["key"]
142
+ return @issue.reporter.id if sys.empty? || sys.none? { |susr| susr.eql? @issue.reporter.id }
143
+ first = @issue.history.find { |h| sys.none? { |susr| susr.eql? h["author"]["key"] } }
144
+ return @issue.reporter.id if first.nil?
145
+ first["author"]["key"]
147
146
  end
148
147
  end
149
148
  end
@@ -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
 
@@ -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
@@ -42,12 +42,16 @@ module Lazylead
42
42
 
43
43
  def passed(issue)
44
44
  return false if issue.attachments.nil? || blank?(issue, "description")
45
- references = issue.description
46
- .to_enum(:scan, /!.+!/)
47
- .map { Regexp.last_match }
48
- .map(&:to_s)
49
- return false if references.size < @minimum
50
- references.all? { |ref| pictures(issue).any? { |file| ref.include? file } }
45
+ references(issue).count { |r| pictures(issue).any? { |file| r.include? file } } >= @minimum
46
+ end
47
+
48
+ # Detect all references in ticket description to attachments (including web links).
49
+ def references(issue)
50
+ issue.description
51
+ .to_enum(:scan, /!.+!/)
52
+ .map { Regexp.last_match }
53
+ .map(&:to_s)
54
+ .reject { |r| r.match?(%r{(http|https)://.*/images/icons/link_attachment.*.gif}) }
51
55
  end
52
56
 
53
57
  # Detect all pictures in ticket attachments and returns an array with file names.
@@ -65,20 +65,20 @@ module Lazylead
65
65
  # Detect index of line with test case
66
66
  def detect_tc(line, index)
67
67
  return unless @tc.negative?
68
- @tc = index if eql? line,
69
- %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases steps]
68
+ @tc = index if eql? line, %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases
69
+ steps usecase pre-requisitesandsteps:]
70
70
  end
71
71
 
72
72
  # Detect index of line with actual result
73
73
  def detect_ar(line, index)
74
74
  return unless @ar.negative? && index > @tc
75
- @ar = index if starts? line, %w[ar: actualresult: ar= [ar]]
75
+ @ar = index if starts? line, %w[ar: actualresult: ar= [ar] actualresult]
76
76
  end
77
77
 
78
78
  # Detect index of line with expected result
79
79
  def detect_er(line, index)
80
80
  return unless @er.negative? && index > @tc
81
- @er = index if starts? line, %w[er: expectedresult: er= [er]]
81
+ @er = index if starts? line, %w[er: expectedresult: er= [er] expectedresult]
82
82
  end
83
83
 
84
84
  def starts?(line, text)
@@ -43,14 +43,12 @@ module Lazylead
43
43
  def run(sys, postman, opts)
44
44
  allowed = opts.slice "allowed", ","
45
45
  silent = opts.key? "silent"
46
- issues = sys.issues opts["jql"],
47
- opts.jira_defaults.merge(expand: "changelog")
48
- return if issues.empty?
49
- postman.send opts.merge(
50
- assignees: issues.map { |i| Assignee.new(i, allowed, silent) }
51
- .select(&:illegal?)
52
- .each(&:add_label)
53
- )
46
+ assignees = sys.issues(opts["jql"], opts.jira_defaults.merge(expand: "changelog"))
47
+ .map { |i| Assignee.new(i, allowed, silent) }
48
+ .select(&:illegal?)
49
+ .each(&:add_label)
50
+ return if assignees.empty?
51
+ postman.send opts.merge(assignees: assignees)
54
52
  end
55
53
  end
56
54
 
@@ -67,10 +65,8 @@ module Lazylead
67
65
  # Gives true when last change of "Assignee" field was done
68
66
  # by not authorized person.
69
67
  def illegal?
70
- @allowed.none? do |a|
71
- return false if last.nil?
72
- a == last["author"]["name"]
73
- end
68
+ return false if last.nil? || @issue.assignee.id.eql?(last["author"]["name"])
69
+ @allowed.none? { |a| a.eql? last["author"]["name"] }
74
70
  end
75
71
 
76
72
  # Detect details about last change of "Assignee" to non-null value
@@ -89,7 +85,7 @@ module Lazylead
89
85
 
90
86
  # The name of current assignee for ticket
91
87
  def to
92
- @issue.fields["assignee"]["name"]
88
+ @issue.fields["assignee"]["displayName"]
93
89
  end
94
90
  end
95
91
  end