Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/check-patterns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check RPL Patterns

on:
push:
branches: [dev, pest]
paths:
- "docs/patterns-pest/**"
- "crates/rpl_patterns/src/patterns.rs"
- "tests/ui/**"
- "scripts/check_rpl_patterns.py"
- ".github/workflows/check-patterns.yml"
pull_request:
branches: [master, pest]
paths:
- "docs/patterns-pest/**"
- "crates/rpl_patterns/src/patterns.rs"
- "tests/ui/**"
- "scripts/check_rpl_patterns.py"
- ".github/workflows/check-patterns.yml"
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
check-patterns:
name: Pattern sync, coverage, and stderr hygiene
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Run pattern checks
run: python3 scripts/check_rpl_patterns.py
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ jobs:
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Cassandra C++ driver
# This is used by an important pattern written by @stuuupidcat,
# so we need to install the Cassandra C++ driver on Ubuntu 22.04.
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake git libssl-dev libuv1-dev zlib1g-dev libkrb5-dev
git clone --depth 1 --branch 2.17.1 https://github.com/apache/cassandra-cpp-driver.git /tmp/cassandra-cpp-driver
cd /tmp/cassandra-cpp-driver
cmake -S . -B build -DCASS_BUILD_SHARED=ON -DCASS_BUILD_EXAMPLES=OFF -DCASS_BUILD_TESTS=OFF
cmake --build build -j"$(nproc)"
sudo cmake --install build
sudo ldconfig
- name: Format check
run: cargo fmt --check
- name: Test rpl with embedded patterns
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ tokio = { version = "0.2.25", features = ["io-util"] }
tokio-util = { version = "0.2", features = ["codec"] }
bytes = "0.5.6"
log = "0.4"
# cassandra-cpp-sys = "1.1.1"
cassandra-cpp-sys = "1.1.1"
mach = { version = "0.2", default-features = false }
winapi = "0.3.0"
ctor = "0.10.0"
Expand Down Expand Up @@ -137,10 +137,12 @@ tokio.workspace = true
tokio-util.workspace = true
bytes.workspace = true
winapi.workspace = true
# cassandra-cpp-sys.workspace = true
ctor.workspace = true

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.mach]
[target.'cfg(any(target_os = "linux"))'.dev-dependencies.cassandra-cpp-sys]
workspace = true

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dev-dependencies.mach]
workspace = true

[features]
Expand Down
78 changes: 0 additions & 78 deletions crates/rpl_patterns/build.rs

This file was deleted.

11 changes: 6 additions & 5 deletions crates/rpl_patterns/src/patterns.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
//! This file is generated by build.rs
//! Built-in RPL patterns embedded from `docs/patterns-pest`.
//!
//! Maintain this list by hand when adding/removing `.rpl` files.
//! Order must match the filesystem: categories `clippy`, `codeql`, `cve`, `ub`
//! (in that order), and lexicographic file names within each category.
//! CI enforces this via `scripts/check_rpl_patterns.py`.

/// This macro will return a tuple of the path and the content of the file.
///
Expand All @@ -22,9 +27,6 @@ macro_rules! default_patterns {

pub fn patterns() -> Vec<(&'static str, &'static str)> {
default_patterns![
// When you add a pattern to the list below,
// ensure that its order matches the file system's order.
// (To ensure consistency of output information during testing)
// Clippy lints
"clippy/cast-slice-different-sizes.rpl",
"clippy/cast-slice-from-raw-parts.rpl",
Expand Down Expand Up @@ -62,7 +64,6 @@ pub fn patterns() -> Vec<(&'static str, &'static str)> {
"cve/CVE-2020-35873.rpl",
"cve/CVE-2020-35877.rpl",
"cve/CVE-2020-35881.rpl",
"cve/CVE-2020-35886.rpl",
"cve/CVE-2020-35887.rpl",
"cve/CVE-2020-35888.rpl",
"cve/CVE-2020-35892-3.rpl",
Expand Down
12 changes: 0 additions & 12 deletions docs/patterns-pest/cve/CVE-2020-35886.rpl

This file was deleted.

Loading
Loading