Passed
Push — v1 ( e777a2...cb149e )
by Andrew
17:10 queued 08:41
created

src/web/assets/src/js/OptimizedImagesField.js   C

Complexity

Total Complexity 55
Complexity/F 1.72

Size

Lines of Code 329
Function Count 32

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 55
eloc 214
c 0
b 0
f 0
dl 0
loc 329
rs 6
mnd 23
bc 23
fnc 32
bpm 0.7187
cpm 1.7187
noi 81

2 Functions

Rating   Name   Duplication   Size   Complexity  
A OptimizedImagesField.js ➔ Plugin 0 10 2
A OptimizedImagesField.js ➔ imageLoaded 0 12 4

How to fix   Complexity   

Complexity

Complex classes like src/web/assets/src/js/OptimizedImagesField.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/* global $ */
2
/* global Craft */
3
/* global Garnish */
4
5
/**
6
 * Image Optimize plugin for Craft CMS
7
 *
8
 * OptimizedImages Field JS
9
 *
10
 * @author    nystudio107
11
 * @copyright Copyright (c) 2017 nystudio107
12
 * @link      https://nystudio107.com
13
 * @package   ImageOptimize
14
 * @since     1.2.0
15
 */
16
17
/**
18
 * Convert the passed in bytes into a human readable format
19
 *
20
 * @param bytes
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 3 spaces but found 1
Loading history...
21
 * @param si
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 3 spaces but found 1
Loading history...
22
 * @param dp
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 3 spaces but found 1
Loading history...
23
 * @returns {string}
0 ignored issues
show
Coding Style introduced by
Tag @returns cannot be grouped with parameter tags in a doc comment
Loading history...
24
 */
25
function humanFileSize(bytes, si=false, dp=1) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
26
    const thresh = si ? 1000 : 1024;
27
28
    if (Math.abs(bytes) < thresh) {
29
        return bytes + ' B';
30
    }
31
32
    const units = si
33
        ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
34
        : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
35
    let u = -1;
36
    const r = 10**dp;
37
38
    do {
39
        bytes /= thresh;
40
        ++u;
41
    } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
42
43
44
    return bytes.toFixed(dp) + ' ' + units[u];
45
}
46
47
/**
48
 * After an image has loaded, query the performance API for the decodedBodySize
49
 *
50
 * @param image
51
 */
52
function imageLoaded(image) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
53
    const url = image.src || image.href;
54
    if (url && url.length > 0) {
55
        const iTime = performance.getEntriesByName(url)[0];
0 ignored issues
show
Bug introduced by
The variable performance seems to be never declared. If this is a global, consider adding a /** global: performance */ 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...
56
        if (iTime !== undefined) {
57
            const elem = image.parentNode.parentNode.parentNode.nextElementSibling.querySelector('.io-file-size');
58
            if (elem) {
59
                elem.innerHTML = humanFileSize(iTime.decodedBodySize, true);
60
            }
61
        }
62
    }
63
}
64
65
(function ( $, window, document) {
66
67
    const pluginName = "ImageOptimizeOptimizedImages",
68
        defaults = {
69
        };
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
70
71
    // Plugin constructor
72
    function Plugin( element, options ) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
73
        this.element = element;
74
75
        this.options = $.extend( {}, defaults, options) ;
0 ignored issues
show
Coding Style introduced by
Space after opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Space after closing parenthesis of function call prohibited
Loading history...
76
77
        this._defaults = defaults;
78
        this._name = pluginName;
79
80
        this.init();
81
    }
82
83
    Plugin.prototype = {
84
85
        init: function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
86
            $(function () {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
87
88
                /* -- _this.options gives us access to the $jsonVars that our FieldType passed down to us */
89
90
                const images = document.querySelectorAll("img.io-preview-image");
91
                for (const image of images) {
92
                    if (image.complete) {
93
                        imageLoaded(image);
94
                    } else {
95
                        image.addEventListener('load', (event) => {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
96
                            imageLoaded(event.target);
97
                        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
98
                    }
99
                }
100
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
101
        }
102
    };
103
104
    // A really lightweight plugin wrapper around the constructor,
105
    // preventing against multiple instantiations
106
    $.fn[pluginName] = function ( options ) {
107
        return this.each(function () {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
108
            if (!$.data(this, "plugin_" + pluginName)) {
109
                $.data(this, "plugin_" + pluginName,
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
110
                    new Plugin( this, options ));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 20.
Loading history...
Coding Style introduced by
Space after opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing parenthesis; 1 found
Loading history...
111
            }
112
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
113
    };
114
115
})($, window, document);
116
117
Craft.OptimizedImagesInput = Garnish.Base.extend(
118
    {
119
        id: null,
120
        inputNamePrefix: null,
121
        inputIdPrefix: null,
122
123
        $container: null,
124
        $blockContainer: null,
125
        $addBlockBtnContainer: null,
126
        $addBlockBtnGroup: null,
127
        $addBlockBtnGroupBtns: null,
128
129
        blockSort: null,
130
        blockSelect: null,
131
132
        init: function(id, inputNamePrefix) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
133
134
            this.id = id;
135
            this.inputNamePrefix = inputNamePrefix;
136
            this.inputIdPrefix = Craft.formatInputId(this.inputNamePrefix);
137
138
            this.$container = $('#' + this.id);
139
            this.$blockContainer = this.$container.children('.variant-blocks');
140
            this.$addBlockBtnContainer = this.$container.children('.buttons');
141
            this.$addBlockBtnGroup = this.$addBlockBtnContainer.children('.btngroup');
142
            this.$addBlockBtnGroupBtns = this.$addBlockBtnGroup.children('.btn');
143
144
            // Create our action button menus
145
            this.$blockContainer.find('> > .actions > .settings').each( (index, value) => {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
146
                const $value = $(value);
147
                let menuBtn;
148
                if ($value.data('menubtn')) {
149
                    menuBtn = $value.data('menubtn');
150
                } else {
151
                    menuBtn = new Garnish.MenuBtn(value);
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 20.
Loading history...
152
                }
153
                menuBtn.menu.settings.onOptionSelect = $.proxy(function(option) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
154
                    this.onMenuOptionSelect(option, menuBtn);
155
                }, this);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
156
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
157
158
            const $blocks = this.$blockContainer.children();
159
160
            this.blockSort = new Garnish.DragSort($blocks, {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
161
                handle: '> .actions > .move',
162
                axis: 'y',
163
                collapseDraggees: true,
164
                magnetStrength: 4,
165
                helperLagBase: 1.5,
166
                helperOpacity: 0.9,
167
                onSortChange: $.proxy(function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
168
                    this.resetVariantBlockOrder();
169
                }, this)
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
170
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
171
172
            this.addListener(this.$addBlockBtnGroupBtns, 'click', function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
173
                this.addVariantBlock(null);
174
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
175
176
            this.addAspectRatioHandlers();
177
            this.reIndexVariants();
178
        },
179
180
        onMenuOptionSelect: function(option, menuBtn) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
181
            const $option = $(option);
182
            const container = menuBtn.$btn.closest('.matrixblock');
183
184
            switch ($option.data('action')) {
185
                case 'add': {
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
186
                    this.addVariantBlock(container);
187
                    break;
188
                }
189
                case 'delete': {
190
                    if (!$option.hasClass('disabled')) {
191
                        this.deleteVariantBlock(container);
192
                    }
193
                    break;
194
                }
195
            }
196
        },
197
198
        getHiddenBlockCss: function($block) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
199
            return {
200
                opacity: 0,
201
                marginBottom: -($block.outerHeight())
202
            };
203
        },
204
205
        // Re-index all of the variant blocks
206
        reIndexVariants: function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
207
            this.$blockContainer = this.$container.children('.variant-blocks');
208
            const $blocks = this.$blockContainer.children();
209
            $blocks.each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
210
                const variantIndex = index;
211
                const $value = $(value);
212
                const elements = $value.find('div .field, label, input, select');
213
214
                // Re-index all of the element attributes
215
                $(elements).each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
216
                    // id attributes
217
                    let str = $(value).attr('id');
218
                    if (str) {
219
                        str = str.replace(/-([0-9]+)-/g, "-" + variantIndex +"-");
220
                        $(value).attr('id', str);
221
                    }
222
                    // for attributes
223
                    str = $(value).attr('for');
224
                    if (str) {
225
                        str = str.replace(/-([0-9]+)-/g, "-" + variantIndex +"-");
226
                        $(value).attr('for', str);
227
                    }
228
                    // Name attributes
229
                    str = $(value).attr('name');
230
                    if (str) {
231
                        str = str.replace(/\[([0-9]+)]/g, "[" + variantIndex +"]");
232
                        $(value).attr('name', str);
233
                    }
234
                });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
235
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
236
            let disabledDeleteItem = false;
237
            // If we only have one block, don't allow it to be deleted
238
            if ($blocks.length == 1) {
0 ignored issues
show
Best Practice introduced by
Comparing $blocks.length to 1 using the == operator is not safe. Consider using === instead.
Loading history...
239
                disabledDeleteItem = true;
240
            }
241
            $blocks.find('> .actions > .settings').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
242
                const $value = $(value);
243
                let menuBtn;
244
                if ($value.data('menubtn')) {
245
                    menuBtn = $value.data('menubtn');
246
                    let menuItem = $(menuBtn.menu.$menuList[1]);
247
                    if (typeof menuItem !== undefined) {
248
                        if (disabledDeleteItem) {
249
                            menuItem.find("> li > a").addClass('disabled').disable();
250
                        } else {
251
                            menuItem.find("> li > a").removeClass('disabled').enable();
252
                        }
253
                    }
254
                }
255
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
256
        },
257
258
        addAspectRatioHandlers: function () {
259
            this.addListener($('.lightswitch'), 'click', function(ev) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
260
                const $target = $(ev.target);
261
                const $block = $target.closest('.matrixblock');
262
                $block.find('.io-aspect-ratio-wrapper').slideToggle();
263
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
264
            this.addListener($('.io-select-ar-box'), 'click', function(ev) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
265
                const $target = $(ev.target);
266
                let x = $(ev.target).data('x'),
267
                    y = $(ev.target).data('y'),
268
                    custom = $(ev.target).data('custom'),
269
                    field, $block;
270
                // Select the appropriate aspect ratio
271
                $block = $target.closest('.matrixblock');
272
                $block.find('.io-select-ar-box').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
273
                    $(value).removeClass('io-selected-ar-box');
274
                });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
275
                $target.addClass('io-selected-ar-box');
276
277
                // Handle setting the actual field values
278
                if (custom) {
279
                    $block.find('.io-custom-ar-wrapper').slideDown();
280
                } else {
281
                    $block.find('.io-custom-ar-wrapper').slideUp();
282
                    field = $block.find('input')[2];
283
                    $(field).val(x);
284
                    field = $block.find('input')[3];
285
                    $(field).val(y);
286
                }
287
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
288
        },
289
290
        addVariantBlock: function(container) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
291
            let $block = $(this.$blockContainer.children()[0]).clone();
292
            // Reset to default values
293
            $block.find('.io-select-ar-box').each( (index, value) => {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
294
                if (index === 0) {
295
                    $(value).addClass('io-selected-ar-box');
296
                } else {
297
                    $(value).removeClass('io-selected-ar-box');
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 20.
Loading history...
298
                }
299
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
300
            $block.find('.io-custom-ar-wrapper').hide();
301
            let field = $block.find('input')[0];
302
            $(field).val(1200);
303
            field = $block.find('input')[1];
304
            $(field).val(1);
305
            field = $block.find('input')[2];
306
            $(field).val(16);
307
            field = $block.find('input')[3];
308
            $(field).val(9);
309
            field = $block.find('select')[0];
310
            $(field).val(82);
311
            field = $block.find('select')[1];
312
            $(field).val('jpg');
313
            $block.css(this.getHiddenBlockCss($block)).velocity({
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
314
                opacity: 1,
315
                'margin-bottom': 10
316
            }, 'fast', $.proxy(function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 12.
Loading history...
317
                // Insert the block in the right place
318
                if (container) {
319
                    $block.insertBefore(container);
320
                } else {
321
                    $block.appendTo(this.$blockContainer);
322
                }
323
                // Update the Garnish UI controls
324
                this.blockSort.addItems($block);
325
                this.addAspectRatioHandlers();
326
                $block.find('.settings').each( (index, value) => {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
327
                    let $value = $(value),
328
                        menuBtn,
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 24.
Loading history...
329
                        menu;
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 20 spaces, but found 24.
Loading history...
330
0 ignored issues
show
Coding Style introduced by
There should be no empty lines in a multi-line function call.
Loading history...
331
                    menu = this.$container.find('.io-menu-clone > .menu').clone();
332
                    $(menu).insertAfter($value);
333
                    menuBtn = new Garnish.MenuBtn(value);
334
0 ignored issues
show
Coding Style introduced by
There should be no empty lines in a multi-line function call.
Loading history...
335
                    menuBtn.menu.settings.onOptionSelect = $.proxy(function(option) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
336
                        this.onMenuOptionSelect(option, menuBtn);
337
                    }, this);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
338
                });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
339
                this.reIndexVariants();
340
            }, this));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
341
        },
342
343
        deleteVariantBlock: function(container) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
344
            container.velocity(this.getHiddenBlockCss(container), 'fast', $.proxy( () => {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
345
                container.remove();
346
                this.reIndexVariants();
347
            }, this));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
348
        },
349
350
        resetVariantBlockOrder: function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
351
            this.reIndexVariants();
352
        }
353
    });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 0 spaces, but found 4.
Loading history...
354