flowbber.plugins.sources.cobertura

Cobertura

This source parses standard Cobertura XML files.

A Cobertura file describes the coverage of source code executed by tests. This files can be generated for several programming languages, including:

  • Python, by using pytest-cov or coverage.py.
  • Java, by using the original Cobertura tool.
  • C, by using GNU gcov to generate .gcno and .gcda coverage files, then processing the source tree with lcov to generate a coverage.info which is finally converted to Cobertura using lcov_cobertura.
  • Go, by using gocov to convert a -coverprofile file and then processing the resulting coverage.json with gocov-xml.

Data collected:

{
    "files": {
        "my_source_code.c": {
            "total_statements": 40,
            "total_misses": 20,
            "line_rate": 0.5
        },
        "another_source.c": {
            "total_statements": 40,
            "total_misses": 40,
            "line_rate": 0.0
        }
    },
    "total": {
        "total_statements": 80,
        "total_misses": 20,
        "line_rate": 0.75
    }
}

Dependencies:

pip3 install flowbber[cobertura]

Usage:

[[sources]]
type = "cobertura"
id = "..."

    [sources.config]
    xmlpath = "coverage.xml"
    include = ["*"]
    exclude = []
{
    "sources": [
        {
            "type": "cobertura",
            "id": "...",
            "config": {
                "xmlpath": "coverage.xml",
                "include": ["*"],
                "exclude": []
            }
        }
    ]
}

xmlpath

Path to the Cobertura coverage.xml file to be parsed.

  • Default: N/A

  • Optional: False

  • Schema:

    {
        'type': 'string',
        'empty': False,
    }
    
  • Secret: False

include

List of patterns of files to include.

Matching is performed using Python’s fnmatch.

  • Default: ['*']

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
        },
    }
    
  • Secret: False

exclude

List of patterns of files to exclude.

Matching is performed using Python’s fnmatch.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
        },
    }
    
  • Secret: False

Classes

class flowbber.plugins.sources.cobertura.CoberturaSource(index, type_, id_, optional=False, timeout=None, config=None)

Inheritance

Inheritance diagram of CoberturaSource