Skip to content

Commit

Permalink
docs: cross-reference cmd to config, and add the missing lcov setting
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 18, 2022
1 parent a9d582a commit cde33ba
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
34 changes: 28 additions & 6 deletions doc/cmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ Coverage.py sets an environment variable, ``COVERAGE_RUN`` to indicate that
your code is running under coverage measurement. The value is not relevant,
and may change in the future.

These options can also be set in the :ref:`config_run` section of your
.coveragerc file.


.. _cmd_warnings:

Expand Down Expand Up @@ -465,6 +468,9 @@ code of 2, indicating that the total coverage was less than your target. This
can be used as part of a pass/fail condition, for example in a continuous
integration server. This option isn't available for **annotate**.

These options can also be set in your .coveragerc file. See
:ref:`Configuration: [report] <config_report>`.


.. _cmd_report:

Expand Down Expand Up @@ -577,14 +583,16 @@ decimal point in coverage percentages, defaulting to none.
The ``--sort`` option is the name of a column to sort the report by.

Other common reporting options are described above in :ref:`cmd_reporting`.
These options can also be set in your .coveragerc file. See
:ref:`Configuration: [report] <config_report>`.


.. _cmd_html:

HTML annotation: ``coverage html``
----------------------------------
HTML reporting: ``coverage html``
---------------------------------

Coverage.py can annotate your source code for which lines were executed
Coverage.py can annotate your source code to show which lines were executed
and which were not. The **html** command creates an HTML report similar to the
**report** summary, but as an HTML file. Each module name links to the source
file decorated to show the status of each line.
Expand Down Expand Up @@ -649,7 +657,7 @@ the command line.

If you prefer a different style for your HTML report, you can provide your
own CSS file to apply, by specifying a CSS file in the ``[html]`` section of
the configuration file. See :ref:`config_html` for details.
the configuration file. See :ref:`config_html_extra_css` for details.

The ``-d`` argument specifies an output directory, defaulting to "htmlcov"::

Expand All @@ -674,6 +682,9 @@ you choose which contexts to report on, and the ``--show-contexts`` option will
annotate lines with the contexts that ran them. See :ref:`context_reporting`
for details.

These options can also be set in your .coveragerc file. See
:ref:`Configuration: [html] <config_html>`.


.. _cmd_xml:

Expand Down Expand Up @@ -758,6 +769,8 @@ which may result in
<class filename="hello.py">
<class filename="baz/hello.py">
These options can also be set in your .coveragerc file. See
:ref:`Configuration: [xml] <config_xml>`.


.. _cmd_json:
Expand Down Expand Up @@ -807,6 +820,11 @@ The **json** command writes coverage data to a "coverage.json" file.
You can specify the name of the output file with the ``-o`` switch. The JSON
can be nicely formatted by specifying the ``--pretty-print`` switch.

Other common reporting options are described above in :ref:`cmd_reporting`.
These options can also be set in your .coveragerc file. See
:ref:`Configuration: [json] <config_json>`.


.. _cmd_lcov:

LCOV reporting: ``coverage lcov``
Expand Down Expand Up @@ -845,7 +863,10 @@ The **lcov** command writes coverage data to a "coverage.lcov" file.
tried. [env: COVERAGE_RCFILE]
.. [[[end]]] (checksum: 16acfbae8011d2e3b620695c5fe13746)
Other common reporting options are described above in :ref:`cmd_reporting`.
Common reporting options are described above in :ref:`cmd_reporting`.
Also see :ref:`Configuration: [lcov] <config_lcov>`.

.. versionadded:: 6.3


.. _cmd_annotate:
Expand Down Expand Up @@ -1002,7 +1023,8 @@ of operation to log:
.. _env.py: https://github.com/nedbat/coveragepy/blob/master/coverage/env.py

Debug options can also be set with the ``COVERAGE_DEBUG`` environment variable,
a comma-separated list of these options.
a comma-separated list of these options, or in the :ref:`config_run_debug`
section of the .coveragerc file.

The debug output goes to stderr, unless the ``COVERAGE_DEBUG_FILE`` environment
variable names a different file, which will be appended to.
Expand Down
31 changes: 23 additions & 8 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ control what happens if the variable isn't defined in the environment:
- Otherwise, missing environment variables will result in empty strings with no
error.

Many sections and values correspond roughly to commands and options in
Many sections and settings correspond roughly to commands and options in
the :ref:`command-line interface <cmd>`.

Here's a sample configuration file::
Expand Down Expand Up @@ -103,7 +103,7 @@ Here's a sample configuration file::
[run]
-----

These values are generally used when running product code, though some apply
These settings are generally used when running product code, though some apply
to more than one command.


Expand Down Expand Up @@ -338,7 +338,7 @@ See :ref:`cmd_combine` for more information.
[report]
--------

Values common to many kinds of reporting.
Settings common to many kinds of reporting.


.. _config_report_exclude_lines:
Expand Down Expand Up @@ -465,8 +465,8 @@ with ``-`` for descending sort (for example, "-cover").
[html]
------

Values particular to HTML reporting. The values in the ``[report]`` section
also apply to HTML output, where appropriate.
Settings particular to HTML reporting. The settings in the ``[report]``
section also apply to HTML output, where appropriate.


.. _config_html_directory:
Expand Down Expand Up @@ -534,7 +534,7 @@ Note this is text, not HTML.
[xml]
-----

Values particular to XML reporting. The values in the ``[report]`` section
Settings particular to XML reporting. The settings in the ``[report]`` section
also apply to XML output, where appropriate.


Expand All @@ -561,8 +561,8 @@ The default is that all directories are reported as packages.
[json]
------

Values particular to JSON reporting. The values in the ``[report]`` section
also apply to JSON output, where appropriate.
Settings particular to JSON reporting. The settings in the ``[report]``
section also apply to JSON output, where appropriate.

.. versionadded:: 5.0

Expand Down Expand Up @@ -591,3 +591,18 @@ formatted for human consumption (True) or for minimum file size (False).

(boolean, default false) Should the JSON report include an indication of which
contexts executed each line. See :ref:`dynamic_contexts` for details.


.. _config_lcov:

[lcov]
------

Settings particular to LCOV reporting (see :ref:`cmd_lcov`).

.. versionadded:: 6.3

[lcov] output
.............

(string, default "coverage.lcov") Where to write the LCOV file.

0 comments on commit cde33ba

Please sign in to comment.