htmlreport: Few style fixes

* Fix wrong indentation
* Use single quotes for consistency
* It is fine to substitute %s with empty str
This commit is contained in:
Boris Egorov 2016-03-11 11:12:52 +06:00
parent ab75b047b0
commit e4f81ba755
1 changed files with 9 additions and 16 deletions

View File

@ -590,27 +590,20 @@ if __name__ == '__main__':
if error['severity'] == 'error': if error['severity'] == 'error':
error_class = 'class="error"' error_class = 'class="error"'
if error['id'] == 'missingInclude': if error['id'] == 'missingInclude':
output_file.write( output_file.write(
'\n <tr><td></td><td>%s</td><td></td><td>%s</td><td>%s</td></tr>' % '\n <tr><td></td><td>%s</td><td></td><td>%s</td><td>%s</td></tr>' %
(error['id'], error['severity'], error['msg'])) (error['id'], error['severity'], error['msg']))
elif (error['id'] == 'unmatchedSuppression') and filename.endswith('*'): elif (error['id'] == 'unmatchedSuppression') and filename.endswith('*'):
output_file.write( output_file.write(
"\n <tr><td></td><td>%s</td><td></td><td>%s</td><td %s>%s</td></tr>" % '\n <tr><td></td><td>%s</td><td></td><td>%s</td><td %s>%s</td></tr>' %
(error['id'], error['severity'], error_class, (error['id'], error['severity'], error_class,
error['msg'])) error['msg']))
else: else:
if cwe_url: output_file.write(
output_file.write( '\n <tr><td><a href="%s#line-%d">%d</a></td><td>%s</td><td>%s</td><td>%s</td><td %s>%s</td></tr>' %
"\n <tr><td><a href='%s#line-%d'>%d</a></td><td>%s</td><td>%s</td><td>%s</td><td %s>%s</td></tr>" % (data['htmlfile'], error['line'], error['line'],
(data['htmlfile'], error['line'], error['line'], error['id'], cwe_url, error['severity'], error_class,
error['id'], cwe_url, error['severity'], error_class, error['msg']))
error['msg']))
else:
output_file.write(
"\n <tr><td><a href='%s#line-%d'>%d</a></td><td>%s</td><td></td><td>%s</td><td %s>%s</td></tr>" %
(data['htmlfile'], error['line'], error['line'],
error['id'], error['severity'], error_class,
error['msg']))
output_file.write('\n </table>') output_file.write('\n </table>')
output_file.write(HTML_FOOTER % contentHandler.versionCppcheck) output_file.write(HTML_FOOTER % contentHandler.versionCppcheck)