Repository navigation
Open
Description
dryer does not read Kotlin. .kt is not in discover.py, so a Kotlin project reports:
No source files to analyze.
The obvious fix, .kt in discover.py plus a _kotlin_nodes picker in extract.py, is not enough. With only that, every Kotlin function that has the same control flow scores 1.0, whatever it calls.
Measured
Two functions with the same shape that call different methods, scored with dryer's own normalize() and fingerprints() on tree-sitter's Kotlin grammar:
fun saveUser(repo: Repo, user: User): Boolean {
val ok = repo.validate(user)
if (ok) repo.insert(user)
return audit.record(user)
}
fun dropUser(repo: Repo, user: User): Boolean {
val ok = repo.authorize(user)
if (ok) repo.delete(user)
return mailer.notify(user)
}| Code | Score |
|---|---|
| Same two methods in Java | 0.37 |
| Kotlin, with the obvious fix | 1.00 |
Cause
astnorm.py keeps the call or method name and drops locals by node type, and Kotlin's tree uses different types:
- identifiers are
simple_identifier, notidentifier; repo.insert(user)iscall_expression->navigation_expression->navigation_suffix->simple_identifier, so the name sits one level deeper than in Java'smethod_invocationor TypeScript'smember_expression;- arguments are
call_suffix->value_arguments, notargument_list; real_literal,long_literal,hex_literal,bin_literalandunsigned_literalare not in_LITERALS;- Kotlin operators
?:,!!,..,..<,in,is,as,as?are not in_OPERATORS.
Adding the types to the sets is not enough: the call and member handling has to find the name inside navigation_suffix.
Proposed
discover.py:.kt.extract.py:_kotlin_nodes, the functions crapper scores: everyfunwith a body, not one nested in another function, a lambda, an anonymous object, or a local class.astnorm.py: the Kotlin types above, and member handling fornavigation_suffix.- Tests: renamed locals and literals in Kotlin score 1.0; the same skeleton with different callees scores about what Java does.
Metadata
Metadata
Assignees
Labels
No labels
Activity
elijulian commentedon Nov 9, 2026
this would be a huge help, i want to use this for my kotlin repos too