lazylead 0.7.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.docker/docker-compose.yml +1 -1
  3. data/.docs/duedate_expired.md +1 -1
  4. data/.rubocop.yml +20 -3
  5. data/Gemfile +1 -1
  6. data/Rakefile +2 -2
  7. data/bin/lazylead +4 -1
  8. data/lazylead.gemspec +15 -14
  9. data/lib/lazylead.rb +2 -2
  10. data/lib/lazylead/allocated.rb +1 -1
  11. data/lib/lazylead/cc.rb +17 -23
  12. data/lib/lazylead/cli/app.rb +1 -1
  13. data/lib/lazylead/confluence.rb +1 -1
  14. data/lib/lazylead/email.rb +1 -1
  15. data/lib/lazylead/exchange.rb +1 -1
  16. data/lib/lazylead/home.rb +1 -1
  17. data/lib/lazylead/log.rb +12 -1
  18. data/lib/lazylead/model.rb +6 -8
  19. data/lib/lazylead/opts.rb +6 -3
  20. data/lib/lazylead/postman.rb +1 -1
  21. data/{Guardfile → lib/lazylead/requires.rb} +13 -8
  22. data/lib/lazylead/salt.rb +1 -1
  23. data/lib/lazylead/schedule.rb +1 -1
  24. data/lib/lazylead/smtp.rb +1 -1
  25. data/lib/lazylead/system/empty.rb +1 -1
  26. data/lib/lazylead/system/fake.rb +1 -1
  27. data/lib/lazylead/system/jira.rb +30 -25
  28. data/lib/lazylead/system/synced.rb +1 -1
  29. data/lib/lazylead/task/accuracy/accuracy.rb +36 -28
  30. data/lib/lazylead/task/accuracy/affected_build.rb +1 -1
  31. data/lib/lazylead/task/accuracy/attachment.rb +1 -1
  32. data/lib/lazylead/task/accuracy/environment.rb +1 -1
  33. data/lib/lazylead/task/accuracy/logs.rb +1 -1
  34. data/lib/lazylead/task/accuracy/onlyll.rb +6 -8
  35. data/lib/lazylead/task/accuracy/records.rb +1 -1
  36. data/lib/lazylead/task/accuracy/requirement.rb +1 -1
  37. data/lib/lazylead/task/accuracy/screenshots.rb +60 -0
  38. data/lib/lazylead/task/accuracy/servers.rb +1 -1
  39. data/lib/lazylead/task/accuracy/stacktrace.rb +1 -1
  40. data/lib/lazylead/task/accuracy/testcase.rb +1 -1
  41. data/lib/lazylead/task/accuracy/wiki.rb +1 -1
  42. data/lib/lazylead/task/{alert.rb → alert/alert.rb} +6 -6
  43. data/lib/lazylead/task/alert/alertif.rb +75 -0
  44. data/lib/lazylead/task/alert/changed_to.rb +58 -0
  45. data/lib/lazylead/task/assignment.rb +3 -5
  46. data/lib/lazylead/task/confluence_ref.rb +1 -1
  47. data/lib/lazylead/task/echo.rb +1 -1
  48. data/lib/lazylead/task/fix_version.rb +1 -1
  49. data/lib/lazylead/task/loading.rb +98 -0
  50. data/lib/lazylead/task/micromanager.rb +87 -0
  51. data/lib/lazylead/task/missing_comment.rb +1 -1
  52. data/lib/lazylead/task/propagate_down.rb +3 -3
  53. data/lib/lazylead/task/savepoint.rb +1 -1
  54. data/lib/lazylead/task/svn/diff.rb +29 -7
  55. data/lib/lazylead/task/svn/grep.rb +1 -1
  56. data/lib/lazylead/task/svn/touch.rb +1 -1
  57. data/lib/lazylead/version.rb +2 -2
  58. data/lib/messages/accuracy.erb +1 -1
  59. data/lib/messages/alertif.erb +134 -0
  60. data/lib/messages/created_recently.erb +110 -0
  61. data/lib/messages/illegal_duedate_change.erb +120 -0
  62. data/lib/messages/loading.erb +122 -0
  63. data/readme.md +26 -18
  64. data/test/lazylead/allocated_test.rb +1 -1
  65. data/test/lazylead/cc_test.rb +1 -1
  66. data/test/lazylead/cli/app_test.rb +2 -2
  67. data/test/lazylead/confluence_test.rb +1 -1
  68. data/test/lazylead/exchange_test.rb +1 -1
  69. data/test/lazylead/model_test.rb +1 -1
  70. data/test/lazylead/opts_test.rb +1 -1
  71. data/test/lazylead/postman_test.rb +1 -1
  72. data/test/lazylead/salt_test.rb +1 -1
  73. data/test/lazylead/smoke_test.rb +1 -1
  74. data/test/lazylead/smtp_test.rb +1 -1
  75. data/test/lazylead/system/jira_test.rb +10 -1
  76. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  77. data/test/lazylead/task/accuracy/affected_build_test.rb +1 -1
  78. data/test/lazylead/task/accuracy/attachment_test.rb +1 -1
  79. data/test/lazylead/task/accuracy/environment_test.rb +1 -1
  80. data/test/lazylead/task/accuracy/logs_test.rb +1 -1
  81. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  82. data/test/lazylead/task/accuracy/records_test.rb +1 -1
  83. data/test/lazylead/task/accuracy/score_test.rb +40 -2
  84. data/test/lazylead/task/accuracy/screenshots_test.rb +126 -0
  85. data/test/lazylead/task/accuracy/servers_test.rb +1 -1
  86. data/test/lazylead/task/accuracy/stacktrace_test.rb +1 -1
  87. data/test/lazylead/task/accuracy/testcase_test.rb +1 -1
  88. data/test/lazylead/task/accuracy/wiki_test.rb +1 -1
  89. data/test/lazylead/task/alert/alertif_test.rb +54 -0
  90. data/test/lazylead/task/{assignee_alert_test.rb → alert/assignee_alert_test.rb} +10 -10
  91. data/test/lazylead/task/alert/changed_to_test.rb +42 -0
  92. data/test/lazylead/task/assignment_test.rb +1 -1
  93. data/test/lazylead/task/confluence_ref_test.rb +1 -1
  94. data/test/lazylead/task/created_recently_test.rb +53 -0
  95. data/test/lazylead/task/duedate_test.rb +2 -2
  96. data/test/lazylead/task/echo_test.rb +1 -1
  97. data/test/lazylead/task/fix_version_test.rb +1 -1
  98. data/test/lazylead/task/loading_test.rb +55 -0
  99. data/test/lazylead/task/micromanager_test.rb +54 -0
  100. data/test/lazylead/task/missing_comment_test.rb +1 -1
  101. data/test/lazylead/task/propagate_down_test.rb +1 -1
  102. data/test/lazylead/task/savepoint_test.rb +1 -1
  103. data/test/lazylead/task/svn/diff_test.rb +8 -4
  104. data/test/lazylead/task/svn/grep_test.rb +1 -1
  105. data/test/lazylead/task/svn/touch_test.rb +1 -1
  106. data/test/lazylead/version_test.rb +1 -1
  107. data/test/sqlite_test.rb +1 -1
  108. data/test/test.rb +13 -1
  109. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -1
  110. data/upgrades/sqlite/999.testdata.sql +1 -1
  111. metadata +64 -29
@@ -0,0 +1,122 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <style> /* CSS styles taken from https://github.com/yegor256/tacit */
5
+ th {
6
+ font-weight: 600
7
+ }
8
+
9
+ table tr {
10
+ border-bottom-width: 2.16px
11
+ }
12
+
13
+ table tr th {
14
+ border-bottom-width: 2.16px
15
+ }
16
+
17
+ table tr td, table tr th {
18
+ overflow: hidden;
19
+ padding: 5.4px 3.6px;
20
+ line-height: 20px;
21
+ }
22
+
23
+ .auto {
24
+ min-width: auto;
25
+ white-space: nowrap;
26
+ }
27
+
28
+ a {
29
+ color: #275a90;
30
+ text-decoration: none
31
+ }
32
+
33
+ a:hover {
34
+ text-decoration: underline
35
+ }
36
+
37
+ * {
38
+ border: 0;
39
+ border-collapse: separate;
40
+ border-spacing: 0;
41
+ box-sizing: border-box;
42
+ margin: 0;
43
+ max-width: 100%;
44
+ padding: 0;
45
+ vertical-align: baseline;
46
+ font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
47
+ font-size: 13px;
48
+ font-stretch: normal;
49
+ font-style: normal;
50
+ font-weight: 400;
51
+ }
52
+
53
+ html, body {
54
+ width: 100%
55
+ }
56
+
57
+ html {
58
+ height: 100%
59
+ }
60
+
61
+ body {
62
+ background: #fff;
63
+ color: #1a1919;
64
+ padding: 36px
65
+ }
66
+ </style>
67
+ <title>Loading</title>
68
+ </head>
69
+ <body>
70
+ <table summary="tickets">
71
+ <tr>
72
+ <th id="uid">ID</th>
73
+ <th id="name">User</th>
74
+ <th id="total">
75
+ <a href="https://jira.spring.io/issues/?jql=<%= CGI.escape(jql) %>">Assigned From</a>
76
+ </th>
77
+ <th id="duedate">Next Due date</th>
78
+ </tr>
79
+ <% assignments.each do |teammate, assignment| %>
80
+ <% if assignment.free? %>
81
+ <tr style="background: #FCEC88">
82
+ <% else %>
83
+ <tr>
84
+ <% end %>
85
+ <td>
86
+ <div class="auto"><a href="<%= user_link %>"><%= teammate %></a></div>
87
+ </td>
88
+ <td>
89
+ <div class="auto"><%= assignment.name %></div>
90
+ </td>
91
+ <td>
92
+ <div class="auto">
93
+ <% if assignment.free? %>
94
+ <span style="color: red">0</span>
95
+ <% else %>
96
+ <% assignment.sprints.each do |s| %>
97
+ <a href="<%= search_link %><%= CGI.escape("#{jql} and assignee=#{teammate}") %>">
98
+ <%= s.first.blank? ? "No sprint" : s.first %>: <%= s.last.size %>
99
+ </a>
100
+ <br/>
101
+ <% end %>
102
+ <% end %>
103
+ </div>
104
+ </td>
105
+ <td>
106
+ <div class="auto">
107
+ <% if assignment.next.kind_of?(Date) && Date.current.after?(assignment.next) %>
108
+ <span style="color: red"><%= assignment.next %></span>
109
+ <% else %>
110
+ <%= assignment.next %>
111
+ <% end %>
112
+ </div>
113
+ </td>
114
+ </tr>
115
+ <% end %>
116
+ </table>
117
+ <br/>
118
+ <p>Posted by
119
+ <a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
120
+ </p>
121
+ </body>
122
+ </html>
data/readme.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Hits-of-Code](https://hitsofcode.com/github/dgroup/lazylead)](https://hitsofcode.com/view/github/dgroup/lazylead)
8
8
  [![License: MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](./license.txt)
9
9
 
10
- [![Build status circleci](https://circleci.com/gh/dgroup/lazylead.svg?style=shield)](https://circleci.com/gh/dgroup/lazylead)
10
+ [![Build status circleci](https://circleci.com/gh/dgroup/lazylead/tree/master.svg?style=shield)](https://circleci.com/gh/dgroup/lazylead/tree/master)
11
11
  [![0pdd](http://www.0pdd.com/svg?name=dgroup/lazylead)](http://www.0pdd.com/p?name=dgroup/lazylead)
12
12
  [![Dependency Status](https://requires.io/github/dgroup/lazylead/requirements.svg?branch=master)](https://requires.io/github/dgroup/lazylead/requirements/?branch=master)
13
13
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dgroup_lazylead&metric=alert_status)](https://sonarcloud.io/dashboard?id=dgroup_lazylead)
@@ -30,23 +30,31 @@ I think you remember how [static code analysis](https://en.wikipedia.org/wiki/St
30
30
 
31
31
  Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
32
32
 
33
- | Daily annoying task | Jira | Github | Trello |
34
- | :---------------------------------------------------------------------------------- | :---: | :----: | :----: |
35
- | [Notify ticket's assignee](lib/lazylead/task/alert.rb) | ✅ | ⌛ | ⌛ |
36
- | [Notify ticket's reporter](lib/lazylead/task/alert.rb) | ✅ | ⌛ | ⌛ |
37
- | [Notify ticket's manager](lib/lazylead/task/alert.rb) | ✅ | ⌛ | ⌛ |
38
- | [Notify about illegal "Fix Version" modification](lib/lazylead/task/fix_version.rb) | ✅ | ❌ | ❌ |
39
- | [Expected comment in ticket is missing](lib/lazylead/task/missing_comment.rb) | ✅ | ⌛ | ⌛ |
40
- | [Propagate some fields from parent ticket into sub-tasks](.docs/propagate_down.md) | ✅ | ❌ | ❌ |
41
- | [Evaluate the ticket formatting accuracy](.docs/accuracy.md) | ✅ | ⌛ | ⌛ |
42
- | Print the current capacity of team into newly created tasks | ⌛ | ⌛ | ⌛ |
43
- | Create/retrofit the defect automatically into latest release | ⌛ | ⌛ | ❌ |
44
- | [Notify about expired(ing) due dates](.docs/duedate_expired.md) | ✅ | ❌ | ⌛ |
45
- | Notify about absent original estimations | ⌛ | ⌛ | ⌛ |
46
- | Notify about 'Hot potato' tickets | ⌛ | ⌛ | ⌛ |
47
- | Notify about long live tickets (aging) | ⌛ | ⌛ | ⌛ |
48
- | Notify about tickets with invalid format (missing url/stacktrace, etc) | ⌛ | ⌛ | ⌛ |
49
- | Create a meeting(s) automatically in case some tickets appeared (group by assignee/reporters/component/ticket type/etc) | ⌛ | ⌛ | |
33
+ | Daily annoying task | Jira | Github | Trello | SVN |
34
+ | :---------------------------------------------------------------------------------- | :---: | :----: | :----: | :----: |
35
+ | [Notify ticket's assignee](lib/lazylead/task/alert/alert.rb) | ✅ | ⌛ | ⌛ | ❌ |
36
+ | [Notify ticket's reporter](lib/lazylead/task/alert/alert.rb) | ✅ | ⌛ | ⌛ | ❌ |
37
+ | [Notify ticket's manager](lib/lazylead/task/alert/alert.rb) | ✅ | ⌛ | ⌛ | ❌ |
38
+ | [Notify about illegal "Fix Version" modification](lib/lazylead/task/fix_version.rb) | ✅ | ❌ | ❌ | ❌ |
39
+ | [Expected comment in ticket is missing](lib/lazylead/task/missing_comment.rb) | ✅ | ⌛ | ⌛ | ❌ |
40
+ | [Propagate some fields from parent ticket into sub-tasks](.docs/propagate_down.md) | ✅ | ❌ | ❌ | ❌ |
41
+ | [Evaluate the ticket formatting accuracy](.docs/accuracy.md) | ✅ | ⌛ | ⌛ | ❌ |
42
+ | Print the current capacity of team into newly created tasks | ⌛ | ⌛ | ⌛ | ❌ |
43
+ | Create/retrofit the defect automatically into latest release | ⌛ | ⌛ | ❌ | ❌ |
44
+ | [Notify about expired(ing) due dates](.docs/duedate_expired.md) | ✅ | ❌ | ⌛ | ❌ |
45
+ | Notify about absent original estimations | ⌛ | ⌛ | ⌛ | ❌ |
46
+ | Notify about 'Hot potato' tickets | ⌛ | ⌛ | ⌛ | ❌ |
47
+ | Notify about long live tickets (aging) | ⌛ | ⌛ | ⌛ | ❌ |
48
+ | Create a meeting(s) automatically in case some tickets appeared (group by assignee/reporters/component/ticket type/etc) | ⌛ | ⌛ | ⌛ | ❌ |
49
+ | Propogate fields from parent tickets to sub-tasks | | ⌛ | ⌛ | |
50
+ | Notify about tickets without comments with expected text | ✅ | ⌛ | ⌛ | ❌ |
51
+ | Notify about team loading (no tasks on teammates) | ✅ | ⌛ | ⌛ | ❌ |
52
+ | Notify about tickets matches predefined multiple conditions | ✅ | ⌛ | ⌛ | ❌ |
53
+ | Link automatically the ticket and Confluence page if link found in ticket's comments/description | ✅ | ⌛ | ⌛ | ❌ |
54
+ | Notify about tickets assigned to your team members not by effective managers| ✅ | ⌛ | ⌛ | ❌ |
55
+ | Notify about modifications of important files in VCS | ❌ | ⌛ | ❌ | ✅ |
56
+ | Notify about diff changes for past X period in VCS | ❌ | ⌛ | ❌ | ✅ |
57
+ | Notify about changes with some text for past X period in VCS | ❌ | ⌛ | ❌ | ✅ |
50
58
 
51
59
  | Integration | Type | Status |
52
60
  | :---------------------------------------------------- | :-----------: | :----: |
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,10 +2,10 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"],
8
+ # of this software and associated documentation files (the "Software"),
9
9
  # to deal in the Software without restriction, including without limitation
10
10
  # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
11
  # and/or sell copies of the Software, and to permit persons to whom
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -185,5 +185,14 @@ module Lazylead
185
185
  .issues("key>DATAJDBC-500")
186
186
  .size >= 118
187
187
  end
188
+
189
+ test "connected based on string properties" do
190
+ refute_empty Jira.new(
191
+ "username" => nil,
192
+ "password" => nil,
193
+ "site" => "https://jira.spring.io",
194
+ "context_path" => ""
195
+ ).issues("key=DATAJDBC-480")
196
+ end
188
197
  end
189
198
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -23,7 +23,9 @@
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"
28
+ require_relative "../../../../lib/lazylead/task/accuracy/affected_build"
27
29
 
28
30
  module Lazylead
29
31
  class ScoreTest < Lazylead::Test
@@ -39,8 +41,44 @@ module Lazylead
39
41
  "100": "100"
40
42
  }.each do |k, v|
41
43
  assert_equal v.to_f,
42
- Lazylead::Score.new({}, {}, {}).grade(k.to_s.to_f)
44
+ Lazylead::Score.new({}, {}).grade(k.to_s.to_f)
43
45
  end
44
46
  end
47
+
48
+ test "comment has proper structure" do
49
+ assert_words %w[triage accuracy is 100.0%],
50
+ Score.new(
51
+ Struct.new(:key) do
52
+ def reporter
53
+ OpenStruct.new(id: "userid")
54
+ end
55
+
56
+ def fields
57
+ { "versions" => ["0.1.0"] }
58
+ end
59
+ end.new("DATAJDBC-493"),
60
+ Opts.new(
61
+ rules: [Lazylead::AffectedBuild.new],
62
+ total: 0.5,
63
+ "colors" => {
64
+ "0" => "#FF4F33",
65
+ "35" => "#FF9F33",
66
+ "57" => "#19DD1E",
67
+ "90" => "#0FA81A"
68
+ }.to_json.to_s,
69
+ "docs" => "https://github.com/dgroup/lazylead/blob/master/.github/ISSUE_TEMPLATE/bug_report.md"
70
+ )
71
+ ).evaluate.comment
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
45
83
  end
46
84
  end