Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use detekt to extract kotlin schema #549

Merged
merged 1 commit into from
Nov 3, 2023
Merged

Conversation

worstell
Copy link
Contributor

@worstell worstell commented Nov 3, 2023

fixes #530

}
calls.addAll(refs)

// Step into function calls inside this expression body to look for transitive calls.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @alecthomas extracting transitive calls

Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


private fun extractIngress(): MetadataIngress? {
return verb.annotationEntries.firstOrNull {
bindingContext.get(BindingContext.ANNOTATION, it)?.fqName?.asString() == Ingress::class.qualifiedName
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit unfortunate that we can't get a reference to the concrete annotation class like we can with KSP :(

Copy link
Contributor Author

@worstell worstell Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, there were some operations that were a lot more ergonomic with KSP :( one thing that's nice about detekt though it's it's a thin shim around kotlin PSI, which I found a lot more google-able than the KSP frameworks/schemas. so maybe easier to build on until KSP resources have improved a bit

also fwiw this is more verbose but should still be deterministic since we're comparing fully qualified class names

calls.addAll(refs)

// Step into function calls inside this expression body to look for transitive calls.
body.children.mapNotNull {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this recursive, or just top-level calls? If the latter, fine for now but maybe add a note to remind us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's recursive!

@worstell worstell force-pushed the worstell/20231023-detekt branch from af54e10 to 9ec86ef Compare November 3, 2023 23:32
@worstell worstell merged commit 714bbc9 into main Nov 3, 2023
8 checks passed
@worstell worstell deleted the worstell/20231023-detekt branch November 3, 2023 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use detekt to extract kotlin schema
2 participants