Skip to content

Commit 58b0eb1

Browse files
author
Alvaro Muñoz
committed
Initial commit
1 parent ebe7e7f commit 58b0eb1

File tree

11,125 files changed

+1170271
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

11,125 files changed

+1170271
-0
lines changed

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Note: This is meant for codeql_kernel developer use only
2+
.PHONY: data-files build install clean test
3+
4+
data-files: clean
5+
mkdir -p jupyter-data/share/jupyter/kernels/codeql
6+
cp codeql_kernel/kernel.json jupyter-data/share/jupyter/kernels/codeql
7+
cp codeql_kernel/images/* jupyter-data/share/jupyter/kernels/codeql/
8+
9+
install: data-files
10+
python build_treesitter.py
11+
pip install -e ".[test]"
12+
13+
clean:
14+
rm -rf jupyter-data
15+
rm -rf build
16+
rm -rf dist
17+
18+
19+
build: data-files
20+
pip install build twine
21+
python -m build .
22+
twine check --strict dist/*
23+
24+
test: clean
25+
pytest
26+
make clean

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# CodeQL kernel for Jupyter
2+
3+
## Local Installation
4+
5+
To install from a git checkout, run:
6+
7+
```bash
8+
$ pip install jupyter jupyterlab tree_sitter
9+
$ make install
10+
```
11+
12+
Verify installation:
13+
14+
Run `jupyter kernelspec list` and check that `codeql` is available as a Jupyter kernel:
15+
16+
```bash
17+
$ jupyter kernelspec list
18+
Available kernels:
19+
codeql /Users/pwntester/.pyenv/versions/3.8.13/share/jupyter/kernels/codeql
20+
python3 /Users/pwntester/.pyenv/versions/3.8.13/share/jupyter/kernels/python3
21+
```
22+
23+
# Highlight extension
24+
25+
Jupyter-lab extension to highlight CodeQL syntax
26+
27+
## Local Installation
28+
29+
```bash
30+
cd jupyterlab-codeql-highlight
31+
npm install
32+
jupyter labextension link .
33+
```
34+
35+
# Commands
36+
37+
- `%set_database <CodeQL DB directory>`: Sets the Database for analysis.
38+
39+
# Example
40+
41+
```bash
42+
cd example
43+
jupyter-lab test.ipynb
44+
```
45+
46+
Wait for each cell to run before running other cells.
47+
48+
# Disclaimer
49+
50+
This is an experimental project not maintained by the GitHub CodeQL teams.
51+
Any contributions are welcomed!

build_treesitter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from tree_sitter import Language
2+
3+
Language.build_library('codeql_kernel/tree-sitter-ql.so', ['vendor/tree-sitter-ql'])

codeql_kernel/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .kernel import CodeQLKernel
2+
from .codeql import CLIClient, QueryClient
3+
from ._version import __version__

codeql_kernel/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from ipykernel.kernelapp import IPKernelApp
2+
from . import CodeQLKernel
3+
4+
IPKernelApp.launch_instance(kernel_class=CodeQLKernel)
326 Bytes
Binary file not shown.
321 Bytes
Binary file not shown.
198 Bytes
Binary file not shown.
6.26 KB
Binary file not shown.
17.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)