codeql/swift
Paolo Tranquilli 6426b8dc7e
Merge pull request #10891 from github/alexdenisov/xcode-autobuilder-tests
Swift: add Xcode autobuilder tests
2022-10-19 17:19:21 +02:00
..
codegen Merge pull request #10869 from github/redsun82/swift-no-base-suffix 2022-10-18 14:28:08 +02:00
extractor Swift: add `ImplicitConversionExpr` test 2022-10-17 12:57:44 +02:00
integration-tests Swift: fix integration tests 2022-08-30 11:46:27 +02:00
ql Merge pull request #10774 from atorralba/atorralba/swift/url-field-summaries 2022-10-18 15:32:23 +02:00
tools Swift: %/\t/\s/ 2022-10-18 10:17:02 +02:00
xcode-autobuilder Swift: make xcode-autobuilder tester work with several tests 2022-10-19 16:20:32 +02:00
.clang-format
.gitignore Swift: cmake generator for better IDE support 2022-10-13 15:25:24 +02:00
.pep8 Swift: implement python schema 2022-09-21 15:53:09 +02:00
BUILD.bazel Swift: simplify Bazel a bit 2022-10-18 10:04:50 +02:00
CMakeLists.txt Swift: add CMake target for xcode-autobuilder 2022-10-18 09:22:40 +02:00
README.md Merge pull request #10689 from d10c/swift/cleartext-storage-nsuserdefaults 2022-10-17 14:05:17 +01:00
codeql-extractor.yml
prefix.dbscheme Swift: implement python schema 2022-09-21 15:53:09 +02:00
rules.bzl Revert "Swift: print a helpful message on macOS ARM" 2022-09-14 10:34:46 +02:00
schema.py Swift: add `ImplicitConversionExpr` test 2022-10-17 12:57:44 +02:00

README.md

Swift on CodeQL

Warning

The Swift CodeQL package is an experimental and unsupported work in progress.

Building the Swift extractor

First ensure you have Bazel installed, for example with

brew install bazelisk

then from the ql directory run

bazel run //swift:create-extractor-pack    # --cpu=darwin_x86_64 # Uncomment on Arm-based Macs

which will install swift/extractor-pack.

Notice you can run bazel run :create-extractor-pack if you already are in the swift directory.

Using codeql ... --search-path=swift/extractor-pack will then pick up the Swift extractor. You can also use --search-path=., as the extractor pack is mentioned in the root codeql-workspace.yml. Alternatively, you can set up the search path in the per-user CodeQL configuration file.

Code generation

Run

bazel run //swift/codegen

to update generated files. This can be shortened to bazel run codegen if you are in the swift directory.

IDE setup

CLion and the native bazel plugin

You can use CLion with the official IntelliJ Bazel plugin, creating the project from scratch with default options. This is known to have issues on non-Linux platforms.

CMake project

The CMakeLists.txt file allows to load the Swift extractor as a CMake project, which allows integration into a wider variety of IDEs. Building with CMake also creates a compile_commands.json compilation database that can be picked up by even more IDEs. In particular, opening the swift directory in VSCode should work.