fastlane-plugin-sonarcloud_metric_kit 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7c0c5f65d4d9a28b71b7167801b1e482c6e5ebbca7a46004014d1beef6865011
|
4
|
+
data.tar.gz: 29b278995c38d9f31b62b7de49be795ce20298d385ec3bd420bed1018ff47f46
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 58685710cb6749e958f13bb529cd7d61ee5d7803c01e50489c0d1595024851fbf8554be0ec2e03f5a69098dc3a32baa2ae90e4e0838410cb4a65df42530fead2
|
7
|
+
data.tar.gz: aa9c2dc590a96dcd806dbfb442cb6c4e1a39b72d2374aebd598ad859a44783991de79b8628aecdb0bc5dabb4fe0d3bb2f23af9e2d95dc40c33f642ea631e0514
|
data/LICENSE
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
SOURCE CODE LICENSE AGREEMENT
|
2
|
+
|
3
|
+
IMPORTANT - READ THIS CAREFULLY BEFORE DOWNLOADING, INSTALLING, USING OR
|
4
|
+
ELECTRONICALLY ACCESSING THIS PROPRIETARY PRODUCT.
|
5
|
+
|
6
|
+
THIS IS A LEGAL AGREEMENT BETWEEN STREAM.IO, INC. (“STREAM.IO”) AND THE
|
7
|
+
BUSINESS ENTITY OR PERSON FOR WHOM YOU (“YOU”) ARE ACTING (“CUSTOMER”) AS THE
|
8
|
+
LICENSEE OF THE PROPRIETARY SOFTWARE INTO WHICH THIS AGREEMENT HAS BEEN
|
9
|
+
INCLUDED (THE “AGREEMENT”). YOU AGREE THAT YOU ARE THE CUSTOMER, OR YOU ARE AN
|
10
|
+
EMPLOYEE OR AGENT OF CUSTOMER AND ARE ENTERING INTO THIS AGREEMENT FOR LICENSE
|
11
|
+
OF THE SOFTWARE BY CUSTOMER FOR CUSTOMER’S BUSINESS PURPOSES AS DESCRIBED IN
|
12
|
+
AND IN ACCORDANCE WITH THIS AGREEMENT. YOU HEREBY AGREE THAT YOU ENTER INTO
|
13
|
+
THIS AGREEMENT ON BEHALF OF CUSTOMER AND THAT YOU HAVE THE AUTHORITY TO BIND
|
14
|
+
CUSTOMER TO THIS AGREEMENT.
|
15
|
+
|
16
|
+
STREAM.IO IS WILLING TO LICENSE THE SOFTWARE TO CUSTOMER ONLY ON THE FOLLOWING
|
17
|
+
CONDITIONS: (1) YOU ARE A CURRENT CUSTOMER OF STREAM.IO; (2) YOU ARE NOT A
|
18
|
+
COMPETITOR OF STREAM.IO; AND (3) THAT YOU ACCEPT ALL THE TERMS IN THIS
|
19
|
+
AGREEMENT. BY DOWNLOADING, INSTALLING, CONFIGURING, ACCESSING OR OTHERWISE
|
20
|
+
USING THE SOFTWARE, INCLUDING ANY UPDATES, UPGRADES, OR NEWER VERSIONS, YOU
|
21
|
+
REPRESENT, WARRANT AND ACKNOWLEDGE THAT (A) CUSTOMER IS A CURRENT CUSTOMER OF
|
22
|
+
STREAM.IO; (B) CUSTOMER IS NOT A COMPETITOR OF STREAM.IO; AND THAT (C) YOU HAVE
|
23
|
+
READ THIS AGREEMENT, UNDERSTAND THIS AGREEMENT, AND THAT CUSTOMER AGREES TO BE
|
24
|
+
BOUND BY ALL THE TERMS OF THIS AGREEMENT.
|
25
|
+
|
26
|
+
IF YOU DO NOT AGREE TO ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT,
|
27
|
+
STREAM.IO IS UNWILLING TO LICENSE THE SOFTWARE TO CUSTOMER, AND THEREFORE, DO
|
28
|
+
NOT COMPLETE THE DOWNLOAD PROCESS, ACCESS OR OTHERWISE USE THE SOFTWARE, AND
|
29
|
+
CUSTOMER SHOULD IMMEDIATELY RETURN THE SOFTWARE AND CEASE ANY USE OF THE
|
30
|
+
SOFTWARE.
|
31
|
+
|
32
|
+
1. SOFTWARE. The Stream.io software accompanying this Agreement, may include
|
33
|
+
Source Code, Executable Object Code, associated media, printed materials and
|
34
|
+
documentation (collectively, the “Software”). The Software also includes any
|
35
|
+
updates or upgrades to or new versions of the original Software, if and when
|
36
|
+
made available to you by Stream.io. “Source Code” means computer programming
|
37
|
+
code in human readable form that is not suitable for machine execution without
|
38
|
+
the intervening steps of interpretation or compilation. “Executable Object
|
39
|
+
Code" means the computer programming code in any other form than Source Code
|
40
|
+
that is not readily perceivable by humans and suitable for machine execution
|
41
|
+
without the intervening steps of interpretation or compilation. “Site” means a
|
42
|
+
Customer location controlled by Customer. “Authorized User” means any employee
|
43
|
+
or contractor of Customer working at the Site, who has signed a written
|
44
|
+
confidentiality agreement with Customer or is otherwise bound in writing by
|
45
|
+
confidentiality and use obligations at least as restrictive as those imposed
|
46
|
+
under this Agreement.
|
47
|
+
|
48
|
+
2. LICENSE GRANT. Subject to the terms and conditions of this Agreement, in
|
49
|
+
consideration for the representations, warranties, and covenants made by
|
50
|
+
Customer in this Agreement, Stream.io grants to Customer, during the term of
|
51
|
+
this Agreement, a personal, non-exclusive, non-transferable, non-sublicensable
|
52
|
+
license to:
|
53
|
+
|
54
|
+
a. install and use Software Source Code on password protected computers at a Site,
|
55
|
+
restricted to Authorized Users;
|
56
|
+
|
57
|
+
b. create derivative works, improvements (whether or not patentable), extensions
|
58
|
+
and other modifications to the Software Source Code (“Modifications”) to build
|
59
|
+
unique scalable newsfeeds, activity streams, and in-app messaging via Stream’s
|
60
|
+
application program interface (“API”);
|
61
|
+
|
62
|
+
c. compile the Software Source Code to create Executable Object Code versions of
|
63
|
+
the Software Source Code and Modifications to build such newsfeeds, activity
|
64
|
+
streams, and in-app messaging via the API;
|
65
|
+
|
66
|
+
d. install, execute and use such Executable Object Code versions solely for
|
67
|
+
Customer’s internal business use (including development of websites through
|
68
|
+
which data generated by Stream services will be streamed (“Apps”));
|
69
|
+
|
70
|
+
e. use and distribute such Executable Object Code as part of Customer’s Apps; and
|
71
|
+
|
72
|
+
f. make electronic copies of the Software and Modifications as required for backup
|
73
|
+
or archival purposes.
|
74
|
+
|
75
|
+
3. RESTRICTIONS. Customer is responsible for all activities that occur in
|
76
|
+
connection with the Software. Customer will not, and will not attempt to: (a)
|
77
|
+
sublicense or transfer the Software or any Source Code related to the Software
|
78
|
+
or any of Customer’s rights under this Agreement, except as otherwise provided
|
79
|
+
in this Agreement, (b) use the Software Source Code for the benefit of a third
|
80
|
+
party or to operate a service; (c) allow any third party to access or use the
|
81
|
+
Software Source Code; (d) sublicense or distribute the Software Source Code or
|
82
|
+
any Modifications in Source Code or other derivative works based on any part of
|
83
|
+
the Software Source Code; (e) use the Software in any manner that competes with
|
84
|
+
Stream.io or its business; or (e) otherwise use the Software in any manner that
|
85
|
+
exceeds the scope of use permitted in this Agreement. Customer shall use the
|
86
|
+
Software in compliance with any accompanying documentation any laws applicable
|
87
|
+
to Customer.
|
88
|
+
|
89
|
+
4. OPEN SOURCE. Customer and its Authorized Users shall not use any software or
|
90
|
+
software components that are open source in conjunction with the Software
|
91
|
+
Source Code or any Modifications in Source Code or in any way that could
|
92
|
+
subject the Software to any open source licenses.
|
93
|
+
|
94
|
+
5. CONTRACTORS. Under the rights granted to Customer under this Agreement,
|
95
|
+
Customer may permit its employees, contractors, and agencies of Customer to
|
96
|
+
become Authorized Users to exercise the rights to the Software granted to
|
97
|
+
Customer in accordance with this Agreement solely on behalf of Customer to
|
98
|
+
provide services to Customer; provided that Customer shall be liable for the
|
99
|
+
acts and omissions of all Authorized Users to the extent any of such acts or
|
100
|
+
omissions, if performed by Customer, would constitute a breach of, or otherwise
|
101
|
+
give rise to liability to Customer under, this Agreement. Customer shall not
|
102
|
+
and shall not permit any Authorized User to use the Software except as
|
103
|
+
expressly permitted in this Agreement.
|
104
|
+
|
105
|
+
6. COMPETITIVE PRODUCT DEVELOPMENT. Customer shall not use the Software in any way
|
106
|
+
to engage in the development of products or services which could be reasonably
|
107
|
+
construed to provide a complete or partial functional or commercial alternative
|
108
|
+
to Stream.io’s products or services (a “Competitive Product”). Customer shall
|
109
|
+
ensure that there is no direct or indirect use of, or sharing of, Software
|
110
|
+
source code, or other information based upon or derived from the Software to
|
111
|
+
develop such products or services. Without derogating from the generality of
|
112
|
+
the foregoing, development of Competitive Products shall include having direct
|
113
|
+
or indirect access to, supervising, consulting or assisting in the development
|
114
|
+
of, or producing any specifications, documentation, object code or source code
|
115
|
+
for, all or part of a Competitive Product.
|
116
|
+
|
117
|
+
7. LIMITATION ON MODIFICATIONS. Notwithstanding any provision in this Agreement,
|
118
|
+
Modifications may only be created and used by Customer as permitted by this
|
119
|
+
Agreement and Modification Source Code may not be distributed to third parties.
|
120
|
+
Customer will not assert against Stream.io, its affiliates, or their customers,
|
121
|
+
direct or indirect, agents and contractors, in any way, any patent rights that
|
122
|
+
Customer may obtain relating to any Modifications for Stream.io, its
|
123
|
+
affiliates’, or their customers’, direct or indirect, agents’ and contractors’
|
124
|
+
manufacture, use, import, offer for sale or sale of any Stream.io products or
|
125
|
+
services.
|
126
|
+
|
127
|
+
8. DELIVERY AND ACCEPTANCE. The Software will be delivered electronically pursuant
|
128
|
+
to Stream.io standard download procedures. The Software is deemed accepted upon
|
129
|
+
delivery.
|
130
|
+
|
131
|
+
9. IMPLEMENTATION AND SUPPORT. Stream.io has no obligation under this Agreement to
|
132
|
+
provide any support or consultation concerning the Software.
|
133
|
+
|
134
|
+
10. TERM AND TERMINATION. The term of this Agreement begins when the Software is
|
135
|
+
downloaded or accessed and shall continue until terminated. Either party may
|
136
|
+
terminate this Agreement upon written notice. This Agreement shall
|
137
|
+
automatically terminate if Customer is or becomes a competitor of Stream.io or
|
138
|
+
makes or sells any Competitive Products. Upon termination of this Agreement for
|
139
|
+
any reason, (a) all rights granted to Customer in this Agreement immediately
|
140
|
+
cease to exist, (b) Customer must promptly discontinue all use of the Software
|
141
|
+
and return to Stream.io or destroy all copies of the Software in Customer’s
|
142
|
+
possession or control. Any continued use of the Software by Customer or attempt
|
143
|
+
by Customer to exercise any rights under this Agreement after this Agreement
|
144
|
+
has terminated shall be considered copyright infringement and subject Customer
|
145
|
+
to applicable remedies for copyright infringement. Sections 2, 5, 6, 8 and 9
|
146
|
+
shall survive expiration or termination of this Agreement for any reason.
|
147
|
+
|
148
|
+
11. OWNERSHIP. As between the parties, the Software and all worldwide intellectual
|
149
|
+
property rights and proprietary rights relating thereto or embodied therein,
|
150
|
+
are the exclusive property of Stream.io and its suppliers. Stream.io and its
|
151
|
+
suppliers reserve all rights in and to the Software not expressly granted to
|
152
|
+
Customer in this Agreement, and no other licenses or rights are granted by
|
153
|
+
implication, estoppel or otherwise.
|
154
|
+
|
155
|
+
12. WARRANTY DISCLAIMER. USE OF THIS SOFTWARE IS ENTIRELY AT YOURS AND CUSTOMER’S
|
156
|
+
OWN RISK. THE SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF ANY KIND
|
157
|
+
WHATSOEVER. STREAM.IO DOES NOT MAKE, AND HEREBY DISCLAIMS, ANY WARRANTY OF ANY
|
158
|
+
KIND, WHETHER EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING WITHOUT
|
159
|
+
LIMITATION, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
160
|
+
PURPOSE, TITLE, NON-INFRINGEMENT OF THIRD-PARTY RIGHTS, RESULTS, EFFORTS,
|
161
|
+
QUALITY OR QUIET ENJOYMENT. STREAM.IO DOES NOT WARRANT THAT THE SOFTWARE IS
|
162
|
+
ERROR-FREE, WILL FUNCTION WITHOUT INTERRUPTION, WILL MEET ANY SPECIFIC NEED
|
163
|
+
THAT CUSTOMER HAS, THAT ALL DEFECTS WILL BE CORRECTED OR THAT IT IS
|
164
|
+
SUFFICIENTLY DOCUMENTED TO BE USABLE BY CUSTOMER. TO THE EXTENT THAT STREAM.IO
|
165
|
+
MAY NOT DISCLAIM ANY WARRANTY AS A MATTER OF APPLICABLE LAW, THE SCOPE AND
|
166
|
+
DURATION OF SUCH WARRANTY WILL BE THE MINIMUM PERMITTED UNDER SUCH LAW.
|
167
|
+
CUSTOMER ACKNOWLEDGES THAT IT HAS RELIED ON NO WARRANTIES OTHER THAN THE
|
168
|
+
EXPRESS WARRANTIES IN THIS AGREEMENT.
|
169
|
+
|
170
|
+
13. LIMITATION OF LIABILITY. TO THE FULLEST EXTENT PERMISSIBLE BY LAW, STREAM.IO’S
|
171
|
+
TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR RELATED TO THE SOFTWARE OR
|
172
|
+
THIS AGREEMENT, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE,
|
173
|
+
SHALL NOT EXCEED $100. IN NO EVENT WILL STREAM.IO BE LIABLE FOR ANY INDIRECT,
|
174
|
+
CONSEQUENTIAL, EXEMPLARY, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES OF ANY KIND
|
175
|
+
WHATSOEVER, INCLUDING ANY LOST DATA AND LOST PROFITS, ARISING FROM OR RELATING
|
176
|
+
TO THE SOFTWARE EVEN IF STREAM.IO HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
177
|
+
DAMAGES. CUSTOMER ACKNOWLEDGES THAT THIS PROVISION REFLECTS THE AGREED UPON
|
178
|
+
ALLOCATION OF RISK FOR THIS AGREEMENT AND THAT STREAM.IO WOULD NOT ENTER INTO
|
179
|
+
THIS AGREEMENT WITHOUT THESE LIMITATIONS ON ITS LIABILITY.
|
180
|
+
|
181
|
+
14. General. Customer may not assign or transfer this Agreement, by operation of
|
182
|
+
law or otherwise, or any of its rights under this Agreement (including the
|
183
|
+
license rights granted to Customer) to any third party without Stream.io’s
|
184
|
+
prior written consent, which consent will not be unreasonably withheld or
|
185
|
+
delayed. Stream.io may assign this Agreement, without consent, including, but
|
186
|
+
limited to, affiliate or any successor to all or substantially all its business
|
187
|
+
or assets to which this Agreement relates, whether by merger, sale of assets,
|
188
|
+
sale of stock, reorganization or otherwise. Any attempted assignment or
|
189
|
+
transfer in violation of the foregoing will be null and void. Stream.io shall
|
190
|
+
not be liable hereunder by reason of any failure or delay in the performance of
|
191
|
+
its obligations hereunder for any cause which is beyond the reasonable control.
|
192
|
+
All notices, consents, and approvals under this Agreement must be delivered in
|
193
|
+
writing by courier, by electronic mail, or by certified or registered mail,
|
194
|
+
(postage prepaid and return receipt requested) to the other party at the
|
195
|
+
address set forth in the customer agreement between Stream.io and Customer and
|
196
|
+
will be effective upon receipt or when delivery is refused. This Agreement will
|
197
|
+
be governed by and interpreted in accordance with the laws of the State of
|
198
|
+
Colorado, without reference to its choice of laws rules. The United Nations
|
199
|
+
Convention on Contracts for the International Sale of Goods does not apply to
|
200
|
+
this Agreement. Any action or proceeding arising from or relating to this
|
201
|
+
Agreement shall be brought in a federal or state court in Denver, Colorado, and
|
202
|
+
each party irrevocably submits to the jurisdiction and venue of any such court
|
203
|
+
in any such action or proceeding. All waivers must be in writing. Any waiver or
|
204
|
+
failure to enforce any provision of this Agreement on one occasion will not be
|
205
|
+
deemed a waiver of any other provision or of such provision on any other
|
206
|
+
occasion. If any provision of this Agreement is unenforceable, such provision
|
207
|
+
will be changed and interpreted to accomplish the objectives of such provision
|
208
|
+
to the greatest extent possible under applicable law and the remaining
|
209
|
+
provisions will continue in full force and effect. Customer shall not violate
|
210
|
+
any applicable law, rule or regulation, including those regarding the export of
|
211
|
+
technical data. The headings of Sections of this Agreement are for convenience
|
212
|
+
and are not to be used in interpreting this Agreement. As used in this
|
213
|
+
Agreement, the word “including” means “including but not limited to.” This
|
214
|
+
Agreement (including all exhibits and attachments) constitutes the entire
|
215
|
+
agreement between the parties regarding the subject hereof and supersedes all
|
216
|
+
prior or contemporaneous agreements, understandings and communication, whether
|
217
|
+
written or oral. This Agreement may be amended only by a written document
|
218
|
+
signed by both parties. The terms of any purchase order or similar document
|
219
|
+
submitted by Customer to Stream.io will have no effect.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# SonarCloud MetricKit
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-sonarcloud_metric_kit)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-sonarcloud_metric_kit`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin sonarcloud_metric_kit
|
11
|
+
```
|
12
|
+
|
13
|
+
## About sonarcloud_metric_kit
|
14
|
+
|
15
|
+
With this fastlane plugin, you can access most of the metrics collected by SonarCloud
|
16
|
+
|
17
|
+
| Option | Description | Default |
|
18
|
+
| ------- |------------ | ------- |
|
19
|
+
| project_key | Project key on SonarCloud | |
|
20
|
+
| sonar_token | [API token for private repositories](https://sonarcloud.io/account/security) | |
|
21
|
+
| period | Analysis period to use for new metrics | 0 |
|
22
|
+
| quality_gate | Should quality gate be parsed? | false |
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
metrics = sonarcloud_metric_kit(
|
28
|
+
project_key: 'GetStream_stream-chat-swift',
|
29
|
+
quality_gate: true
|
30
|
+
)
|
31
|
+
UI.message "Total coverage: #{metrics[:coverage]}"
|
32
|
+
```
|
33
|
+
|
34
|
+
## Start working on this plugin
|
35
|
+
|
36
|
+
First of all, install any dependencies
|
37
|
+
|
38
|
+
```bash
|
39
|
+
bundle install
|
40
|
+
```
|
41
|
+
|
42
|
+
## Run tests for this plugin
|
43
|
+
|
44
|
+
To run both the tests, and code style validation, run
|
45
|
+
|
46
|
+
```bash
|
47
|
+
bundle exec rake
|
48
|
+
```
|
49
|
+
|
50
|
+
To automatically fix many of the styling issues, use
|
51
|
+
|
52
|
+
```bash
|
53
|
+
bundle exec rubocop -a
|
54
|
+
```
|
55
|
+
|
56
|
+
## Release a new version
|
57
|
+
|
58
|
+
To release the plugin, bump the [version](https://github.com/GetStream/fastlane-plugin-sonarcloud_metric_kit/blob/main/lib/fastlane/plugin/sonarcloud_metric_kit/version.rb) and run
|
59
|
+
|
60
|
+
```bash
|
61
|
+
bundle exec fastlane release
|
62
|
+
```
|
63
|
+
|
64
|
+
## Issues and Feedback
|
65
|
+
|
66
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
67
|
+
|
68
|
+
## Troubleshooting
|
69
|
+
|
70
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
71
|
+
|
72
|
+
## Using _fastlane_ Plugins
|
73
|
+
|
74
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
75
|
+
|
76
|
+
## About _fastlane_
|
77
|
+
|
78
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,182 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class SonarcloudMetricKitAction < Action
|
6
|
+
def self.run((params))
|
7
|
+
collect_metrics(params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.api_url
|
11
|
+
'https://sonarcloud.io/api'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.collect_metrics(params)
|
15
|
+
metrics = {}
|
16
|
+
measures = measures(params)
|
17
|
+
metric_keys.each do |key|
|
18
|
+
metric = measures.find { |m| m['metric'] == key.to_s }
|
19
|
+
metrics[key.to_sym] =
|
20
|
+
if metric['value']
|
21
|
+
metric['value']
|
22
|
+
elsif params[:period] && metric['periods'].size > params[:period]
|
23
|
+
metric['periods'][params[:period]]['value']
|
24
|
+
else
|
25
|
+
metric['periods']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
return metrics unless params[:quality_gate]
|
29
|
+
|
30
|
+
quality_gate = quality_gate(params)
|
31
|
+
metrics[:quality_gate] = quality_gate
|
32
|
+
if params[:period] && quality_gate['periods'].size > params[:period]
|
33
|
+
metrics[:period_value] = quality_gate['periods'][params[:period]]['parameter']
|
34
|
+
end
|
35
|
+
metrics
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.measures(params)
|
39
|
+
queries = "componentKey=#{params[:project_key]}&metricKeys=#{metric_keys.join(',')}"
|
40
|
+
url = URI("#{api_url}/measures/component?#{queries}")
|
41
|
+
response = request(url, token: params[:sonar_token])
|
42
|
+
json_parse(response.read_body)['component']['measures']
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.quality_gate(params)
|
46
|
+
url = URI("#{api_url}/qualitygates/project_status?projectKey=#{params[:project_key]}")
|
47
|
+
JSON.parse(request(url, token: params[:sonar_token]).read_body)['projectStatus']
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.request(url, token:)
|
51
|
+
http = Net::HTTP.new(url.host, url.port)
|
52
|
+
http.use_ssl = true
|
53
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
54
|
+
request = Net::HTTP::Get.new(url)
|
55
|
+
request['authorization'] = "Basic #{token}" if token
|
56
|
+
request['content-type'] = 'application/json'
|
57
|
+
http.request(request)
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.metric_keys
|
61
|
+
%w[
|
62
|
+
alert_status
|
63
|
+
new_bugs
|
64
|
+
new_reliability_rating
|
65
|
+
new_reliability_remediation_effort
|
66
|
+
bugs
|
67
|
+
reliability_rating
|
68
|
+
reliability_remediation_effort
|
69
|
+
new_vulnerabilities
|
70
|
+
new_security_rating
|
71
|
+
new_security_remediation_effort
|
72
|
+
vulnerabilities
|
73
|
+
security_rating
|
74
|
+
security_remediation_effort
|
75
|
+
new_security_hotspots
|
76
|
+
new_security_review_rating
|
77
|
+
new_security_hotspots_reviewed
|
78
|
+
security_hotspots
|
79
|
+
security_review_rating
|
80
|
+
security_hotspots_reviewed
|
81
|
+
new_code_smells
|
82
|
+
new_technical_debt
|
83
|
+
new_sqale_debt_ratio
|
84
|
+
new_maintainability_rating
|
85
|
+
code_smells
|
86
|
+
sqale_index
|
87
|
+
sqale_debt_ratio
|
88
|
+
sqale_rating
|
89
|
+
effort_to_reach_maintainability_rating_a
|
90
|
+
new_coverage
|
91
|
+
new_lines_to_cover
|
92
|
+
new_uncovered_lines
|
93
|
+
new_line_coverage
|
94
|
+
new_conditions_to_cover
|
95
|
+
new_uncovered_conditions
|
96
|
+
coverage
|
97
|
+
lines_to_cover
|
98
|
+
uncovered_lines
|
99
|
+
line_coverage
|
100
|
+
new_duplicated_lines_density
|
101
|
+
new_duplicated_lines
|
102
|
+
new_duplicated_blocks
|
103
|
+
duplicated_lines_density
|
104
|
+
duplicated_lines
|
105
|
+
duplicated_blocks
|
106
|
+
duplicated_files
|
107
|
+
new_lines
|
108
|
+
ncloc
|
109
|
+
lines
|
110
|
+
statements
|
111
|
+
functions
|
112
|
+
classes
|
113
|
+
files
|
114
|
+
comment_lines
|
115
|
+
comment_lines_density
|
116
|
+
complexity
|
117
|
+
cognitive_complexity
|
118
|
+
new_violations
|
119
|
+
violations
|
120
|
+
open_issues
|
121
|
+
reopened_issues
|
122
|
+
confirmed_issues
|
123
|
+
false_positive_issues
|
124
|
+
wont_fix_issues
|
125
|
+
]
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.json_parse(response)
|
129
|
+
JSON.parse(response)
|
130
|
+
rescue JSON::ParserError
|
131
|
+
UI.user_error!('Cannot parse the result from SonarCloud. Double check the project key (and token if required)')
|
132
|
+
end
|
133
|
+
|
134
|
+
#####################################################
|
135
|
+
# @!group Documentation
|
136
|
+
#####################################################
|
137
|
+
|
138
|
+
def self.description
|
139
|
+
'Generates a report from SonarCloud'
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.available_options
|
143
|
+
[
|
144
|
+
FastlaneCore::ConfigItem.new(
|
145
|
+
key: :project_key,
|
146
|
+
description: 'Project key on SonarCloud',
|
147
|
+
is_string: true,
|
148
|
+
optional: false
|
149
|
+
),
|
150
|
+
FastlaneCore::ConfigItem.new(
|
151
|
+
key: :sonar_token,
|
152
|
+
description: 'API token for private repositories (https://sonarcloud.io/account/security)',
|
153
|
+
is_string: true,
|
154
|
+
optional: true
|
155
|
+
),
|
156
|
+
FastlaneCore::ConfigItem.new(
|
157
|
+
key: :period,
|
158
|
+
description: 'Analysis period to use for new metrics, collects all if nil',
|
159
|
+
is_string: false,
|
160
|
+
optional: true,
|
161
|
+
default_value: 0
|
162
|
+
),
|
163
|
+
FastlaneCore::ConfigItem.new(
|
164
|
+
key: :quality_gate,
|
165
|
+
description: 'Should quality gate be parsed?',
|
166
|
+
is_string: false,
|
167
|
+
optional: true,
|
168
|
+
default_value: false
|
169
|
+
)
|
170
|
+
]
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.authors
|
174
|
+
['alteral']
|
175
|
+
end
|
176
|
+
|
177
|
+
def self.is_supported?(platform)
|
178
|
+
[:ios, :android].include?(platform)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/sonarcloud_metric_kit/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module SonarcloudMetricKit
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::SonarcloudMetricKit.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-sonarcloud_metric_kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- alteral
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fasterer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.9.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fastlane
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.204.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.204.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec_junit_formatter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.28.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.28.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-performance
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.6.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.6.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-require_tools
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rspec
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 2.4.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 2.4.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: simplecov
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
description:
|
196
|
+
email:
|
197
|
+
executables: []
|
198
|
+
extensions: []
|
199
|
+
extra_rdoc_files: []
|
200
|
+
files:
|
201
|
+
- LICENSE
|
202
|
+
- README.md
|
203
|
+
- lib/fastlane/plugin/sonarcloud_metric_kit.rb
|
204
|
+
- lib/fastlane/plugin/sonarcloud_metric_kit/actions/sonarcloud_metric_kit_action.rb
|
205
|
+
- lib/fastlane/plugin/sonarcloud_metric_kit/version.rb
|
206
|
+
homepage: https://github.com/GetStream/fastlane-plugin-sonarcloud_metric_kit
|
207
|
+
licenses: []
|
208
|
+
metadata:
|
209
|
+
rubygems_mfa_required: 'true'
|
210
|
+
post_install_message:
|
211
|
+
rdoc_options: []
|
212
|
+
require_paths:
|
213
|
+
- lib
|
214
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '2.5'
|
219
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
224
|
+
requirements: []
|
225
|
+
rubygems_version: 3.3.7
|
226
|
+
signing_key:
|
227
|
+
specification_version: 4
|
228
|
+
summary: With this fastlane plugin, you can access most of the metrics collected by
|
229
|
+
SonarCloud
|
230
|
+
test_files: []
|