Skip to main content

Test Coverage

Skylos reads line-level coverage reports from your existing test runners and can fail the quality gate if overall or new-code coverage drops below your limit.

Supported report formats​

Skylos detects formats automatically and merges multiple reports in one scan:

FormatCommon tools
LCOV (.info)Vitest, Jest, Istanbul, c8, cargo-llvm-cov, grcov, Flutter/Dart, gcov
Cobertura XMLpytest-cov --cov-report=xml, Coverlet, SimpleCov, gocover-cobertura
JaCoCo XMLJava, Kotlin, Scala, Android (Gradle / Maven)
Go coverprofilego test -coverprofile=coverage.out ./...
OpenCover XMLC# / .NET (coverlet, OpenCover)

JaCoCo's standard DOCTYPE is handled offline; custom DTDs and external entities are rejected. Each report file is capped at 100 MB.

Quick start​

# Check new-code coverage on a pull request
skylos . -a --diff origin/main --gate \
--coverage-report coverage.xml \
--min-new-coverage 80

# Combine backend + frontend reports and check both overall and new-code coverage
skylos . -a --diff origin/main --gate \
--coverage-report backend/coverage.xml \
--coverage-report frontend/coverage/lcov.info \
--min-new-coverage 80 \
--min-coverage 70

For full Cloud scans that keep findings repository-wide while still measuring new-code coverage against a pull request base, pass --code-health-base:

skylos . -a --upload --code-health-base "$BASE_SHA" --coverage-report coverage.xml

Refactor-aware new-code checks​

Moving a file or extracting an existing function should not force you to write throwaway tests. By default (refactor_aware = true), Skylos exempts:

  • Renamed files whose lines did not change.
  • Moved functions or methods whose logic stayed identical.
  • Same-logic Python edits that only change docstrings or local variable names.
  • Verbatim moved blocks (one unique destination per deleted block).

New or changed lines are still counted normally, and both the evaluated and raw numbers are included in the JSON output. Pass --no-refactor-aware-coverage (or set refactor_aware = false) to count every changed line strictly.

Small-diff floor and exit codes​

  • Small-diff floor (min_new_lines, default 20): Tiny edits with fewer than 20 new executable lines report coverage without failing the new-code gate. Set min_new_lines = 0 to check every line.
  • Exit 1: Coverage fell below your threshold. Skylos prints the uncovered files and line numbers. Ratios are compared before rounding.
  • Exit 2: A required report is missing, unreadable, malformed, or lacks coverage data for changed source files.

Configuration​

Add settings to pyproject.toml (under [tool.skylos.*]) or skylos.toml:

[tool.skylos.test_coverage]
reports = ["coverage.xml", "frontend/coverage/lcov.info"]
# Skips coverage only; security and secret checks still run on these paths.
exclude = ["**/migrations/**", "**/generated/**"]
refactor_aware = true
min_new_lines = 20

[tool.skylos.gate]
min_new_coverage = 80.0
min_coverage = 70.0

In Skylos Cloud​

When you upload a scan with --coverage-report (and --code-health-base on PRs), Skylos sends only bounded counts, percentages, refactor-exemption counts, and up to 10 uncovered file line lists — never source code:

  • Every plan can view the Code health panel on the scan page.
  • Workspace plans can enforce min_coverage and min_new_coverage in Policy, sync limits to CI (skylos sync pull), show uncovered files and line ranges in GitHub checks and PR comments, and approve logged Merge anyway overrides.