Conditions | 1 |
Paths | 1 |
Total Lines | 202 |
Code Lines | 88 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 | /** |
||
7 | define(function () { |
||
8 | 'use strict'; |
||
9 | |||
10 | /** |
||
11 | * @exports TYPO3/CMS/DigitalAssetManagement/ContextMenuActions |
||
12 | */ |
||
13 | let ContextMenuActions = {}; |
||
14 | |||
15 | /** |
||
16 | * |
||
17 | * @param {string} menuType |
||
18 | * @param {string} identifier of the page |
||
19 | */ |
||
20 | ContextMenuActions.actionNewFile = function (menuType, identifier) { |
||
21 | let event = new CustomEvent('resolveEvent', { |
||
|
|||
22 | detail: { |
||
23 | 'event': 'actionNewFile', |
||
24 | 'menuType': menuType, |
||
25 | 'identifier': identifier |
||
26 | } |
||
27 | }); |
||
28 | document.dispatchEvent(event); |
||
29 | }; |
||
30 | |||
31 | /** |
||
32 | * |
||
33 | * @param {string} menuType |
||
34 | * @param {string} identifier of the page |
||
35 | */ |
||
36 | ContextMenuActions.actionNewFolder = function (menuType, identifier) { |
||
37 | let event = new CustomEvent('resolveEvent', { |
||
38 | detail: { |
||
39 | 'event': 'actionNewFolder', |
||
40 | 'menuType': menuType, |
||
41 | 'identifier': identifier |
||
42 | } |
||
43 | }); |
||
44 | document.dispatchEvent(event); |
||
45 | }; |
||
46 | |||
47 | /** |
||
48 | * |
||
49 | * @param {string} menuType |
||
50 | * @param {string} identifier of the page |
||
51 | */ |
||
52 | ContextMenuActions.actionUpload = function (menuType, identifier) { |
||
53 | let event = new CustomEvent('resolveEvent', { |
||
54 | detail: { |
||
55 | 'event': 'actionUpload', |
||
56 | 'menuType': menuType, |
||
57 | 'identifier': identifier |
||
58 | } |
||
59 | }); |
||
60 | document.dispatchEvent(event); |
||
61 | }; |
||
62 | |||
63 | /** |
||
64 | * |
||
65 | * @param {string} menuType |
||
66 | * @param {string} identifier of the page |
||
67 | */ |
||
68 | ContextMenuActions.actionDownload = function (menuType, identifier) { |
||
69 | let event = new CustomEvent('resolveEvent', { |
||
70 | detail: { |
||
71 | 'event': 'actionDownload', |
||
72 | 'menuType': menuType, |
||
73 | 'identifier': identifier |
||
74 | } |
||
75 | }); |
||
76 | document.dispatchEvent(event); |
||
77 | }; |
||
78 | |||
79 | /** |
||
80 | * |
||
81 | * @param {string} menuType |
||
82 | * @param {string} identifier of the page |
||
83 | */ |
||
84 | ContextMenuActions.actionMoveTo = function (menuType, identifier) { |
||
85 | let event = new CustomEvent('resolveEvent', { |
||
86 | detail: { |
||
87 | 'event': 'actionMoveTo', |
||
88 | 'menuType': menuType, |
||
89 | 'identifier': identifier |
||
90 | } |
||
91 | }); |
||
92 | document.dispatchEvent(event); |
||
93 | }; |
||
94 | |||
95 | /** |
||
96 | * |
||
97 | * @param {string} menuType |
||
98 | * @param {string} identifier of the page |
||
99 | */ |
||
100 | ContextMenuActions.actionCopyTo = function (menuType, identifier) { |
||
101 | let event = new CustomEvent('resolveEvent', { |
||
102 | detail: { |
||
103 | 'event': 'actionCopyTo', |
||
104 | 'menuType': menuType, |
||
105 | 'identifier': identifier |
||
106 | } |
||
107 | }); |
||
108 | document.dispatchEvent(event); |
||
109 | }; |
||
110 | |||
111 | /** |
||
112 | * |
||
113 | * @param {string} menuType |
||
114 | * @param {string} identifier of the page |
||
115 | */ |
||
116 | ContextMenuActions.actionDelete = function (menuType, identifier) { |
||
117 | let event = new CustomEvent('resolveEvent', { |
||
118 | detail: { |
||
119 | 'event': 'actionDelete', |
||
120 | 'menuType': menuType, |
||
121 | 'identifier': identifier |
||
122 | } |
||
123 | }); |
||
124 | document.dispatchEvent(event); |
||
125 | }; |
||
126 | |||
127 | /** |
||
128 | * |
||
129 | * @param {string} menuType |
||
130 | * @param {string} identifier of the page |
||
131 | */ |
||
132 | ContextMenuActions.actionRename = function (menuType, identifier) { |
||
133 | let event = new CustomEvent('resolveEvent', { |
||
134 | detail: { |
||
135 | 'event': 'actionRename', |
||
136 | 'menuType': menuType, |
||
137 | 'identifier': identifier |
||
138 | } |
||
139 | }); |
||
140 | document.dispatchEvent(event); |
||
141 | }; |
||
142 | |||
143 | /** |
||
144 | * |
||
145 | * @param {string} menuType |
||
146 | * @param {string} identifier of the page |
||
147 | */ |
||
148 | ContextMenuActions.actionInfo = function (menuType, identifier) { |
||
149 | let event = new CustomEvent('resolveEvent', { |
||
150 | detail: { |
||
151 | 'event': 'actionInfo', |
||
152 | 'menuType': menuType, |
||
153 | 'identifier': identifier |
||
154 | } |
||
155 | }); |
||
156 | document.dispatchEvent(event); |
||
157 | }; |
||
158 | |||
159 | /** |
||
160 | * |
||
161 | * @param {string} menuType |
||
162 | * @param {string} identifier of the page |
||
163 | */ |
||
164 | ContextMenuActions.actionPreview = function (menuType, identifier) { |
||
165 | let event = new CustomEvent('resolveEvent', { |
||
166 | detail: { |
||
167 | 'event': 'actionPreview', |
||
168 | 'menuType': menuType, |
||
169 | 'identifier': identifier |
||
170 | } |
||
171 | }); |
||
172 | document.dispatchEvent(event); |
||
173 | }; |
||
174 | |||
175 | /** |
||
176 | * |
||
177 | * @param {string} menuType |
||
178 | * @param {string} identifier of the page |
||
179 | */ |
||
180 | ContextMenuActions.actionReplace = function (menuType, identifier) { |
||
181 | let event = new CustomEvent('resolveEvent', { |
||
182 | detail: { |
||
183 | 'event': 'actionReplace', |
||
184 | 'menuType': menuType, |
||
185 | 'identifier': identifier |
||
186 | } |
||
187 | }); |
||
188 | document.dispatchEvent(event); |
||
189 | }; |
||
190 | |||
191 | /** |
||
192 | * |
||
193 | * @param {string} menuType |
||
194 | * @param {string} identifier of the page |
||
195 | */ |
||
196 | ContextMenuActions.actionEditStorage = function (menuType, identifier) { |
||
197 | let event = new CustomEvent('resolveEvent', { |
||
198 | detail: { |
||
199 | 'event': 'actionEditStorage', |
||
200 | 'menuType': menuType, |
||
201 | 'identifier': identifier |
||
202 | } |
||
203 | }); |
||
204 | document.dispatchEvent(event); |
||
205 | }; |
||
206 | |||
207 | return ContextMenuActions; |
||
208 | }); |
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.