Passed
Push — master ( 52c832...9cf879 )
by Christian
14:40 queued 16s
created

src/Administration/Resources/app/administration/src/module/sw-cms/blocks/commerce/gallery-buybox/component/index.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 22
Function Count 2

Duplication

Duplicated Lines 22
Ratio 100 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
mnd 1
bc 1
fnc 2
dl 22
loc 22
bpm 0.5
cpm 1.5
noi 1
c 0
b 0
f 0
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1 View Code Duplication
import template from './sw-cms-block-gallery-buybox.html.twig';
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
import './sw-cms-block-gallery-buybox.scss';
3
4
const { Component, State } = Shopware;
0 ignored issues
show
Bug introduced by
The variable Shopware seems to be never declared. If this is a global, consider adding a /** global: Shopware */ 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...
5
6
Component.register('sw-cms-block-gallery-buybox', {
7
    template,
8
9
    computed: {
10
        currentDeviceView() {
11
            return State.get('cmsPageState').currentCmsDeviceView;
12
        },
13
14
        currentDeviceViewClass() {
15
            if (this.currentDeviceView) {
16
                return `is--${this.currentDeviceView}`;
17
            }
18
19
            return null;
20
        }
21
    }
22
});
23