Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( d3ad00...acd091 )
by Pierre
04:27
created

alert.js ➔ ... ➔ Modal.extend.confirm   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
nc 3
nop 0
dl 0
loc 20
rs 8.8571
c 0
b 0
f 0
1
'use strict';
0 ignored issues
show
Coding Style introduced by
Use the function form of "use strict".
Loading history...
2
3
define(['jquery', 'marionette', 'lodash', 'core/modal'], function($, Mn, _, Modal) {
0 ignored issues
show
Bug introduced by
define does not seem to be defined.
Loading history...
4
    return {
5
        alert: function(message) {
6
            let m = Modal.extend({
0 ignored issues
show
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
7
                'template': message,
8
                'modal': {
9
                    'buttons': {
10
                        'Close': {
11
                            'close': true,
12
                            'class': 'info',
13
                            'flat': true
14
                        },
15
                    }
16
                }
17
            });
18
19
            let v = new m();
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like m should be capitalized.
Loading history...
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
20
21
            v.render();
22
23
            return v;
24
        },
25
        confirm: function(message, callback) {
26
            let m = Modal.extend({
0 ignored issues
show
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
27
                'template': message,
28
                'modal': {
29
                    'buttons': {
30
                        'Cancel': {
31
                            'close': true,
32
                            'class': 'warning',
33
                            'flat': true
34
                        },
35
                        'OK': {
36
                            'class': 'success',
37
                            'flat': true,
38
                            'save': true
39
                        }
40
                    },
41
                    'events': {
42
                        'modal:save': 'confirm'
43
                    }
44
                },
45
                confirm: function() {
46
                    this.showLoader();
47
48
                    let close = _.bind(function() {
0 ignored issues
show
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
49
                        this.$el.modal('hide');
50
                        this.hideLoader();
51
                    }, this);
52
53
                    if (_.isFunction(callback)) {
54
                        let response = callback.call(this, true);
0 ignored issues
show
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
55
56
                        if (response instanceof Promise || response instanceof $.Deferred || _.result(response, 'then')) {
0 ignored issues
show
Bug introduced by
Promise does not seem to be defined.
Loading history...
57
                            response.then(close);
58
                        } else {
59
                            close.apply(this)
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
60
                        }
61
                    } else {
62
                        close.apply(this);
63
                    }
64
                }
65
            });
66
67
            let v = new m();
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like m should be capitalized.
Loading history...
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
68
69
            v.render();
70
71
            return v;
72
        }
73
    };
74
});