<type>documentation</type>
<domain>warnings</domain>
<id>index</id>
<title>Code Warnings Tool</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>pro+</product>

The `Code Warnings <script:show-panel-code-warnings>`__ tool in the ``Tools`` menu
enumerates all the code warnings found on the current editor. Clicking on warnings
or pressing the ``Enter`` key in the list navigates to that warning in the editor,
highlighting it briefly with a callout, as configured from the ``Editor > Callouts``
preferences group.

**Removing False Positives**

The ``Code Warnings`` tool is also used to manage which code warnings will be reported. Since
dynamic Python code can be difficult to analyze, Wing may incorrectly mark some variables
or attributes as undefined, and may make mistakes in other code warnings. If external
checkers are used with their default configuration, they often also indicate many warnings
that are stylistic in nature and not real problems in the code.

Invalid or uninteresting code warnings can be removed by selecting them and clicking on
the red ``X`` that appears while moving the mouse cursor over items in the ``Code
Warnings`` tool, or by pressing the ``Delete`` key. Wing will remove the selected warnings
either in the current scope, current file, or globally, depending on the type of warning.
For example, undefined attributes on a module will be hidden globally while an undefined
local name will be hidden only in its scope.

For `external checkers <ref:warnings/external-checkers>`__, warnings removed in this way are
hidden globally by type. This can be used to ignore less useful warnings such as those
about indentation, PEP8 conformance, and other stylistic warnings that can make it
difficult to find real errors. Note, however, that Wing does this without altering the
external checker's regular configuration file. Editing the configuration for the external
checker directly, as documented by the external checker, is another way to ignore some of
its errors and warnings.

Warnings may also be removed by right-clicking on the ``Code Warnings`` tool. This allows
removing all warnings of a particular type, all warnings in a scope, or all warnings in a
file. The options for removal that are included in this menu depend on the type and
context of the warning.  For example, for undefined attributes Wing provides the
option to ignore all attributes on its parent type.

**Configuration Rules**

Each removal of a code warning adds a rule to the code warnings system configuration,
which is stored in the current project file and displayed under the ``Configuration`` tab
in the ``Code Warnings`` tool.

Rules are organized into those defined for the current file, and those defined for any
file. Configuration rules may be dragged between these two groups or deleted by clicking
on the red ``X`` that appears while moving the mouse cursor over the items, or by
selecting them and pressing the ``Delete`` key. 

Right-click on the configuration lists to edit, delete, or add new rules manually.

**Sharing Configurations**

The current code warnings configuration may be exported to the user settings area,
or to a selected file from the ``Options`` menu in the ``Code Warnings`` tool.  Projects
may then share the configuration through the ``Use Configuration From`` item in the
``Code Warnings`` tool's ``Options`` menu.

When the code warnings configuration is stored in user settings, it is written to a file
named ``code-warnings.conf`` in the `User Settings Directory
<ref:install/user-settings-dir>`__.

When the code warnings configuration is stored to another file, it may be checked into
revision control along with the ``.wpr`` file. The choice of which external configuration
file is used is stored in the ``.wpr`` file so all users of that project will use the same
code warnings configuration. Wing will be able to find the shared configuration as long as
the relative path between the project and the configuration file remains the same.

**Clearing the Configuration**

The code warnings configuration may be reset to blank with the ``Clear Configuration``
item in the ``Code Warnings`` tool's ``Options`` menu.
