Test Failed
Push — main ( d9df25...7cc2e0 )
by chief
07:27
created

web/public/s/js/config.js   A

Complexity

Total Complexity 4
Complexity/F 4

Size

Lines of Code 26
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 19
c 0
b 0
f 0
dl 0
loc 26
rs 10
wmc 4
mnd 3
bc 3
fnc 1
bpm 3
cpm 4
noi 3
1
var sr_config = {};
2
sr_config.account = {};
3
sr_config.watch = {};
4
5
sr_config.account.loggedIn = false;
6
sr_config.account.subscribed = false;
7
sr_config.watch.ownAccount = false;
8
sr_config.watch.commented = false;
9
10
sr_config = { 
11
    update_config: function(config, new_value) {
12
        try {
13
            if(Array.isArray(config)) {
14
                for (const val of config) {
15
                    sr_config.val[0].val[1] = val[1];
16
                    console.log(val);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
17
                }
1 ignored issue
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...
18
            } else {
19
                config = new_value;
0 ignored issues
show
Unused Code introduced by
The assignment to variable config seems to be never used. Consider removing it.
Loading history...
20
                return 0;
21
            }
22
        } catch (error) {
23
            return 1;
24
        }
25
    }
26
}