Skylos detects copy-pasted code blocks across Python, TypeScript/JavaScript,
Java, Go, C#, Rust, PHP, Ruby, C/C++, Kotlin, Swift, Dart, Shell, and SQL using
token-stream rolling hashing (with optional Rust acceleration via skylos_fast)
and enforces overall and New Code duplication gates.
# Report multi-language duplication across a repository
skylos . --duplication
# Gate pull requests at <= 3% duplicated lines on new code
skylos . -a --diff origin/main --gate --max-new-duplication 3
# Enforce both overall and new-code duplication limits
skylos . -a --diff origin/main --gate \
--max-new-duplication 3 \
--max-duplication 5For a full Cloud upload, use --code-health-base "$BASE_SHA" --duplication.
The findings scan stays repository-wide and the duplication receipt records
the Git comparison commit.
[tool.skylos.duplication]
enabled = true
min_lines = 10
min_tokens = 50
min_new_lines = 20
# Excluded from duplication checks only; security and secret checks still run.
exclude = ["**/generated/**", "**/proto/**"]
include_tests = false
ignore_identifiers = false
ignore_literals = false
refactor_aware = true
[tool.skylos.gate]
max_new_duplication = 3.0
max_duplication = 5.0- Comments, docstrings, and import headers ignored: Standard
import/using/#include/useblocks and comments do not trigger false duplication alerts. - Same-language comparison: Files are matched only within their language
family (
.ts/.tsx/.js/.jsxmatch across JS/TS; Python matches Python, etc.). - Refactor-aware new-code gating. An exemption requires evidence that the
same duplicate relationship already existed on the comparison base. A move
that creates a new matching block counts toward the gate. Disable exemptions
with
--no-refactor-aware-duplicationorrefactor_aware = false. - Small-diff floor (
min_new_lines, default20): Tiny changes below the line floor report duplication without failing the new-code gate. - Scan scope. Duplication follows Git ignore rules, scan path filters, and
the additional
[tool.skylos.duplication]exclusions. Test paths are evaluated relative to the requested project or subproject. - Thresholds and incomplete scans. The gate compares exact line counts
before rounding for display. Unreadable in-scope source, a discovery error,
or a scan or matching limit makes the result incomplete and the gate exits
2. The Rust and Python matchers use the same limits and matching rules.
When you upload a scan with --duplication (and --code-health-base on full PR scans), Skylos sends a small summary without source code (counts, percentages, refactor exemptions, and up to 10 duplicated block ranges):
- Every plan sees the Code health panel on the scan page.
- Workspace plans can enforce
max_duplicationandmax_new_duplicationunder Policy, sync those limits to CI (skylos sync pull), list duplicated blocks in GitHub checks and PR comments, and approve logged Merge anyway overrides.