Skip to content

Commit

Permalink
fixed nglint tool after migration from tslint to eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
godfryd committed Feb 26, 2023
1 parent 1027fb2 commit e3f461e
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions agent/kraken/agent/kraken_nglint.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,30 @@ def run_analysis(step, report_issue=None):


result = json.loads(out)
for idx, issue in enumerate(result):
log.info('issue %d: %s', idx, issue)
for file_issues in result:
if repo_parent:
filepath = issue['name'].replace(repo_parent, '')
filepath = file_issues['filePath'].replace(repo_parent, '')
else:
filepath = issue['name']

log.info('%s:%s %s', filepath, issue['startPosition']['line'], issue['failure'])
issue2 = dict(path=filepath,
line=issue['startPosition']['line'],
column=issue['startPosition']['character'],
message=issue['failure'],
symbol=issue['ruleName'],
type=issue['ruleSeverity'].lower())
if git_url:
issue2['url'] = '%s/%s#L%s' % (git_url, filepath, issue['startPosition']['line'])
report_issue(issue2)
filepath = file_issues['filePath']

for issue in file_issues['messages']:
log.info('%s:%s %s', filepath, issue['startPosition']['line'], issue['failure'])
if issue['severity'] == 2:
severity = 'error'
elif issue['severity'] == 1:
severity = 'warning'
else:
severity = 'other'
line = issue['line']
issue2 = dict(path=filepath,
line=line,
column=issue['column'],
message=issue['message'],
symbol=issue['messageId'],
type=severity)
if git_url:
issue2['url'] = '%s/%s#L%s' % (git_url, filepath, line)
report_issue(issue2)

return 0, ''

Expand Down

0 comments on commit e3f461e

Please sign in to comment.