301 <p> |
301 <p> |
302 Class implementing a checker for unused arguments, variables, ... . |
302 Class implementing a checker for unused arguments, variables, ... . |
303 </p> |
303 </p> |
304 |
304 |
305 <h3>Derived from</h3> |
305 <h3>Derived from</h3> |
306 None |
306 CodeStyleTopicChecker |
307 <h3>Class Attributes</h3> |
307 <h3>Class Attributes</h3> |
308 <table> |
308 <table> |
|
309 <tr><td>Category</td></tr> |
309 <tr><td>Codes</td></tr> |
310 <tr><td>Codes</td></tr> |
310 </table> |
311 </table> |
311 |
312 |
312 <h3>Class Methods</h3> |
313 <h3>Class Methods</h3> |
313 <table> |
314 <table> |
327 <tr> |
328 <tr> |
328 <td><a href="#UnusedChecker.__checkUnusedGlobals">__checkUnusedGlobals</a></td> |
329 <td><a href="#UnusedChecker.__checkUnusedGlobals">__checkUnusedGlobals</a></td> |
329 <td>Private method to check for unused global variables.</td> |
330 <td>Private method to check for unused global variables.</td> |
330 </tr> |
331 </tr> |
331 <tr> |
332 <tr> |
332 <td><a href="#UnusedChecker.__error">__error</a></td> |
|
333 <td>Private method to record an issue.</td> |
|
334 </tr> |
|
335 <tr> |
|
336 <td><a href="#UnusedChecker.__extractGlobalVariables">__extractGlobalVariables</a></td> |
333 <td><a href="#UnusedChecker.__extractGlobalVariables">__extractGlobalVariables</a></td> |
337 <td>Private method to get the names of all global variables.</td> |
334 <td>Private method to get the names of all global variables.</td> |
338 </tr> |
335 </tr> |
339 <tr> |
336 <tr> |
340 <td><a href="#UnusedChecker.__getArguments">__getArguments</a></td> |
337 <td><a href="#UnusedChecker.__getArguments">__getArguments</a></td> |
347 <tr> |
344 <tr> |
348 <td><a href="#UnusedChecker.__getUnusedArguments">__getUnusedArguments</a></td> |
345 <td><a href="#UnusedChecker.__getUnusedArguments">__getUnusedArguments</a></td> |
349 <td>Private method to get a list of unused arguments of the given function.</td> |
346 <td>Private method to get a list of unused arguments of the given function.</td> |
350 </tr> |
347 </tr> |
351 <tr> |
348 <tr> |
352 <td><a href="#UnusedChecker.__ignoreCode">__ignoreCode</a></td> |
|
353 <td>Private method to check if the message code should be ignored.</td> |
|
354 </tr> |
|
355 <tr> |
|
356 <td><a href="#UnusedChecker.__isDunderMethod">__isDunderMethod</a></td> |
349 <td><a href="#UnusedChecker.__isDunderMethod">__isDunderMethod</a></td> |
357 <td>Private method to check, if the function node defines a special function.</td> |
350 <td>Private method to check, if the function node defines a special function.</td> |
358 </tr> |
351 </tr> |
359 <tr> |
352 <tr> |
360 <td><a href="#UnusedChecker.__isEventHandlerMethod">__isEventHandlerMethod</a></td> |
353 <td><a href="#UnusedChecker.__isEventHandlerMethod">__isEventHandlerMethod</a></td> |
361 <td>Private method to check, if the function node defines a Qt event handler.</td> |
354 <td>Private method to check, if the function node defines a Qt event handler.</td> |
362 </tr> |
355 </tr> |
363 <tr> |
356 <tr> |
364 <td><a href="#UnusedChecker.__isStubFunction">__isStubFunction</a></td> |
357 <td><a href="#UnusedChecker.__isStubFunction">__isStubFunction</a></td> |
365 <td>Private method to check, if the given function node defines a stub function.</td> |
358 <td>Private method to check, if the given function node defines a stub function.</td> |
366 </tr> |
|
367 <tr> |
|
368 <td><a href="#UnusedChecker.run">run</a></td> |
|
369 <td>Public method to check the given source against miscellaneous conditions.</td> |
|
370 </tr> |
359 </tr> |
371 </table> |
360 </table> |
372 |
361 |
373 <h3>Static Methods</h3> |
362 <h3>Static Methods</h3> |
374 <table> |
363 <table> |
430 <b>__checkUnusedGlobals</b>(<i></i>) |
419 <b>__checkUnusedGlobals</b>(<i></i>) |
431 <p> |
420 <p> |
432 Private method to check for unused global variables. |
421 Private method to check for unused global variables. |
433 </p> |
422 </p> |
434 |
423 |
435 <a NAME="UnusedChecker.__error" ID="UnusedChecker.__error"></a> |
|
436 <h4>UnusedChecker.__error</h4> |
|
437 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
|
438 <p> |
|
439 Private method to record an issue. |
|
440 </p> |
|
441 |
|
442 <dl> |
|
443 |
|
444 <dt><i>lineNumber</i> (int)</dt> |
|
445 <dd> |
|
446 line number of the issue |
|
447 </dd> |
|
448 <dt><i>offset</i> (int)</dt> |
|
449 <dd> |
|
450 position within line of the issue |
|
451 </dd> |
|
452 <dt><i>code</i> (str)</dt> |
|
453 <dd> |
|
454 message code |
|
455 </dd> |
|
456 <dt><i>args</i> (list)</dt> |
|
457 <dd> |
|
458 arguments for the message |
|
459 </dd> |
|
460 </dl> |
|
461 <a NAME="UnusedChecker.__extractGlobalVariables" ID="UnusedChecker.__extractGlobalVariables"></a> |
424 <a NAME="UnusedChecker.__extractGlobalVariables" ID="UnusedChecker.__extractGlobalVariables"></a> |
462 <h4>UnusedChecker.__extractGlobalVariables</h4> |
425 <h4>UnusedChecker.__extractGlobalVariables</h4> |
463 <b>__extractGlobalVariables</b>(<i></i>) |
426 <b>__extractGlobalVariables</b>(<i></i>) |
464 <p> |
427 <p> |
465 Private method to get the names of all global variables. |
428 Private method to get the names of all global variables. |
553 <dt>Return Type:</dt> |
516 <dt>Return Type:</dt> |
554 <dd> |
517 <dd> |
555 list of tuples of (int, ast.arg) |
518 list of tuples of (int, ast.arg) |
556 </dd> |
519 </dd> |
557 </dl> |
520 </dl> |
558 <a NAME="UnusedChecker.__ignoreCode" ID="UnusedChecker.__ignoreCode"></a> |
|
559 <h4>UnusedChecker.__ignoreCode</h4> |
|
560 <b>__ignoreCode</b>(<i>code</i>) |
|
561 <p> |
|
562 Private method to check if the message code should be ignored. |
|
563 </p> |
|
564 |
|
565 <dl> |
|
566 |
|
567 <dt><i>code</i> (str)</dt> |
|
568 <dd> |
|
569 message code to check for |
|
570 </dd> |
|
571 </dl> |
|
572 <dl> |
|
573 <dt>Return:</dt> |
|
574 <dd> |
|
575 flag indicating to ignore the given code |
|
576 </dd> |
|
577 </dl> |
|
578 <dl> |
|
579 <dt>Return Type:</dt> |
|
580 <dd> |
|
581 bool |
|
582 </dd> |
|
583 </dl> |
|
584 <a NAME="UnusedChecker.__isDunderMethod" ID="UnusedChecker.__isDunderMethod"></a> |
521 <a NAME="UnusedChecker.__isDunderMethod" ID="UnusedChecker.__isDunderMethod"></a> |
585 <h4>UnusedChecker.__isDunderMethod</h4> |
522 <h4>UnusedChecker.__isDunderMethod</h4> |
586 <b>__isDunderMethod</b>(<i>functionNode</i>) |
523 <b>__isDunderMethod</b>(<i>functionNode</i>) |
587 <p> |
524 <p> |
588 Private method to check, if the function node defines a special function. |
525 Private method to check, if the function node defines a special function. |