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

Adds Kotlin (beta) content #11384

Open
wants to merge 21 commits into
base: codeql-cli-2.11.4
Choose a base branch
from

Conversation

subatoi
Copy link
Contributor

@subatoi subatoi commented Nov 22, 2022

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

@yo-h yo-h requested a review from a team Nov 22, 2022
Copy link
Contributor

@intrigus-lgtm intrigus-lgtm left a comment

Not an official committer, so feel free to ignore my review.


.. pull-quote:: Enabling Kotlin support

To enable Kotlin support, you should enable `java` as a language.
Copy link
Contributor

@intrigus-lgtm intrigus-lgtm Nov 22, 2022

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.

Copy link
Contributor

@igfoo igfoo Nov 22, 2022

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).

Copy link
Contributor

@felicitymay felicitymay left a comment

@subatoi - thank you for pitching in and getting these changes sorted out so quickly 💖

Generally this looks good to me. I've added a few comments but nothing major.

One difference between RST and MD which trips us all up is the use of double backticks for monospaced font. A single backtick appears as italic text. I've fixed some of the backtick errors where I was commenting anyway, but it's worth checking for any that I missed.

docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/codeql-language-guides/codeql-for-java.rst Outdated Show resolved Hide resolved
docs/codeql/codeql-language-guides/codeql-for-java.rst Outdated Show resolved Hide resolved
subatoi and others added 11 commits Nov 23, 2022
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
@subatoi subatoi marked this pull request as ready for review Nov 23, 2022
@subatoi subatoi requested review from a team as code owners Nov 23, 2022
Copy link
Contributor

@felicitymay felicitymay left a comment

I spotted a few more issues with backticks, otherwise this looks fine from my point of view.

docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
docs/codeql/reusables/kotlin-java-differences.rst Outdated Show resolved Hide resolved
subatoi and others added 3 commits Nov 23, 2022
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>

In that specific case, you can use the predicate ``Expr.getUnderlyingExpr()``. This goes directly to the underlying ``VarAccess`` to produce a more similar behavior to that in Java.

Nullable elements (`?`) can also produce unexpected behavior. To avoid a `NullPointerException`, Kotlin may inline calls like `expr.toString()` to `String.valueOf(expr)` when `expr` is nullable. Make sure that you write CodeQL around the extracted code, which may not exactly match the code as written in the codebase.
Copy link
Contributor

@felicitymay felicitymay Nov 23, 2022

Choose a reason for hiding this comment

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

@subatoi - it looks as if you may have an extension that's removing the double backticks because they've vanished again from this paragraph: 357c823#diff-8e08ecaf9b0928a502efdea7c357815043c20b9d0e11aa9a303b7ed07ddf2267.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants