@freshworks/shiftleft-tools 1.1.22 → 1.1.24
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freshworks/shiftleft-tools",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"description": "CLI for managing Cursor rules/skills and Postman test infrastructure across Java Spring Boot and Node.js/Express projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -7,6 +7,7 @@ A publish failure logs a warning and never fails the build.
|
|
|
7
7
|
|
|
8
8
|
import os
|
|
9
9
|
import re
|
|
10
|
+
from decimal import Decimal
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def _normalize_repo(url):
|
|
@@ -69,14 +70,14 @@ def build_row(metrics, meta):
|
|
|
69
70
|
|
|
70
71
|
# --- coverage (API coverage) ---
|
|
71
72
|
if api_coverage:
|
|
72
|
-
cov_pct =
|
|
73
|
-
well_pct =
|
|
74
|
-
qp_pct =
|
|
73
|
+
cov_pct = Decimal(str(api_coverage.get('coverage_percent', 0)))
|
|
74
|
+
well_pct = Decimal(str(api_coverage.get('well_tested_percent', 0)))
|
|
75
|
+
qp_pct = Decimal(str(api_coverage.get('query_params_percent', 0)))
|
|
75
76
|
skipped = int(api_coverage.get('skipped_tests', 0))
|
|
76
77
|
gaps = (api_coverage.get('gaps') or [])[:25]
|
|
77
78
|
by_method = api_coverage.get('by_method') or {}
|
|
78
79
|
else:
|
|
79
|
-
cov_pct = well_pct = qp_pct = 0
|
|
80
|
+
cov_pct = well_pct = qp_pct = Decimal('0')
|
|
80
81
|
skipped = 0
|
|
81
82
|
gaps = []
|
|
82
83
|
by_method = {}
|
|
@@ -100,7 +101,7 @@ def build_row(metrics, meta):
|
|
|
100
101
|
timeout = int(mutation.get('timeout', 0))
|
|
101
102
|
total = int(mutation.get('total', 0))
|
|
102
103
|
denominator = killed + survived + no_cov
|
|
103
|
-
score = round((killed / denominator * 100), 2) if denominator > 0 else 0
|
|
104
|
+
score = Decimal(str(round((killed / denominator * 100), 2))) if denominator > 0 else Decimal('0')
|
|
104
105
|
mut_row = {
|
|
105
106
|
'tool': meta.get('mutation_tool', 'pit'),
|
|
106
107
|
'killed': killed,
|
|
@@ -170,7 +171,9 @@ def publish(row):
|
|
|
170
171
|
return
|
|
171
172
|
try:
|
|
172
173
|
import boto3
|
|
173
|
-
|
|
174
|
+
profile = os.environ.get('SHIFTLEFT_AWS_PROFILE') or 'staging'
|
|
175
|
+
session = boto3.Session(profile_name=profile, region_name='us-east-1')
|
|
176
|
+
dynamodb = session.resource('dynamodb')
|
|
174
177
|
table = dynamodb.Table(table_name)
|
|
175
178
|
table.put_item(Item=row)
|
|
176
179
|
print(f'[publish_health] Published health row: {row["Repo"]} @ {row["DateTime"]}')
|