Reference
Contents
Index
ExtendedLocalCoverage.default_html_functionExtendedLocalCoverage.default_lines_functionExtendedLocalCoverage.generate_html_reportExtendedLocalCoverage.generate_package_coverageExtendedLocalCoverage.highlight_with_showExtendedLocalCoverage.highlighted_linesExtendedLocalCoverage.plain_lines
ExtendedLocalCoverage.default_html_function — Method
default_html_function(lines_function)Extract the default function to be passed as html_function argument to generate_html_report.
It takes the lines_function as an argument and returns highlight_with_show if the lines_function is ExtendedLocalCoverage.highlighted_lines and simply return the String constructor otherwise.
ExtendedLocalCoverage.default_lines_function — Method
default_lines_function()Extract the default function to be passed as lines_function argument to generate_html_report.
If the JuliaSyntaxHighlighting package is loaded, this returns the ExtendedLocalCoverage.highlighted_lines function, otherwise it returns the ExtendedLocalCoverage.plain_lines function.
ExtendedLocalCoverage.generate_html_report — Method
generate_html_report(lcov_file, html_file; title = nothing, pkg_dir = nothing)Generate a static HTML report from a LCOV file using a native Julia solution.
The lcov_file and html_file arguments are the full paths to the LCOV file used as input and of the HTML file to be generated, respectively.
Keyword arguments
title = "Package Coverage Report"is the title used at the top of the HTML report.pkg_diris the directory of the package being covered. It is used to generate the source code links in the HTML report.lines_functionis a function that takes anIOstream representing the contents of a file and returns a vector ofAbstractStringobjects representing each line of the source file. When not provided, it defaults toExtendedLocalCoverage.default_lines_function.html_functionis a function that takes a single line of source code as anAbstractStringand returns an HTML-safe representation of that line, potentially with syntax highlighting. When not provided, it defaults toExtendedLocalCoverage.default_html_function.
ExtendedLocalCoverage.generate_package_coverage — Function
generate_package_coverage(pkg = nothing; kwargs...)Generate a summary of coverage results for package pkg.
If no pkg is supplied, the method operates in the currently active package. This acts similary to (and based on) the generate_coverage function from LocalCoverage.jl, but providing two main differences:
- It automatically extracts the list of files included by the package using
Revise.parse_pkg_files. - It allows to generate an HTML report (does so by default) using the
pycoberturaPython package which is installed by default via CondaPkg.- In contrast, the HTML report from
LocalCoverage.jlrelies on lcov being already available on your system and does not work on Windows machines.
- In contrast, the HTML report from
Keyword arguments (and their defaults)
use_existing_lcov = falseif true, the coverage is assumed to be already computed and available incoverage/lcov.infowithin the package directory. If false, the coverage is generated from scratch callingLocalCoverage.generate_coverage.run_test = truethis is forwarded toLocalCoverage.generate_coverageand determines whether tests are executed. Whenfalse, test execution step is skipped allowing an easier use in combination with other test packages.test_args = [""]this is forwarded toLocalCoverage.generate_coverageand is there passed on toPkg.test.exclude = []is used to specify string or regexes that are used to filter out some of the files in the list of package includes. The exclusion is done by removing from the list of files all files for whichoccursin(needle, filename)returnstrue, whereneedleis any element ofexclude.html_name = "index.html"is the name of the HTML file to be generated. If nothing is provided, no HTML report is generated. The report is always generated in thecoveragesubdirectory of the target package directory.cobertura_name = "cobertura-coverage.xml"is the name of the cobertura XML file to be generated. If nothing is provided both to this kwarg and tohtml_name, no cobertura XML file is generated. The file is always generated in thecoveragesubdirectory of the target package directory.print_to_stdout = truedetermines whether the coverage summary is printed to the standard output.extensions = truewhentrue, also tries to add to the coverage files in theextdirectory that match an extension name specified in theProject.tomlfile.lines_functionuse to customize how the HTML report is generated. Is directly forwarded togenerate_html_reportand can only be provided if thehtml_namekwarg is also provided.html_functionuse to customize how the HTML report is generated. Is directly forwarded togenerate_html_reportand can only be provided if thehtml_namekwarg is also provided.
Return values
The function returns a named tuple with the following fields:
covthe coverage summary as returned byLocalCoverage.generate_coverage.cobertura_filethe full path to the cobertura XML file, if any was generated.html_filethe full path to the HTML file, if any was generated.
ExtendedLocalCoverage.highlight_with_show — Function
highlight_with_show(line::Union{AnnotatedString, SubString{<:AnnotatedString}}) -> StringTake as input an annotated string containing synthax highlighting and generate an HTML representation of it using the show method with MIME"text/html"(), relying on StyledStrings.jl implementation to create HTML with synthax highlighting.
ExtendedLocalCoverage.highlighted_lines — Function
highlighted_lines(io::IO)Extract lines from the given IO stream and return them with syntax highlighting using JuliaSyntaxHighlighting.jl.
These lines usually processed with ExtendedLocalCoverage.highlight_with_show to get synthax highlighting of julia code in the static HTML report.
ExtendedLocalCoverage.plain_lines — Method
plain_lines(io::IO)Extract lines from the given IO stream and return them as plain text without any syntax highlighting.
This function simply does collect(eachline(io)) and is the default fallback used as lines_function when JuliaSyntaxHighlighting.jl is not loaded.