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
Adds Kotlin (beta) content #11384
base: codeql-cli-2.11.4
Are you sure you want to change the base?
Adds Kotlin (beta) content #11384
Conversation
| The CodeQL CLI includes autobuilders for C/C++, C#, Go, and Java code. CodeQL | ||
| .. include:: ../reusables/kotlin-beta-note.rst | ||
|
|
||
| The CodeQL CLI includes autobuilders for C/C++, C#, Go, Java and Kotlin code. CodeQL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need an example build command for Kotlin for this section?
| Writing CodeQL queries in Kotlin versus Java | ||
| -------------------------------------------- | ||
|
|
||
| When writing Kotlin-specific elements (such as a `WhenExpr`) you’ll need to use Kotlin-specific CodeQL classes, but writing queries for Kotlin and Java is largely the same. The two make use of the same libraries such as DataFlow, TaintTracking, or SSA, and the same classes such as `MethodAccess` or `Class`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make a final check: we shouldn't mention any specific libraries for Kotlin (here or anywhere else)? I'm inferring 'no' from this content and from https://github.com/github/docs-strategy/pull/1494/files#r1025069569
| @@ -5,6 +5,8 @@ Analyzing data flow in Java | |||
|
|
|||
| You can use CodeQL to track the flow of data through a Java program to its use. | |||
|
|
|||
| .. include:: ../reusables/kotlin-java-differences.rst | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .. include:: ../reusables/kotlin-java-differences.rst | |
| .. include:: ../reusables/kotlin-beta-note.rst | |
| .. include:: ../reusables/kotlin-java-differences.rst |
| @@ -7,6 +7,8 @@ CodeQL has a large selection of classes for representing the abstract syntax tre | |||
|
|
|||
| .. include:: ../reusables/abstract-syntax-tree.rst | |||
|
|
|||
| .. include:: ../reusables/kotlin-java-differences.rst | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .. include:: ../reusables/kotlin-java-differences.rst | |
| .. include:: ../reusables/kotlin-beta-note.rst | |
| .. include:: ../reusables/kotlin-java-differences.rst |
|
|
||
| .. pull-quote:: Enabling Kotlin support | ||
|
|
||
| To enable Kotlin support, you should enable `java` as a language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct?
If yes, it sounds a bit unintuitive that you have to enable java to enable Kotlin IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes: Due to how common it is for Kotlin code to call Java code and vice versa within a single project, we treat them as essentially 2 compilers for the same language. This also means that the CodeQL libraries and queries can be shared between the two which, as they are very similar underneath, saves a lot of duplication. This is similar to how javascript and typescript are treated by CodeQL as a single language, as well as the C family (standard C and C++ in their various versions, as well as Microsoft and GNU extensions to those languages).
Note that the content design plan noted possible additions to https://codeql.github.com/docs/codeql-cli/extractor-options/; I could not find a suitable place