Warnings Types

Index of All Documentation » Wing Pro Reference Manual » Code Warnings and Quality Inspection »


Wing's internal code checker supports following types of code warnings. Each of these may be configured from the Configuration: Defaults page from the drop-down menu at the top of the Code Warnings tool.

General

Import Not Found is shown when a module or package cannot be found on the configured Python Path. This may indicate that you may need to modify the Python Path in Project Properties, so that Wing can find your modules. In cases where this is not feasible, or if code is overriding the import, warnings of this type may be disabled instead.

Indent warnings are shown when an indent is not consistent in size or content (tabs vs. spaces) with indents found elsewhere in the file, or when an indent does not match the logical structure of the code. For example, the line after if and for must be indented, while the line after return or raise should be outdented. Code with inconsistent indent size or content may still be correct, and sometimes warnings of this type should be disabled.

Undefined Symbols

Undefined Name warnings are shown when a variable is used without the variable ever being set, or when a function is used without defining the function. This warning usually indicates broken code that should be fixed, and warnings of this type should be disabled only in rare cases.

Undefined Attribute warnings are shown when a class or instance attribute name appears to be undefined. This occurs when the attribute is not in the list of attributes that Wing has found for the type of symbol before the dot. This list is the same as the one that used for autocompletion on the object. Warnings of this type should be disabled in cases where Wing doesn't identify the object correctly or the list of attributes is incomplete. When disabled, an undefined attribute warning for the same attribute name and object type are ignored across all files.

Unused Symbols

Import Not Used warnings are shown when a name that is imported is not used anywhere in the file that it has been imported into. Warnings of this type should be disabled in cases where the name is used in another file, as an attribute of the module.

Variable Not Used warnings are shown when a variable is set but never used in any other code. When warnings of this type are enabled, additional configuration is possible with the Configure button, to control some of the common cases where this warning is unwanted. These cases include:

(1) By default, Wing does not warn about top level global variables in a file because they may be used as module attributes in another file. However, Wing still warns if __all__ is set in the file and the unused global is not included in it.

(2) By default, Wing does not warn about unused variables if they are defined by unpacking a tuple, such as in a, b = (1, 2). However, Wing still does warn about unpacked variables if all of the variables unpacked together are unused.

(3) By default, Wing does not warn about unused variables with names starting with unused or dummy since these are usually intentionally unused values. Additional regular expressions for identifying intentionally unused variables may be set in the configuration dialog.

Other unused variables are always ignored by Wing, including: (a) variables or methods set in a class scope, because they may be used as either class or instance attributes, and (b) loop variables such idx in for idx in range(5).

Argument Not Used warnings are shown when a function or method argument is defined in the def statement but never used. This warning type is disabled by default because arguments often need to be included to match a desired standard signature. It may be enabled for code bases where this is not a frequent issue.