lazylead 0.3.1 → 0.5.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.
- checksums.yaml +4 -4
- data/.0pdd.yml +4 -1
- data/.docs/accuracy.md +107 -0
- data/.docs/accuracy_email.jpg +0 -0
- data/.docs/accuracy_jira_comment.jpg +0 -0
- data/.docs/duedate_expired.md +3 -3
- data/.docs/propagate_down.md +4 -4
- data/.gitattributes +1 -0
- data/.github/dependabot.yml +6 -0
- data/.pdd +1 -1
- data/.rubocop.yml +6 -0
- data/Rakefile +2 -0
- data/bin/lazylead +7 -4
- data/lazylead.gemspec +5 -4
- data/lib/lazylead/exchange.rb +16 -9
- data/lib/lazylead/log.rb +30 -8
- data/lib/lazylead/model.rb +78 -22
- data/lib/lazylead/opts.rb +80 -0
- data/lib/lazylead/postman.rb +1 -1
- data/lib/lazylead/schedule.rb +18 -17
- data/lib/lazylead/smtp.rb +1 -1
- data/lib/lazylead/system/jira.rb +55 -14
- data/lib/lazylead/system/synced.rb +2 -1
- data/lib/lazylead/task/accuracy/accuracy.rb +136 -0
- data/lib/lazylead/task/accuracy/affected_build.rb +39 -0
- data/lib/lazylead/task/accuracy/attachment.rb +44 -0
- data/lib/lazylead/task/accuracy/environment.rb +39 -0
- data/lib/lazylead/task/accuracy/logs.rb +40 -0
- data/lib/lazylead/task/accuracy/records.rb +45 -0
- data/lib/lazylead/task/accuracy/requirement.rb +49 -0
- data/lib/lazylead/task/accuracy/servers.rb +50 -0
- data/lib/lazylead/task/accuracy/stacktrace.rb +63 -0
- data/lib/lazylead/task/accuracy/testcase.rb +75 -0
- data/lib/lazylead/task/accuracy/wiki.rb +41 -0
- data/lib/lazylead/task/alert.rb +8 -6
- data/lib/lazylead/task/confluence_ref.rb +4 -3
- data/lib/lazylead/task/echo.rb +22 -0
- data/lib/lazylead/task/fix_version.rb +18 -7
- data/lib/lazylead/task/missing_comment.rb +7 -5
- data/lib/lazylead/task/propagate_down.rb +11 -3
- data/lib/lazylead/task/savepoint.rb +1 -1
- data/lib/lazylead/task/touch.rb +119 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/accuracy.erb +118 -0
- data/lib/messages/svn_log.erb +117 -0
- data/lib/messages/svn_touch.erb +147 -0
- data/license.txt +1 -1
- data/readme.md +20 -19
- data/test/lazylead/cc_test.rb +2 -2
- data/test/lazylead/cli/app_test.rb +12 -12
- data/test/lazylead/exchange_test.rb +3 -3
- data/test/lazylead/model_test.rb +4 -4
- data/test/lazylead/opts_test.rb +70 -0
- data/test/lazylead/postman_test.rb +1 -1
- data/test/lazylead/smtp_test.rb +1 -1
- data/test/lazylead/system/jira_test.rb +65 -1
- data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
- data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
- data/test/lazylead/task/accuracy/attachment_test.rb +50 -0
- data/test/lazylead/task/accuracy/environment_test.rb +42 -0
- data/test/lazylead/task/accuracy/logs_test.rb +78 -0
- data/test/lazylead/task/accuracy/records_test.rb +60 -0
- data/test/lazylead/task/accuracy/servers_test.rb +66 -0
- data/test/lazylead/task/accuracy/stacktrace_test.rb +113 -0
- data/test/lazylead/task/accuracy/testcase_test.rb +205 -0
- data/test/lazylead/task/accuracy/wiki_test.rb +40 -0
- data/test/lazylead/task/assignee_alert_test.rb +2 -2
- data/test/lazylead/task/duedate_test.rb +36 -26
- data/test/lazylead/task/fix_version_test.rb +9 -6
- data/test/lazylead/task/missing_comment_test.rb +11 -9
- data/test/lazylead/task/propagate_down_test.rb +4 -2
- data/test/lazylead/task/touch_test.rb +88 -0
- data/test/test.rb +25 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -5
- data/upgrades/sqlite/999.testdata.sql +12 -16
- metadata +65 -8
- data/.travis.yml +0 -16
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# Check that ticket has an attachment.
|
29
|
+
class Attachment < Lazylead::Requirement
|
30
|
+
def initialize(desc, score, field)
|
31
|
+
super(desc, score, field)
|
32
|
+
end
|
33
|
+
|
34
|
+
def passed(issue)
|
35
|
+
issue.attachments.any?(&method(:matching))
|
36
|
+
end
|
37
|
+
|
38
|
+
# Check a single attachment from ticket.
|
39
|
+
# Potential extension point for custom verification logic.
|
40
|
+
def matching(attachment)
|
41
|
+
!attachment.nil?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# A requirement that Jira field "Environment" provided by the reporter.
|
29
|
+
class Environment < Requirement
|
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"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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 "attachment"
|
26
|
+
|
27
|
+
module Lazylead
|
28
|
+
# Check that ticket has log file(s) in attachment.
|
29
|
+
class Logs < Lazylead::Attachment
|
30
|
+
def initialize
|
31
|
+
super("Log files", 2, "Attachments")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Ensure that ticket has a '*.log' file more '10KB'
|
35
|
+
def matching(attachment)
|
36
|
+
attachment.attrs["size"].to_i > 10_240 &&
|
37
|
+
File.extname(attachment.attrs["filename"]).downcase.start_with?(".log")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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 "attachment"
|
26
|
+
|
27
|
+
module Lazylead
|
28
|
+
# Check that ticket has video record(s) with reproducing results.
|
29
|
+
class Records < Lazylead::Attachment
|
30
|
+
def initialize(ext = [])
|
31
|
+
super("Recorded internal reproducing results", 5, "Attachments")
|
32
|
+
@ext = ext
|
33
|
+
return unless @ext.empty?
|
34
|
+
@ext = %w[.webm .mkv .flv .flv .vob .ogv .ogg .drc .gif .gifv .mng .avi
|
35
|
+
.mts .m2ts .ts .mov .qt .wmv .yuv .rm .rmvb .viv .asf .amv .mp4
|
36
|
+
.m4p .m4v .mpg .mp2 .mpeg .mpe .mpv .mpg .mpeg .m2v .m4v .svi
|
37
|
+
.3gp .3g2 .mxf .roq .nsv .flv .f4v .f4p .f4a .f4b]
|
38
|
+
end
|
39
|
+
|
40
|
+
# Ensure that ticket has an attachment with video-file extension
|
41
|
+
def matching(attach)
|
42
|
+
@ext.any? { |e| e.eql? File.extname(attach.attrs["filename"]).downcase }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# An single requirement regarding ticket format.
|
27
|
+
class Requirement
|
28
|
+
attr_reader :score, :desc, :field
|
29
|
+
|
30
|
+
def initialize(desc, score, field)
|
31
|
+
@desc = desc
|
32
|
+
@score = score
|
33
|
+
@field = field
|
34
|
+
end
|
35
|
+
|
36
|
+
def passed(_)
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
def blank?(issue, field)
|
41
|
+
return false if issue.nil?
|
42
|
+
issue.fields[field].nil? || issue.fields[field].blank?
|
43
|
+
end
|
44
|
+
|
45
|
+
def non_blank?(issue, field)
|
46
|
+
!blank? issue, field
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# Check that ticket has expected links to failed entities on dedicated
|
29
|
+
# servers.
|
30
|
+
class Servers < Lazylead::Requirement
|
31
|
+
#
|
32
|
+
# @param envs regexp expressions to match servers in description.
|
33
|
+
#
|
34
|
+
def initialize(score: 2, envs: [], desc: "Internal reproducing results")
|
35
|
+
super desc, score, "Description/Environment"
|
36
|
+
@envs = envs
|
37
|
+
end
|
38
|
+
|
39
|
+
def passed(issue)
|
40
|
+
return true if @envs.empty?
|
41
|
+
lines = issue["environment"].to_s + "\n" + issue.description
|
42
|
+
lines.split("\n")
|
43
|
+
.reject(&:blank?)
|
44
|
+
.map(&:strip)
|
45
|
+
.flat_map { |l| l.split(" ").map(&:strip) }
|
46
|
+
.select { |w| w.start_with?("http://", "https://") }
|
47
|
+
.any? { |u| @envs.any? { |e| u.match? e } }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# Java stacktrace or Oracle errors in {noformat} section
|
29
|
+
class Stacktrace < Lazylead::Requirement
|
30
|
+
def initialize(score = 3)
|
31
|
+
super "Stacktrace/errors in *\\{noformat\\}* for JIRA indexing", score,
|
32
|
+
"Description"
|
33
|
+
end
|
34
|
+
|
35
|
+
def passed(issue)
|
36
|
+
return false if issue.description.nil?
|
37
|
+
!frames(issue.description).select { |f| oracle?(f) || java?(f) }.empty?
|
38
|
+
end
|
39
|
+
|
40
|
+
# Detect all {noformat} frames in description field
|
41
|
+
def frames(description)
|
42
|
+
description.enum_for(:scan, /(?={noformat})/)
|
43
|
+
.map { Regexp.last_match.offset(0).first }
|
44
|
+
.each_slice(2).map do |f|
|
45
|
+
description[f.first, f.last - f.first + "{noformat}".size]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return true if frame has few lines with java stack frames
|
50
|
+
def java?(frame)
|
51
|
+
allowed = ["at ", "Caused by:"]
|
52
|
+
frame.split("\n")
|
53
|
+
.map(&:strip)
|
54
|
+
.count { |l| allowed.any? { |a| l.start_with? a } } > 3
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return true if frame has Oracle error
|
58
|
+
# @see https://docs.oracle.com/pls/db92/db92.error_search
|
59
|
+
def oracle?(frame)
|
60
|
+
frame.match?(/\WORA-\d{5}:/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# Check the 'Description' field that ticket has mandatory details like
|
29
|
+
# - test case (TC)
|
30
|
+
# - actual result (AR)
|
31
|
+
# - expected result (ER)
|
32
|
+
class Testcase < Lazylead::Requirement
|
33
|
+
def initialize(score = 4)
|
34
|
+
super "Test case with AR/ER", score, "Description"
|
35
|
+
end
|
36
|
+
|
37
|
+
def passed(issue)
|
38
|
+
return false if issue.description.nil?
|
39
|
+
@tc = @ar = @er = -1
|
40
|
+
issue.description.split("\n").reject(&:blank?).each_with_index do |l, i|
|
41
|
+
line = l.gsub(/[^a-zA-Z(:|=)]/, "").downcase
|
42
|
+
detect_tc line, i
|
43
|
+
detect_ar line, i
|
44
|
+
detect_er line, i
|
45
|
+
break if with_tc_ar_er?
|
46
|
+
end
|
47
|
+
with_tc_ar_er?
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return true if description has test case, AR and ER
|
51
|
+
def with_tc_ar_er?
|
52
|
+
(@tc.zero? || @tc.positive?) && @ar.positive? && @er.positive?
|
53
|
+
end
|
54
|
+
|
55
|
+
# Detect index of line with test case
|
56
|
+
def detect_tc(line, index)
|
57
|
+
return unless @tc.negative?
|
58
|
+
@tc = index if %w[testcase: tc: teststeps: teststeps].any? do |e|
|
59
|
+
e.eql? line
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Detect index of line with actual result
|
64
|
+
def detect_ar(line, index)
|
65
|
+
return unless @ar.negative? && index > @tc
|
66
|
+
@ar = index if %w[ar: actualresult: ar=].any? { |e| line.start_with? e }
|
67
|
+
end
|
68
|
+
|
69
|
+
# Detect index of line with expected result
|
70
|
+
def detect_er(line, index)
|
71
|
+
return unless @er.negative? && index > @tc
|
72
|
+
@er = index if %w[er: expectedresult: er=].any? { |e| line.start_with? e }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 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
|
+
# Check that ticket has a remote link to external system with relationship
|
29
|
+
# type = "Wiki Page".
|
30
|
+
class Wiki < Lazylead::Requirement
|
31
|
+
def initialize(score = 2, relationship = "Wiki Page")
|
32
|
+
super "Reference to design specification", score, "Ticket Links (Wiki)"
|
33
|
+
@relationship = relationship
|
34
|
+
end
|
35
|
+
|
36
|
+
def passed(issue)
|
37
|
+
return false if issue.remote_links.nil? || issue.remote_links.empty?
|
38
|
+
issue.remote_links.any? { |l| @relationship.eql? l.attrs["relationship"] }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|