lazylead 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lazylead.gemspec +4 -4
- data/lib/lazylead/task/accuracy/accuracy.rb +14 -2
- data/lib/lazylead/task/accuracy/screenshots.rb +16 -7
- data/lib/lazylead/version.rb +1 -1
- data/test/lazylead/task/accuracy/score_test.rb +11 -0
- data/test/lazylead/task/accuracy/screenshots_test.rb +47 -5
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81d974a6e2fd3b5417524a420005f1d12714fabab71ead5dd7c9fc6e04582981
|
4
|
+
data.tar.gz: a181d093106c36c8d57a47a802fd21bd2a7c0b9ce4bbf09622721ed648481c07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82388742ae4f14b8012b034631beb488ecdef5632c189ffa45fc1cc1947992051eef45d4444a2bef7d950b71e7e634f1c1ab8a63be77e355596ec87a3879cfd4
|
7
|
+
data.tar.gz: c1d297f36c42b0e4676211c52da716d05cca80561706d2e38406076d4b5ccd83834f431919803fd576428dae1d422c95f79473c3643e95d1a54bbf8278ec9fbd
|
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.
|
35
|
+
s.version = "0.8.3"
|
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.
|
48
|
+
s.post_install_message = "Thanks for installing Lazylead v0.8.3!
|
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
|
@@ -90,8 +90,8 @@ tasks instead of solving technical problems."
|
|
90
90
|
s.add_development_dependency "rake", "13.0.3"
|
91
91
|
s.add_development_dependency "random-port", "0.5.1"
|
92
92
|
s.add_development_dependency "rdoc", "6.3.0"
|
93
|
-
s.add_development_dependency "rubocop", "1.12.
|
94
|
-
s.add_development_dependency "rubocop-minitest", "0.11.
|
93
|
+
s.add_development_dependency "rubocop", "1.12.1"
|
94
|
+
s.add_development_dependency "rubocop-minitest", "0.11.1"
|
95
95
|
s.add_development_dependency "rubocop-performance", "1.10.2"
|
96
96
|
s.add_development_dependency "rubocop-rake", "0.5.1"
|
97
97
|
s.add_development_dependency "rubocop-rspec", "2.2.0"
|
@@ -47,7 +47,7 @@ module Lazylead
|
|
47
47
|
Requires.new(__dir__).load
|
48
48
|
opts[:rules] = opts.construct("rules")
|
49
49
|
opts[:total] = opts[:rules].sum(&:score)
|
50
|
-
opts[:tickets] = sys.issues(opts["jql"], opts.jira_defaults)
|
50
|
+
opts[:tickets] = sys.issues(opts["jql"], opts.jira_defaults.merge(expand: "changelog"))
|
51
51
|
.map { |i| Score.new(i, opts) }
|
52
52
|
.each(&:evaluate)
|
53
53
|
.each(&:post)
|
@@ -83,7 +83,7 @@ module Lazylead
|
|
83
83
|
# The jira comment in markdown format
|
84
84
|
def comment
|
85
85
|
comment = [
|
86
|
-
"Hi [~#{
|
86
|
+
"Hi [~#{reporter}],",
|
87
87
|
"",
|
88
88
|
"The triage accuracy is '{color:#{color}}#{@score}{color}'" \
|
89
89
|
" (~{color:#{color}}#{@accuracy}%{color}), here are the reasons why:",
|
@@ -133,5 +133,17 @@ module Lazylead
|
|
133
133
|
def grade(value)
|
134
134
|
(value / 10).floor * 10
|
135
135
|
end
|
136
|
+
|
137
|
+
# Detect the ticket reporter.
|
138
|
+
#
|
139
|
+
# If ticket created by some automatic/admin user account then reporter is the first non-system
|
140
|
+
# user account who modified the ticket.
|
141
|
+
def reporter
|
142
|
+
return @issue.reporter.id unless @opts.key? "system-users"
|
143
|
+
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"]
|
147
|
+
end
|
136
148
|
end
|
137
149
|
end
|
@@ -29,11 +29,12 @@ module Lazylead
|
|
29
29
|
# Check that ticket has screenshot(s).
|
30
30
|
# The screenshots should
|
31
31
|
# 1. present as attachments
|
32
|
-
# 2.
|
32
|
+
# 2. has extension .jpg .jpeg .exif .tiff .tff .bmp .png .svg
|
33
|
+
# 3. mentioned in description with !<name>.<extension>|thumbnail! (read more https://bit.ly/3rusNgW)
|
33
34
|
#
|
34
35
|
class Screenshots < Lazylead::Requirement
|
35
36
|
# @param minimum The number of expected screenshots
|
36
|
-
def initialize(minimum:
|
37
|
+
def initialize(minimum: 1, score: 2, ext: %w[.jpg .jpeg .exif .tiff .tff .bmp .png .svg])
|
37
38
|
super "Screenshots", score, "Description,Attachments"
|
38
39
|
@minimum = minimum
|
39
40
|
@ext = ext
|
@@ -41,11 +42,19 @@ module Lazylead
|
|
41
42
|
|
42
43
|
def passed(issue)
|
43
44
|
return false if issue.attachments.nil? || blank?(issue, "description")
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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 } }
|
51
|
+
end
|
52
|
+
|
53
|
+
# Detect all pictures in ticket attachments and returns an array with file names.
|
54
|
+
def pictures(issue)
|
55
|
+
@pictures ||= issue.attachments
|
56
|
+
.select { |a| @ext.include? File.extname(a.filename).downcase }
|
57
|
+
.map(&:filename)
|
49
58
|
end
|
50
59
|
end
|
51
60
|
end
|
data/lib/lazylead/version.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
|
25
25
|
require_relative "../../../test"
|
26
|
+
require_relative "../../../../lib/lazylead/system/jira"
|
26
27
|
require_relative "../../../../lib/lazylead/task/accuracy/accuracy"
|
27
28
|
require_relative "../../../../lib/lazylead/task/accuracy/affected_build"
|
28
29
|
|
@@ -69,5 +70,15 @@ module Lazylead
|
|
69
70
|
)
|
70
71
|
).evaluate.comment
|
71
72
|
end
|
73
|
+
|
74
|
+
test "detect non-system reporter" do
|
75
|
+
assert_equal "grussell",
|
76
|
+
Score.new(
|
77
|
+
NoAuthJira.new("https://jira.spring.io")
|
78
|
+
.issues("key=INT-4116", expand: "changelog")
|
79
|
+
.first,
|
80
|
+
Opts.new("system-users" => "abilan")
|
81
|
+
).reporter
|
82
|
+
end
|
72
83
|
end
|
73
84
|
end
|
@@ -51,13 +51,11 @@ module Lazylead
|
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
54
|
-
test "issue has
|
54
|
+
test "issue has no .png file however minimum 1 are required" do
|
55
55
|
refute Screenshots.new.passed(
|
56
56
|
OpenStruct.new(
|
57
|
-
description: "Hi,\n here are snapshots !img1.
|
58
|
-
fields: {
|
59
|
-
"description" => "Hi,\n here are snapshots !img1.jpg|thumbnail!\n"
|
60
|
-
},
|
57
|
+
description: "Hi,\n here are snapshots !img1.zip!\n",
|
58
|
+
fields: { "description" => "Hi,\n here are snapshots !img1.zip!\n" },
|
61
59
|
attachments: [
|
62
60
|
OpenStruct.new("filename" => "img1.jpg"),
|
63
61
|
OpenStruct.new("filename" => "img2.jpg")
|
@@ -80,5 +78,49 @@ module Lazylead
|
|
80
78
|
)
|
81
79
|
)
|
82
80
|
end
|
81
|
+
|
82
|
+
test "issue has two .png file in description but three .png in attachments" do
|
83
|
+
assert Screenshots.new.passed(
|
84
|
+
OpenStruct.new(
|
85
|
+
description: "Hi,\n here are snapshots !img1.JPG|thumbnail!\n!img2.jpg|thumbnail!\n",
|
86
|
+
fields: {
|
87
|
+
"description" => "Hi,\n here are snapshots !img1.JPG|thumbnail!\n!img2.jpg|thumbnail!\n"
|
88
|
+
},
|
89
|
+
attachments: [
|
90
|
+
OpenStruct.new("filename" => "img1.JPG"),
|
91
|
+
OpenStruct.new("filename" => "img2.jpg"),
|
92
|
+
OpenStruct.new("filename" => "img3.jpg")
|
93
|
+
]
|
94
|
+
)
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
test "issue has two .png files with reference in description without thumbnail" do
|
99
|
+
assert Screenshots.new.passed(
|
100
|
+
OpenStruct.new(
|
101
|
+
description: "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n",
|
102
|
+
fields: { "description" => "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n" },
|
103
|
+
attachments: [
|
104
|
+
OpenStruct.new("filename" => "img1.jpg"),
|
105
|
+
OpenStruct.new("filename" => "img2.jpg")
|
106
|
+
]
|
107
|
+
)
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
test "issue has two .png files with reference in description but absent in attachments" do
|
112
|
+
refute Screenshots.new.passed(
|
113
|
+
OpenStruct.new(
|
114
|
+
description: "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n",
|
115
|
+
fields: {
|
116
|
+
"description" => "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n"
|
117
|
+
},
|
118
|
+
attachments: [
|
119
|
+
OpenStruct.new("filename" => "img3.jpg"),
|
120
|
+
OpenStruct.new("filename" => "img4.jpg")
|
121
|
+
]
|
122
|
+
)
|
123
|
+
)
|
124
|
+
end
|
83
125
|
end
|
84
126
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazylead
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yurii Dubinka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -506,28 +506,28 @@ dependencies:
|
|
506
506
|
requirements:
|
507
507
|
- - '='
|
508
508
|
- !ruby/object:Gem::Version
|
509
|
-
version: 1.12.
|
509
|
+
version: 1.12.1
|
510
510
|
type: :development
|
511
511
|
prerelease: false
|
512
512
|
version_requirements: !ruby/object:Gem::Requirement
|
513
513
|
requirements:
|
514
514
|
- - '='
|
515
515
|
- !ruby/object:Gem::Version
|
516
|
-
version: 1.12.
|
516
|
+
version: 1.12.1
|
517
517
|
- !ruby/object:Gem::Dependency
|
518
518
|
name: rubocop-minitest
|
519
519
|
requirement: !ruby/object:Gem::Requirement
|
520
520
|
requirements:
|
521
521
|
- - '='
|
522
522
|
- !ruby/object:Gem::Version
|
523
|
-
version: 0.11.
|
523
|
+
version: 0.11.1
|
524
524
|
type: :development
|
525
525
|
prerelease: false
|
526
526
|
version_requirements: !ruby/object:Gem::Requirement
|
527
527
|
requirements:
|
528
528
|
- - '='
|
529
529
|
- !ruby/object:Gem::Version
|
530
|
-
version: 0.11.
|
530
|
+
version: 0.11.1
|
531
531
|
- !ruby/object:Gem::Dependency
|
532
532
|
name: rubocop-performance
|
533
533
|
requirement: !ruby/object:Gem::Requirement
|
@@ -783,7 +783,7 @@ licenses:
|
|
783
783
|
- MIT
|
784
784
|
metadata: {}
|
785
785
|
post_install_message: |-
|
786
|
-
Thanks for installing Lazylead v0.8.
|
786
|
+
Thanks for installing Lazylead v0.8.3!
|
787
787
|
Read our blog posts: https://lazylead.org
|
788
788
|
Stay in touch with the community in Telegram: https://t.me/lazylead
|
789
789
|
Follow us on Twitter: https://twitter.com/lazylead
|