Skip to content

Commit 11927a9

Browse files
authored
Merge pull request #53 from github/user-facing
Add some user-facing AST classes
2 parents f9c7ae7 + baf29ae commit 11927a9

Some content is hidden

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

45 files changed

+2637
-2036
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
- uses: actions/upload-artifact@v2
4747
if: ${{ matrix.os == 'ubuntu-latest' }}
4848
with:
49-
name: ruby_ast.qll
50-
path: ql/src/codeql_ruby/ast.qll
49+
name: Generated.qll
50+
path: ql/src/codeql_ruby/Generated.qll
5151
- uses: actions/upload-artifact@v2
5252
with:
5353
name: extractor-${{ matrix.os }}

Cargo.lock

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ cargo build --release
1212

1313
## Generating the database schema and QL library
1414

15-
The generated `ql/src/ruby.dbscheme` and `ql/src/codeql_ruby/ast.qll` files are included in the repository, but they can be re-generated as follows:
15+
The generated `ql/src/ruby.dbscheme` and `ql/src/codeql_ruby/Generated.qll` files are included in the repository, but they can be re-generated as follows:
1616

1717
```bash
1818
# Run the generator
1919
cargo run --release -p ruby-generator
2020
# Then auto-format the QL library
21-
codeql query format -i ql/src/codeql_ruby/ast.qll
21+
codeql query format -i ql/src/codeql_ruby/Generated.qll
2222
```
2323

2424
## Building a CodeQL database for a Ruby program

create-extractor-pack.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cargo build --release
22

33
cargo run --release -p ruby-generator
4-
codeql query format -i ql\src\codeql_ruby\ast.qll
4+
codeql query format -i ql\src\codeql_ruby\Generated.qll
55

66
rm -Recurse -Force extractor-pack
77
mkdir extractor-pack | Out-Null

create-extractor-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fi
1313
cargo build --release
1414

1515
cargo run --release -p ruby-generator
16-
codeql query format -i ql/src/codeql_ruby/ast.qll
16+
codeql query format -i ql/src/codeql_ruby/Generated.qll
1717

1818
rm -rf extractor-pack
1919
mkdir -p extractor-pack

extractor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
flate2 = "1.0"
1111
node-types = { path = "../node-types" }
1212
tree-sitter = "0.17"
13-
tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "93632008c63e0577413bbedf120fb92a96397785" }
13+
tree-sitter-ruby = { git = "https://github.com/nickrolfe/tree-sitter-ruby.git", branch = "refinements" }
1414
clap = "2.33"
1515
tracing = "0.1"
1616
tracing-subscriber = { version = "0.2", features = ["env-filter"] }

generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ edition = "2018"
1010
node-types = { path = "../node-types" }
1111
tracing = "0.1"
1212
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
13-
tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "93632008c63e0577413bbedf120fb92a96397785" }
13+
tree-sitter-ruby = { git = "https://github.com/nickrolfe/tree-sitter-ruby.git", branch = "refinements" }

generator/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ fn main() {
574574
name: "Ruby".to_owned(),
575575
node_types: tree_sitter_ruby::NODE_TYPES,
576576
dbscheme_path: PathBuf::from("ql/src/ruby.dbscheme"),
577-
ql_library_path: PathBuf::from("ql/src/codeql_ruby/ast.qll"),
577+
ql_library_path: PathBuf::from("ql/src/codeql_ruby/Generated.qll"),
578578
};
579579
match node_types::read_node_types_str(&ruby.node_types) {
580580
Err(e) => {

generator/src/ql.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,12 @@ pub fn write<'a>(
214214
" * Automatically generated from the tree-sitter grammar; do not edit\n"
215215
)?;
216216
write!(file, " */\n\n")?;
217+
write!(file, "module Generated {{\n")?;
217218

218219
for element in elements {
219220
write!(file, "{}\n\n", &element)?;
220221
}
221222

223+
write!(file, "}}")?;
222224
Ok(())
223225
}

ql/consistency-queries/VariablesConsistency.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import codeql_ruby.Variables
1+
import codeql_ruby.ast.Variable
22

33
query predicate ambiguousVariable(VariableAccess access, Variable variable) {
44
access.getVariable() = variable and

0 commit comments

Comments
 (0)