| Conditions | 4 |
| Total Lines | 61 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import { shallowMount } from '@vue/test-utils'; |
||
| 6 | function createWrapper() { |
||
| 7 | return shallowMount(Shopware.Component.build('sw-cms-el-manufacturer-logo'), { |
||
|
|
|||
| 8 | propsData: { |
||
| 9 | element: { |
||
| 10 | config: { |
||
| 11 | media: { |
||
| 12 | source: 'static', |
||
| 13 | value: null, |
||
| 14 | required: true, |
||
| 15 | entity: { |
||
| 16 | name: 'media' |
||
| 17 | } |
||
| 18 | }, |
||
| 19 | displayMode: { |
||
| 20 | source: 'static', |
||
| 21 | value: 'cover' |
||
| 22 | }, |
||
| 23 | url: { |
||
| 24 | source: 'static', |
||
| 25 | value: null |
||
| 26 | }, |
||
| 27 | newTab: { |
||
| 28 | source: 'static', |
||
| 29 | value: true |
||
| 30 | }, |
||
| 31 | minHeight: { |
||
| 32 | source: 'static', |
||
| 33 | value: null |
||
| 34 | }, |
||
| 35 | verticalAlign: { |
||
| 36 | source: 'static', |
||
| 37 | value: null |
||
| 38 | } |
||
| 39 | }, |
||
| 40 | data: { |
||
| 41 | media: '' |
||
| 42 | } |
||
| 43 | }, |
||
| 44 | defaultConfig: {} |
||
| 45 | }, |
||
| 46 | data() { |
||
| 47 | return { |
||
| 48 | cmsPageState: { |
||
| 49 | currentPage: { |
||
| 50 | type: 'product_detail' |
||
| 51 | } |
||
| 52 | } |
||
| 53 | }; |
||
| 54 | }, |
||
| 55 | provide: { |
||
| 56 | cmsService: { |
||
| 57 | getCmsElementRegistry: () => { |
||
| 58 | return {}; |
||
| 59 | }, |
||
| 60 | getPropertyByMappingPath: () => { |
||
| 61 | return {}; |
||
| 62 | } |
||
| 63 | } |
||
| 64 | } |
||
| 65 | }); |
||
| 66 | } |
||
| 67 | |||
| 84 |
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.