js/main.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 42
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 29
mnd 0
bc 0
fnc 4
dl 0
loc 42
rs 10
bpm 0
cpm 1
noi 4
c 0
b 0
f 0
1
window.onload = function () {
2
    let canvas = document.getElementById("canvas");
3
    // The drawing surface
4
5
    let residence = [
6
        new Tenement("4 rue du coin", 3, 16),
0 ignored issues
show
Bug introduced by
The variable Tenement seems to be never declared. If this is a global, consider adding a /** global: Tenement */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
7
        new House("1 rue du coin", 3),
0 ignored issues
show
Bug introduced by
The variable House seems to be never declared. If this is a global, consider adding a /** global: House */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
        new House("2 rue du coin", 6),
9
        new House("5 avenue Marshal", 3),
10
        new Tenement("6 rue paysanne", 4, 25),
11
        new Hospital("hotel dieu", 10),
0 ignored issues
show
Bug introduced by
The variable Hospital seems to be never declared. If this is a global, consider adding a /** global: Hospital */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
        new House("7 rue de la pie", 4),
13
        new House("5 rue de la pie", 3),
14
        new House("3 rue de la pie", 4),
15
        new House("8 rue de la paix", 4),
16
        new House("25 rue de la maison", 7),
17
        new House("2 rue Victor Hugo", 7),
18
        new Firehouse("4 rue Victor Hugo", 4, 11),
0 ignored issues
show
Bug introduced by
The variable Firehouse seems to be never declared. If this is a global, consider adding a /** global: Firehouse */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
19
        new Tenement("4 rue du lys", 5, 36),
20
        new Tenement("2 rue de la croix", 3, 19),
21
        new Tenement("6 rue du lys", 4, 25),
22
        new House("7 chemin pavé", 2),
23
        new Tenement("8 rue du soldat anglais", 4, 22),
24
        new House("12 rue du soldat anglais", 4),
25
        new House("14 rue du soldat anglais", 3),
26
27
    ];
28
29
    residence.forEach(
30
        (build, index) => {
31
            build.show(canvas);  // blit the building on the canvas
32
33
            // thanks the id tracker
34
            document.getElementById((index + 1).toString()).onload = function () {
35
                // on Click alert box
36
                this.onclick = function () {
37
                    build.showDetails();
38
                };
39
            }
40
        }
41
    );
42
}