Skip to content

Commit

Permalink
Merge pull request #5 from melexis/fail_gracefully_no_snapshots_in_st…
Browse files Browse the repository at this point in the history
…ream

When no snapshots in stream fail gracefully
  • Loading branch information
Letme authored Aug 26, 2018
2 parents c07ba21 + a4962b5 commit e25c89c
Showing 1 changed file with 41 additions and 34 deletions.
75 changes: 41 additions & 34 deletions mlx/coverity.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,42 +211,49 @@ def process_coverity_nodes(app, doctree, fromdocname):
report_info(env, "%d received" % (defects['totalNumberOfRecords']))
report_info(env, "building defects table... ", True)

for defect in defects['mergedDefects']:
try:
for defect in defects['mergedDefects']:
row = nodes.row()

# go through each col and decide if it is there or we print empty
for item_col in node['col']:
if 'CID' == item_col:
# CID is default and even if it is in disregard
row += create_cell(str(defect['cid']),
url=coverity_service.get_defect_url(app.config.coverity_credentials['stream'], # noqa: E501
str(defect['cid'])))
elif 'Category' == item_col:
row += create_cell(defect['displayCategory'])
elif 'Impact' == item_col:
row += create_cell(defect['displayImpact'])
elif 'Issue' == item_col:
row += create_cell(defect['displayIssueKind'])
elif 'Type' == item_col:
row += create_cell(defect['displayType'])
elif 'Checker' == item_col:
row += create_cell(defect['checkerName'])
elif 'Component' == item_col:
row += create_cell(defect['componentName'])
elif 'Comment' == item_col:
row += cov_attribute_value_to_col(defect, 'Comment')
elif 'Classification' == item_col:
row += cov_attribute_value_to_col(defect, 'Classification')
elif 'Action' == item_col:
row += cov_attribute_value_to_col(defect, 'Action')
elif 'Status' == item_col:
row += cov_attribute_value_to_col(defect, 'DefectStatus')
else:
# generic check which if it is missing prints empty cell anyway
row += cov_attribute_value_to_col(defect, item_col)

tbody += row
report_info(env, "done")
except AttributeError as e:
report_info(env, 'No issues matching your query or empty stream. %s' % e)
row = nodes.row()

# go through each col and decide if it is there or we print empty
for item_col in node['col']:
if 'CID' == item_col:
# CID is default and even if it is in disregard
row += create_cell(str(defect['cid']),
url=coverity_service.get_defect_url(app.config.coverity_credentials['stream'],
str(defect['cid'])))
elif 'Category' == item_col:
row += create_cell(defect['displayCategory'])
elif 'Impact' == item_col:
row += create_cell(defect['displayImpact'])
elif 'Issue' == item_col:
row += create_cell(defect['displayIssueKind'])
elif 'Type' == item_col:
row += create_cell(defect['displayType'])
elif 'Checker' == item_col:
row += create_cell(defect['checkerName'])
elif 'Component' == item_col:
row += create_cell(defect['componentName'])
elif 'Comment' == item_col:
row += cov_attribute_value_to_col(defect, 'Comment')
elif 'Classification' == item_col:
row += cov_attribute_value_to_col(defect, 'Classification')
elif 'Action' == item_col:
row += cov_attribute_value_to_col(defect, 'Action')
elif 'Status' == item_col:
row += cov_attribute_value_to_col(defect, 'DefectStatus')
else:
# generic check which if it is missing prints empty cell anyway
row += cov_attribute_value_to_col(defect, item_col)

row += create_cell('No issues matching your query or empty stream')
tbody += row
report_info(env, "done")

top_node += table
node.replace_self(top_node)
# try:
Expand Down

0 comments on commit e25c89c

Please sign in to comment.