151 Commits

Author SHA1 Message Date
Paolo Tranquilli
2533f18a6e Codegen: move ql.hideable to pragmas 2024-09-20 12:47:44 +02:00
Paolo Tranquilli
8d291ab938 Codegen: move qltest.test_with to parametrized pragmas 2024-09-20 12:47:44 +02:00
Paolo Tranquilli
3e2f886595 Codegen: allow inheritable pragmas 2024-09-20 12:47:43 +02:00
Paolo Tranquilli
db00cb6827 Codegen: move class synth decorators to pragmas 2024-09-20 11:09:22 +02:00
Paolo Tranquilli
9d6ee09f65 Codegen: move rust.doc_test_signature to parametrized pragmas 2024-09-20 11:09:21 +02:00
Paolo Tranquilli
70997e8189 Codegen: move default_doc_name to parametrized pragma 2024-09-20 11:09:21 +02:00
Paolo Tranquilli
9f1d50ebd1 Codegen: allow parametrized pragmas 2024-09-20 11:09:21 +02:00
Paolo Tranquilli
74c0fa7154 Codegen: allow annotations to add class decorations 2024-09-20 08:40:34 +02:00
Paolo Tranquilli
cc5882a3c3 Codegen: allow full annotation of classes 2024-09-20 06:55:17 +02:00
Paolo Tranquilli
97cca76970 Revert "Codegen: allow to include .py files in schema.py" 2024-09-19 16:58:20 +02:00
Paolo Tranquilli
6a540d833e Merge pull request #17523 from github/redsun82/rust-break-up-schema
Codegen/Rust: allow breaking up schema file
2024-09-19 16:57:58 +02:00
Paolo Tranquilli
a5e3fbf367 Codegen/Rust: allow breaking up schema file 2024-09-19 15:57:42 +02:00
Arthur Baars
f38f818578 Merge pull request #17516 from github/redsun82/codegen-annotate
Codegen: allow to attach docstrings after the definition
2024-09-19 15:35:16 +02:00
Paolo Tranquilli
c117a53fb0 Codegen: allow to attach docstrings after the definition 2024-09-19 12:43:34 +02:00
Paolo Tranquilli
ec9bb1da56 Codegen: allow to include .py files in schema.py 2024-09-19 12:18:52 +02:00
Tom Hvitved
5554c0f28f Rust: Use ```rust for code block examples
Also added some missing code block terminators.
2024-09-18 13:47:45 +02:00
Tom Hvitved
98b5ef5e01 Rust: Halt codegen on code block without ``` terminator 2024-09-18 13:47:44 +02:00
Tom Hvitved
1433363523 Codegen: Create internal folders 2024-09-17 20:06:35 +02:00
Paolo Tranquilli
0d8d9a3447 Merge branch 'main' into redsun82/rust-default-doc-signature 2024-09-17 08:29:01 +02:00
Paolo Tranquilli
1ce4707ff9 Merge branch 'main' into redsun82/rust-typed-labels 2024-09-16 16:44:55 +02:00
Tom Hvitved
964e97c842 Update misc/codegen/lib/ql.py
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2024-09-16 15:48:13 +02:00
Paolo Tranquilli
10e42237f3 Codegen: fix test 2024-09-16 14:46:42 +02:00
Tom Hvitved
8d68bdf4d6 Codegen: Fix return type of getResolveStep and resolve 2024-09-16 14:19:29 +02:00
Paolo Tranquilli
95b32fb541 Pre-commit: bump up autopep8 check version and fix formatting 2024-09-16 14:03:48 +02:00
Tom Hvitved
9c0cafeeb8 Codegen: Make public AST classes final 2024-09-16 13:39:53 +02:00
Paolo Tranquilli
73e9b46853 Rust/Codegen: make () -> () the default signature 2024-09-16 13:32:55 +02:00
Paolo Tranquilli
f1233b14e8 Rust: fix generated hierarchy 2024-09-16 10:06:01 +02:00
Paolo Tranquilli
8f93f5e34b Rust: move to Label<T> and mark unsafety of from_untyped 2024-09-13 17:17:19 +02:00
Paolo Tranquilli
faf1eeeb0d Rust: introduce typed labels 2024-09-13 13:57:14 +02:00
Paolo Tranquilli
beb27bf5e3 Rust: fix QL compilation and schema includes ordering 2024-09-12 15:05:30 +02:00
Paolo Tranquilli
573b8b9373 Merge branch 'rust-experiment' into redsun82/rust-ci 2024-09-09 12:32:02 +02:00
Paolo Tranquilli
56e127849f Rust/Codegen: fix generated list files 2024-09-09 12:31:09 +02:00
Paolo Tranquilli
10a23c0843 Merge branch 'rust-experiment' into redsun82/rust-doctest-gen 2024-09-09 12:20:55 +02:00
Paolo Tranquilli
ee2a8b09f6 Rust: fix formatting 2024-09-09 12:11:50 +02:00
Paolo Tranquilli
3cd8aaf4b0 Rust: simplify rust doc test annotation 2024-09-09 08:59:17 +02:00
Arthur Baars
c8f73587cc Rust: codegen: fix generated code 2024-09-07 10:32:59 +02:00
Paolo Tranquilli
928f3f11f1 Rust: remove <> from function wrapper 2024-09-06 14:34:12 +02:00
Paolo Tranquilli
8c5cc2efdc Rust: generate test code from schema docstrings
This generates test source files from code blocks in class docstrings.

By default the test code is generated as is, but it can optionally:
* be wrapped in a function providing an adequate context using
  `@rust.doc_test_function(name, *, lifetimes=(), return_type="()", **kwargs)`,
  with `kwargs` providing both generic and normal params depending on
  capitalization
* be skipped altogether using `@rust.skip_doc_test`

So for example an annotation like
```python
@rust.doc_test_function("foo",
                        lifetimes=("a",),
                        T="Eq",
                        x="&'a T",
                        y="&'a T",
                        return_type="&'a T")
```
will result in the following wrapper:
```rust
fn foo<'a, T: Eq>(x: &'a T, y: &'a T) -> &'a T {
    // example code here
}
```
2024-09-06 14:24:42 +02:00
Paolo Tranquilli
7e1290aa74 Rust: reuse shared rust trap library 2024-08-30 16:08:37 +02:00
Paolo Tranquilli
4f0fe1ce3a Rust: bazel packaging 2024-08-30 13:05:46 +02:00
Paolo Tranquilli
590a146b49 Rust: some basic extraction of function names (with locations!) 2024-08-29 17:58:50 +02:00
Paolo Tranquilli
f40901f391 Rust: archiving + skeleton def translator 2024-08-28 17:15:49 +02:00
Paolo Tranquilli
2606d3f6d1 Reapply "Bazel: add codeql specific packaging library"
This reverts commit 31d6b9be4d.
2024-05-29 15:46:29 +02:00
Paolo Tranquilli
31d6b9be4d Revert "Bazel: add codeql specific packaging library" 2024-05-29 15:27:10 +02:00
Paolo Tranquilli
6bbad22672 Codegen: make codegen work on windows 2024-05-27 16:05:38 +02:00
Paolo Tranquilli
9f5782b67b Bazel: introduce buildifier formatting
This introduces tooling and enforcement for formatting bazel files.

The tooling is provided as a bazel run target from
[keith/buildifier-prebuilt](https://github.com/keith/buildifier-prebuilt).

This is used in a [`pre-commit`](https://pre-commit.com/) hook for those
having that installed. In turn this is used in a CI check. Relying on a
`pre-commit` action gives us easy checking that buildifying did not
change anything in the files and printing the diff, without having to
hand-roll the check ourselves.

This enforcement will make usage of gazelle easier, as gazelle itself
might reformat files, even outside of `go`. Having them properly
formatted will allow gazelle to leave them unchanged, without needing
to configure awkward exclude directives.
2024-04-24 15:49:48 +02:00
Paolo Tranquilli
19bb8fe22d Bazel: use bzlmod 2024-02-12 10:55:40 +01:00
Paolo Tranquilli
0b57ecf0c7 Codegen: add internal QLdoc to property templates 2023-11-24 06:56:55 +01:00
Paolo Tranquilli
2d34fec0a2 Codegen: remove unneeded has_description property 2023-11-24 06:56:55 +01:00
Paolo Tranquilli
9264b2a6d6 Codegen: add internal to properties, rename ql_internal->internal 2023-11-24 06:56:55 +01:00