summaryrefslogtreecommitdiffstats
path: root/templates/txt.jinja2
blob: 97752fd279b84eb9381233b602b613633096c68a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
=== {{ name }} - Student ID: {{ student_no }} Automatic marking report ===

== Class Tree: ==

{{ recurse_class_tree_text(class_tree) }}

== File Analysis ==
{%- set flat_files = flatten_struct(files) %}
{% for filename, files_contents in flat_files.items() %}
    = {{ filename + " =" -}}
    {%- if files_contents["present"] -%}
    {%- if files_contents["has_exception"] %}
        *** File cannot be run - has compile time exception ***
        Please note that this file cannot be analysed or have tests preformed upon it-
            this can lead to the whole test suite failing if another module imports this.
        Exception Type:
            {{ files_contents["exception"]["type"] }}
        Exception String:
            {{ files_contents["exception"]["str"] }}
        Full Traceback:
```
{{ files_contents["exception"]["traceback"] }}
```
    {%- else -%}
    {% if "classes" in files_contents.keys() %}
        Classes:
        {%- set flat_classes = flatten_struct(files_contents["classes"]) -%}
        {% for class_name, class_contents in flat_classes.items() %}
            {{ class_name }}
        {%- endfor -%}
    {%- endif -%}
    {% if "functions" in files_contents.keys() %}
        Functions:
        {%- set flat_functions = flatten_struct(files_contents["functions"]) %}
        {%- for function_name, function_contents in flat_functions.items() %}
            {{ function_name + ":" }}
            {%- if function_contents["present"] %}
                Arguments:
                    {{ function_contents["arguments"] }}
                    Enough? {{ bool_to_yesno(function_contents["minimum_arguments"] >= get_required_num_args(function_name)) }}
                Documentation:
                    {{ len_documentation(function_contents["documentation"]["comments"], function_contents["documentation"]["doc"]) }} characters long
                    {%- if txt_show_full_docs == "True" %}
                    Comments:
                        {%- if function_contents["documentation"]["comments"] == "None" %}
                        *** No comments present ***
                        {%- else %}
```
{{ function_contents["documentation"]["comments"] }}
```
                        {%- endif %}
                    Docstring:
                        {%- if function_contents["documentation"]["doc"] == "None" %}
                        *** No docstring present ***
                        {%- else %}
```
{{ function_contents["documentation"]["doc"] }}
```
                        {%- endif -%}
                    {%- endif %}
                    Source:
                        {{ get_source_numlines(function_contents["source_code"]) }}
                        {%- if txt_show_source == "True" %}
                        Code:
```
{{ function_contents["source_code"] }}
```
                        {%- endif %}
            {%- else %}
                *** Function not present ***
            {%- endif %}
        {%- endfor -%}
    {%- endif -%}
    {%- endif -%}
    {% else %}
        *** File not present ***
    {% endif %}
{% endfor %}

{% if out != "stdout" -%}
{{ test_results["pytest_report"] }}
{%- endif -%}