The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::Cover::Report::Json_detailed - Generate a comprehensive JSON file articulating the full contents of a coverage run.

VERSION

version 0.001000

SYNOPSIS

This is an attempt at extracting the contents of a Devel::Coverage DB into a more useful format for the web.

  cover -report json_detailed

Emits:

  cover_db/cover_detailed.json

Which has at present the following data structure:

  {
    report_format => '0.1.0',
    branches      => {
      some_file => [@list_of_branch_reports],
      some_file => [@list_of_branch_reports],
    },
    runs       => [@list_of_run_reports],
    statements => {
      some_file => [@list_of_statement_reports],
      some_file => [@list_of_statement_reports],
    },
    subs => {
      some_file => [@list_of_sub_reports],
      some_file => [@list_of_sub_reports],
    },
    summary => {'???'},
  }

  Branch Report:
  {
    line           => 1,     # The Line Number
    code           => "",    # The code in question for the branch
    coverage_error => 1,     # Wether or not this is a coverage error
    uncoverable    => 1,     # If this is true, the following will be missing
    percentage     => " 50"  # The percent of covered branches
    true           => 5,       # The Number of covered branches
    false          => 5,       # The number of uncovered branches
  }

  Statement Report:
  {
    line           => 1,        # The Line Number
    code           => "",       # The code in question for the branch
    coverage_error => 1,        # Wether or not this is a coverage error
                                #---
                                # Any of the following may be eq "-" if they're not coverable.
    statement      => 5,        # Count of statement executions
    subroutine     => 5,        # Count of sub executions
    pod            => 1,        # Count of POD Coverage
    time           => 500,      # Time spent on statement
    branch         => " 50",    # Percent of covered branches
    condition      => " 50",    # Percent of covered conditions
  }

  Subroutine Report:
  {
    line        => 1,          # The Line Number
    name        => "BEGIN",    # The name of the subroutine
    uncoverable => 1,          # If this is true, the following will be missing.
    count       => 10,         # The number of sub executions
  }

  Run Report:
  {
    start        => UNIXTIME,          # When the given test run started
    finish       => UNIXTIME,          # when the given test run stopped
    os           => "linux",           # The operating system the run ran on
    perl_version => "5.12.3",          # The version of perl the run ran on
    run          => "path/foo.t",      # The invoked script
    time         => finish - start,    # Convenience time-elapsed
  }

Though its very experimental because I'm still working out how the (Undocumented) guts of Devel::Cover works.

Some of the fields feel wrongly named too but are kept because they're the same as Devel::Cover's internals and I can't think of something better in the interim.

But if I change anything significant, I'll also change the report_format string.

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.