Completed
Push — master ( 2389d9...58d132 )
by Sam
02:47
created

web/static/js/editcounter.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 22
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
dl 0
loc 22
rs 10
c 1
b 0
f 0
cc 0
nc 1
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 1.3333
noi 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A $(document).ready 0 20 1
1
(function () {
2
    $(document).ready(function () {
3
4
        $(".chart-wrapper").each(function () {
5
            var chartType = $(this).data("chart-type");
6
            if ( chartType === undefined ) {
7
                return false;
8
            }
9
            var data = $(this).data("chart-data");
10
            var labels = $(this).data("chart-labels");
11
            var $ctx = $("canvas", $(this));
12
            new Chart($ctx, {
0 ignored issues
show
Bug introduced by
The variable Chart seems to be never declared. If this is a global, consider adding a /** global: Chart */ 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...
Unused Code Best Practice introduced by
The object created with new Chart($ctx, {Identif...e))))),false,false)))}) is not used but discarded. Consider invoking another function instead of a constructor if you are doing this purely for side effects.
Loading history...
13
                type: chartType,
14
                data: {
15
                    labels: labels,
16
                    datasets: [ { data: data } ]
17
                }
18
            });
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
19
        });
20
21
    });
22
} )();
23