Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 22 |
Function Count | 2 |
Duplicated Lines | 22 |
Ratio | 100 % |
Changes | 0 |
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'; |
|
|
|||
2 | import './sw-cms-block-gallery-buybox.scss'; |
||
3 | |||
4 | const { Component, State } = Shopware; |
||
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 |