Skip to content

Commit 55cc218

Browse files
authored
Merge pull request #6 from hammad45/master
Added support for DXT issues and recommendations
2 parents 233fb16 + 6a412ef commit 55cc218

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

drishti/main.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
import csv
77
import time
8+
import json
89
import shlex
910
import datetime
1011
import argparse
@@ -42,6 +43,7 @@
4243

4344
insights_operation = []
4445
insights_metadata = []
46+
insights_dxt = []
4547

4648
insights_total = dict()
4749

@@ -179,6 +181,12 @@
179181
help='Export a CSV with the code of all issues that were triggered'
180182
)
181183

184+
parser.add_argument(
185+
'--json',
186+
default=False,
187+
dest='json',
188+
help=argparse.SUPPRESS)
189+
182190
args = parser.parse_args()
183191

184192
if args.export_size:
@@ -1437,6 +1445,29 @@ def main():
14371445
pass
14381446
except FileNotFoundError:
14391447
pass
1448+
1449+
#########################################################################################################################################################################
1450+
1451+
codes = []
1452+
if args.json:
1453+
f = open(args.json)
1454+
data = json.load(f)
1455+
1456+
for key, values in data.items():
1457+
for value in values:
1458+
code = value['code']
1459+
codes.append(code)
1460+
1461+
level = value['level']
1462+
issue = value['issue']
1463+
recommendation = []
1464+
for rec in value['recommendations']:
1465+
new_message = {'message': rec}
1466+
recommendation.append(new_message)
1467+
1468+
insights_dxt.append(
1469+
message(code, TARGET_DEVELOPER, level, issue, recommendation)
1470+
)
14401471

14411472
#########################################################################################################################################################################
14421473

@@ -1527,6 +1558,20 @@ def main():
15271558
)
15281559
)
15291560

1561+
if insights_dxt:
1562+
console.print(
1563+
Panel(
1564+
Padding(
1565+
Group(
1566+
*insights_dxt
1567+
),
1568+
(1, 1)
1569+
),
1570+
title='DXT',
1571+
title_align='left'
1572+
)
1573+
)
1574+
15301575
console.print(
15311576
Panel(
15321577
' {} | [white]LBNL[/white] | [white]Drishti report generated at {} in[/white] {:.3f} seconds'.format(
@@ -1617,6 +1662,8 @@ def main():
16171662
INSIGHTS_MPI_IO_AGGREGATORS_INTER,
16181663
INSIGHTS_MPI_IO_AGGREGATORS_OK
16191664
]
1665+
if codes:
1666+
issues.extend(codes)
16201667

16211668
detected_issues = dict.fromkeys(issues, False)
16221669
detected_issues['JOB'] = job['job']['jobid']

0 commit comments

Comments
 (0)