{# Copyright (C) 2013 Matthieu Caneill License: GNU Affero General Public License, version 3 or above. #} {% macro display_table(telems) -%} {% for (name, content) in telems %} {% endfor %}
{{ name }} {{ content }}
{%- endmacro %} {% macro display_searchform(form, filter, display="block") -%}
Filter by package:
{% if filter %} {{ form.packagename }} {% else %} {{ form.packagename(autofocus=True) }} {% endif %} {{ form.packageversion }}

Filter by generator:
{{ form.generatorname }} {{ form.generatorversion }}

{%- endmacro %} {# from http://pythonhosted.org/Flask-SQLAlchemy/api.html#flask.ext.sqlalchemy.Pagination.iter_pages #} {% macro render_pagination(pagination) -%} {%- endmacro %} {% macro render_metadata(metadata) -%} {{ display_table([ ("Generator", render_generator(metadata.generator)), ("Software under test", render_sut(metadata.sut)), ("File", render_file(metadata.file_)), ("Stats", render_stats(metadata.stats))]) }} {%- endmacro %} {% macro render_result(result) -%} {% if result.type == "issue" %} {{ display_table([ ("Type", "Issue"), ("CWE", result.cwe or ""), ("Severity", result.severity or ""), ("Message", render_message(result.message)), ("Notes", render_notes(result.notes)), ("Location", render_location(result.location)), ("Trace", render_trace(result.trace)), ("Custom fields", render_customfields(result.customfields))]) }} {% elif result.type == "failure" %} {{ display_table([ ("Type", "Failure"), ("Message", render_message(result.message)), ("Location", render_location(result.location)), ("Custom fields", render_customfields(result.customfields))]) }} {% elif result.type == "info" %} {{ display_table([ ("Type", "Info"), ("Message", render_message(result.message)), ("Location", render_location(result.location)), ("Custom fields", render_customfields(result.customfields))]) }} {% endif %} {%- endmacro %} {% macro render_generator(generator) -%} {{ generator.name }} {% if generator.version %}({{ generator.version }}){% endif %} {%- endmacro %} {% macro render_stats(stats) -%} Time: {{ stats.wallclocktime }} {%- endmacro %} {% macro render_sut(sut) -%} ({{ sut.type }}) - {{ sut.name }} ({{ sut.version }}) {% if sut.release %}({{ sut.release }}){% endif %} {% if sut.buildarch %}({{ sut.buildarch }}){% endif %} {%- endmacro %} {% macro render_message(message) -%} {{ message.text }} {%- endmacro %} {% macro render_notes(notes) -%} {{ notes.text }} {%- endmacro %} {% macro render_trace(trace) -%} {% for state in trace.states %} {{ render_state(state) }}
{% endfor %} {%- endmacro %} {% macro render_state(state) -%} {{ render_location(state.location) }} {% if state.notes %} : {{ render_message(state.notes) }}{% endif %} {%- endmacro %} {% macro render_location(location) -%} {{ render_file(location.file) }} {% if location.function and location.function.name != "" %}({{ render_function(location.function) }}){% endif %} {% if location.point %} ({{ render_point(location.point) }}) {% elif location.range %} ({{ render_range(location.range) }}) {% endif %} {%- endmacro %} {% macro render_file(file) -%} {% if file %}{{ file.givenpath }}{% endif %} {%- endmacro %} {% macro render_hash(hash) -%} {{ hash.alg }} / {{ hash.hexdigest }} {%- endmacro %} {% macro render_function(function) -%} {{ function.name }} {%- endmacro %} {%- macro render_point(point) -%} {{ point.line }}:{{ point.column }} {%- endmacro -%} {% macro render_range(range) -%} {{ render_point(range.start) }} - {{ render_point(range.end) }} {%- endmacro %} {% macro render_customfields(customfields) -%} {% if customfields %}TODO{% endif %} {%- endmacro %}