Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Side by Side Diff: Source/devtools/scripts/jsdoc-validator/tests/function.js

Issue 315213003: DevTools: [JsDocValidator] Check validity of @param and @return annotations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 function badFuncNoAnnotation() { 1 function badFuncNoAnnotation() {
2 return 1; // ERROR - no @return annotation. 2 return 1; // ERROR - no @return annotation.
3 } 3 }
4 4
5 /** 5 /**
6 * @return {number} 6 * @return {number}
7 */ 7 */
8 function badFuncAnnotatedButNoReturn() // ERROR - no @return annotation. 8 function badFuncAnnotatedButNoReturn() // ERROR - no @return annotation.
9 { 9 {
10 } 10 }
(...skipping 16 matching lines...) Expand all
27 27
28 /** 28 /**
29 * @returns {number} 29 * @returns {number}
30 */ 30 */
31 function badReturnsShouldBeReturnFunc() // ERROR - @returns, should be @return. 31 function badReturnsShouldBeReturnFunc() // ERROR - @returns, should be @return.
32 { 32 {
33 return 1; 33 return 1;
34 } 34 }
35 35
36 /** 36 /**
37 * @return number
38 */
39 function badReturnShouldBeTypedFunc() // ERROR - number, not {number}.
40 {
41 return 1;
42 }
43
44 /**
45 * @param number foo
46 * @param bar
47 */
48 function badParamAnnotationsFunc(foo, bar) // ERROR - @param's should be well-fo rmed
49 {
50 return 1;
51 }
52
53
54 /**
37 * @returns {number} 55 * @returns {number}
38 */ 56 */
39 function badReturnsShouldBeReturnNoValueFunc() // ERROR - @returns, should be @r eturn. 57 function badReturnsShouldBeReturnNoValueFunc() // ERROR - @returns, should be @r eturn.
40 { 58 {
41 return; 59 return;
42 } 60 }
43 61
44 /** 62 /**
45 * @returns {number} 63 * @returns {number}
46 */ 64 */
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 284
267 /** 285 /**
268 * @returns {number} 286 * @returns {number}
269 */ 287 */
270 badMethodReturnsShouldBeReturn: function() // ERROR - @returns, should be @r eturn 288 badMethodReturnsShouldBeReturn: function() // ERROR - @returns, should be @r eturn
271 { 289 {
272 return 1; 290 return 1;
273 }, 291 },
274 292
275 /** 293 /**
294 * @returns number
295 */
296 badMethodReturnShouldBeTyped: function() // ERROR - number, not {number}
297 {
298 return 1;
299 },
300
301 /**
276 * @returns {number} 302 * @returns {number}
277 */ 303 */
278 badMethodReturnsShouldBeAbsentToo: function() // ERROR - @returns, should be absent 304 badMethodReturnsShouldBeAbsentToo: function() // ERROR - @returns, should be absent
279 { 305 {
280 return; 306 return;
281 }, 307 },
282 308
283 /** 309 /**
284 * @returns {number} 310 * @returns {number}
285 */ 311 */
286 badMethodReturnsShouldBeAbsent: function() // ERROR - @returns, should be ab sent 312 badMethodReturnsShouldBeAbsent: function() // ERROR - @returns, should be ab sent
287 { 313 {
288 var foo = 1; 314 var foo = 1;
315 },
316
317 /**
318 * @param number foo
319 * @param bar
320 */
321 badMethodParamAnnotations: function(foo, bar) // ERROR - @param's should be well-formed
322 {
323 return 1;
289 } 324 }
290 } 325 }
291 326
292 return new TypeThree(); 327 return new TypeThree();
293 } 328 }
294 329
295 330
296 /** 331 /**
297 * @param {string} a 332 * @param {string} a
298 * @param {string} b 333 * @param {string} b
299 * @param {string} c 334 * @param {string} c
300 */ 335 */
301 function funcParamsOK1(a, b, c) {} 336 function funcParamsOK1(a, b, c) {}
302 337
303 function funcParamsOK2(a, b, c) {} 338 function funcParamsOK2(a, b, c) {}
304 339
305 /** 340 /**
306 * @param {string} a 341 * @param {string} a
307 * @param {string} c 342 * @param {string} c
308 */ 343 */
309 function funcParamsMissingTag1(a, b, c) {} 344 function funcParamsMissingTag1(a, b, c) {}
310 345
311 /** 346 /**
312 * @param {string} a 347 * @param {string} a
313 */ 348 */
314 function funcParamsMissingTag2(a, b, c) {} 349 function funcParamsMissingTag2(a, b, c) {}
315 350
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698