Skip to content

Commit 06750dc

Browse files
Add PHP extractor and initial queries
1 parent 98dc439 commit 06750dc

Some content is hidden

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

57 files changed

+5502
-0
lines changed

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Python:
2626
- python/**/*
2727
- change-notes/**/*python*
2828

29+
PHP:
30+
- php/**/*
31+
- change-notes/**/*php*
32+
2933
Ruby:
3034
- ruby/**/*
3135
- change-notes/**/*ruby*

.github/workflows/php.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "PHP"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "php/**"
7+
- "misc/bazel/**"
8+
- "misc/codegen/**"
9+
- "shared/**"
10+
- "*.bazel*"
11+
- "MODULE.bazel"
12+
- .github/workflows/php.yml
13+
- .github/actions/**
14+
- codeql-workspace.yml
15+
- "!**/*.md"
16+
- "!**/*.qhelp"
17+
branches:
18+
- main
19+
- rc/*
20+
- codeql-cli-*
21+
22+
permissions:
23+
contents: read
24+
25+
env:
26+
CARGO_TERM_COLOR: always
27+
28+
defaults:
29+
run:
30+
shell: bash
31+
32+
jobs:
33+
extractor:
34+
runs-on: ubuntu-latest
35+
defaults:
36+
run:
37+
working-directory: php/extractor
38+
steps:
39+
- uses: actions/checkout@v5
40+
- name: Setup Rust toolchain
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
toolchain: "1.88"
44+
components: clippy,rustfmt
45+
- name: Format
46+
run: cargo fmt --check
47+
- name: Compilation
48+
run: cargo check
49+
- name: Clippy
50+
run: cargo clippy --no-deps -- -D warnings
51+
52+
qltest:
53+
if: github.repository_owner == 'github'
54+
runs-on: ubuntu-latest
55+
defaults:
56+
run:
57+
working-directory: php
58+
steps:
59+
- uses: actions/checkout@v5
60+
- name: Setup Rust toolchain
61+
uses: dtolnay/rust-toolchain@stable
62+
with:
63+
toolchain: "1.88"
64+
components: clippy,rustfmt
65+
- uses: ./.github/actions/fetch-codeql
66+
- name: Build extractor pack
67+
run: scripts/create-extractor-pack.sh
68+
- name: Cache compilation cache
69+
id: query-cache
70+
uses: ./.github/actions/cache-query-compilation
71+
with:
72+
key: php-qltest
73+
- name: Run QL tests
74+
run: |
75+
codeql test run --threads=0 --ram 50000 --search-path "${{ github.workspace }}" --check-databases --check-diff-informed --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
76+
env:
77+
GITHUB_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
# Avoid committing cached package components
3131
.codeql
3232

33+
# Local CodeQL CLI distributions (VS Code / local dev)
34+
.codeql-cli/
35+
3336
# Compiled class file
3437
*.class
3538

Cargo.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
resolver = "2"
55
members = [
66
"shared/tree-sitter-extractor",
7+
"php/extractor",
78
"ruby/extractor",
89
"rust/extractor",
910
"rust/extractor/macros",
1011
"rust/ast-generator",
1112
"rust/autobuild",
1213
]
14+

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ use_repo(
147147
"vendor_ts__tree-sitter-0.25.9",
148148
"vendor_ts__tree-sitter-embedded-template-0.25.0",
149149
"vendor_ts__tree-sitter-json-0.24.8",
150+
"vendor_ts__tree-sitter-php-0.23.11",
150151
"vendor_ts__tree-sitter-ql-0.23.1",
151152
"vendor_ts__tree-sitter-ruby-0.23.1",
152153
"vendor_ts__triomphe-0.1.14",

misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.tree-sitter-php-0.23.11.bazel

Lines changed: 165 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)