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

address.js ➔ ... ➔ Alert.confirm   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
define(
2
    ['core/view', './address_modal', 'template', 'core/alert', 'translator'],
3
    function(ItemView, AddressModal, Template, Alert, __) {
4
        'use strict';
5
6
        return ItemView.extend({
7
            template: Template.client.address,
8
9
            ui: {
10
                'deleteAddress': '.delete-address',
11
                'editAddress': '.edit-address'
12
            },
13
14
            events: {
15
                "click @ui.deleteAddress": 'deleteAddress',
16
                "click @ui.editAddress": 'editAddress'
17
            },
18
19
            initialize: function() {
20
                this.listenTo(this.model, 'sync', this.modelSynced);
21
            },
22
23
            modelSynced: function() {
24
                this.render();
25
            },
26
27
            deleteAddress: function(event) {
28
                event.preventDefault();
29
30
                let view = this;
0 ignored issues
show
Backwards Compatibility introduced by
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Loading history...
31
32
                Alert.confirm(__('client.address.delete_confirm'), function(confirm) {
33
                    if (true === confirm) {
0 ignored issues
show
Complexity Best Practice introduced by
There is no return statement if true === confirm is false. Are you sure this is correct? If so, consider adding return; explicitly.

This check looks for functions where a return statement is found in some execution paths, but not in all.

Consider this little piece of code

function isBig(a) {
    if (a > 5000) {
        return "yes";
    }
}

console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined

The function isBig will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly return undefined.

This behaviour may not be what you had intended. In any case, you can add a return undefined to the other execution path to make the return value explicit.

Loading history...
34
                        return view.model.destroy(
35
                            {
36
                                wait: true,
37
                                error: function(model, xhr) {
38
                                    Alert.alert(xhr.responseJSON.message);
39
                                }
40
                            }
41
                        );
42
                    }
43
                });
44
            },
45
46
            editAddress: function(event) {
47
                event.preventDefault();
48
49
                this.trigger('before:model:edit');
50
51
                new AddressModal({
0 ignored issues
show
Unused Code Best Practice introduced by
The object created with new AddressModal({Identi...ngLiteralNode(href)))}) is not used but discarded. Consider invoking another function instead of a constructor if you are doing this purely for side effects.
Loading history...
52
                    model: this.model,
53
                    route: this.$(event.currentTarget).prop('href')
54
                });
55
56
                this.trigger('model:edit');
57
            }
58
        });
59
    });