Skip to content

add CodeQL, Trivy and Clippy checks - #48

Merged
szymon-zadworny merged 2 commits into
oneapi-src:mainfrom
bratpiorka:rrudnick_sdl
Sep 17, 2026
Merged

szymon-zadworny merged 2 commits into
oneapi-src:mainfrom
bratpiorka:rrudnick_sdl

Conversation

@bratpiorka

Copy link
Copy Markdown
Contributor

add CodeQL, Trivy and Clippy checks

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Trivy failures do not gate deployment, and CodeQL does not analyze Rust.

Pull request overview

Adds CodeQL, Trivy, and Clippy checks to the CI workflow.

Changes:

  • Runs Clippy with warnings denied.
  • Adds C++ CodeQL analysis.
  • Adds Trivy filesystem security scanning.
File summaries
File Summary
.github/workflows/basic.yml Integrates the new checks; Trivy does not gate documentation deployment, and CodeQL omits Rust analysis.
Review details

Suppressed comments (2)

.github/workflows/basic.yml:136

  • A failed Trivy scan does not currently block documentation deployment: deploy-documentation still depends only on build-and-test, so a finding causes this job to fail while the main-branch deployment can proceed. Add trivy to the deployment dependencies (or otherwise gate the deployment) so the new exit-code: 1 check protects the published artifact.
    if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.deploy_documentation == 'true')

.github/workflows/basic.yml:64

  • languages: cpp leaves the Rust workspace completely outside this CodeQL check, even though the repository is primarily Rust and the pinned CodeQL action supports Rust analysis. As a result, vulnerabilities in the public Rust API and bindings are not reported; include rust as an analyzed language (or add a separate Rust matrix job).
        languages: cpp
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bratpiorka
bratpiorka force-pushed the rrudnick_sdl branch 5 times, most recently from 4101444 to 497dfd3 Compare September 14, 2026 12:50

@szymon-zadworny szymon-zadworny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any issues with additional safety comments, although it was previously decided that we won't document -sys crates.

However, one comment change is dangerous and should be reverted or updated.

Comment thread sycl/sycl-rs-sys/src/event-sys.rs Outdated
Comment on lines +57 to +59
/// # Safety
///
/// `ptr` must come from `Arc::into_raw` and represent a strong reference owned by this callback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wording removes the information that the reference count needs to be incremented by the caller. This makes the whole comment pointless.

Comment thread sycl/sycl-rs/examples/kernel_launch.rs Outdated
NdRange::new([1024], [16]),
&kernel,
(f16::from_f32(3.14), &mut device_array),
(f16::from_f32(std::f32::consts::PI), &mut device_array),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread sycl/sycl-rs/src/queue.rs Outdated
Comment on lines +31 to +36
impl Default for Queue {
fn default() -> Self {
Self::new()
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We deemed this to be dangerous w.r.t. performance since it hides the device the Queue is being assigned to.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will remove this

Comment on lines +27 to +32
impl Default for SharedWaker {
fn default() -> Self {
Self::new()
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code will never be used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a fix for warning

warning: you should consider adding a `Default` implementation for `SharedWaker`
  --> sycl/sycl-rs-sys/src/types-sys.rs:19:5
   |
19 | /     pub fn new() -> Self {
20 | |         Self {
21 | |             waker: AtomicWaker::new(),
22 | |             done: AtomicBool::new(false),
23 | |         }
24 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#new_without_default
   = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
   |
18 + impl Default for SharedWaker {
19 +     fn default() -> Self {
20 +         Self::new()
21 +     }
22 + }
   |

// SPDX-License-Identifier: MIT OR Apache-2.0
//

#[allow(clippy::missing_safety_doc)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this issue the reason behind that attribute? If yes - it should be documented with a comment.


use crate::types::SharedWaker;

#[allow(clippy::missing_safety_doc)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this issue the reason behind that attribute? If yes - it should be documented with a comment.

@bratpiorka bratpiorka Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this a fix for

warning: unsafe function's docs are missing a `# Safety` section
  --> sycl/sycl-rs-sys/src/event-sys.rs:13:1
   |
13 | #[cxx::bridge(namespace = "sycl_shims::event")]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#missing_safety_doc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These warnings are incorrectly emitted due to the linked issue. This allow attribute is a workaround.

@szymon-zadworny
szymon-zadworny self-requested a review September 14, 2026 13:16
Comment thread sycl/sycl-rs-sys/build.rs
];

cxx_build::bridges(&rust_sources)
cxx_build::bridges(rust_sources)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes:

warning: the borrowed expression implements the required traits 
warning: the borrowed expression implements the required traits

Comment thread sycl/sycl-rs/src/event.rs

// Set the callback on first Future poll (Futures can't be active until polled)
if *this.set_callback == false {
if !*this.set_callback {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes:

warning: equality checks against false can be replaced by a negation
  --> sycl/sycl-rs/src/event.rs:63:12
   |
63 |         if *this.set_callback == false {
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!*this.set_callback`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#bool_comparison
   = note: `#[warn(clippy::bool_comparison)]` on by default

Comment thread sycl/sycl-rs/src/queue.rs
/// Submits a barrier to the queue.
pub fn barrier(&mut self) -> Result<Event> {
self.barrier_with_deps(&[]).map(Into::into)
self.barrier_with_deps(&[])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes:


warning: useless conversion to the same type: `event::Event`
   --> sycl/sycl-rs/src/queue.rs:131:36
    |
131 |           self.barrier_with_deps(&[]).map(Into::into)
    |  ____________________________________-^^^^^^^^^^^^^^^
132 | |     }
    | |____- help: consider removing
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

pub(crate) unsafe fn new(allocator: A, len: usize) -> Self {
let layout = Layout::array::<T>(len).unwrap();
let ptr = match allocator.allocate(layout.clone()) {
let ptr = match allocator.allocate(layout) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes:


warning: using `clone` on type `Layout` which implements the `Copy` trait
  --> sycl/sycl-rs/src/usmbox.rs:54:44
   |
54 |         let ptr = match allocator.allocate(layout.clone()) {
   |                                            ^^^^^^^^^^^^^^ help: try removing the `clone` call: `layout`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#clone_on_copy
   = note: `#[warn(clippy::clone_on_copy)]` on by default

warning: `sycl-rs` (lib test) generated 18 warnings (13 duplicates) (run `cargo clippy --fix --lib -p sycl-rs --tests` to apply 1 suggestion)
warning: `sycl-rs` (lib) generated 18 warnings (5 duplicates) (run `cargo clippy --fix --lib -p sycl-rs` to apply 2 suggestions)

Comment thread sycl/sycl-rs-sys/build.rs
];

cxx_build::bridges(&rust_sources)
cxx_build::bridges(rust_sources)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes:

warning: the borrowed expression implements the required traits 

@bratpiorka
bratpiorka force-pushed the rrudnick_sdl branch 4 times, most recently from e77035a to 07802e0 Compare September 16, 2026 12:49
Comment thread sycl/sycl-rs/examples/kernel_launch.rs Outdated
NdRange::new([1024], [16]),
&kernel,
(f16::from_f32(3.14), &mut device_array),
(std::f16::consts::PI, &mut device_array),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project uses half::f16 because std::f16 hasn't been stabilized yet - it's only available on nightly toolchains.

Removing the std:: prefix will fix this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@bratpiorka
bratpiorka force-pushed the rrudnick_sdl branch 2 times, most recently from 213215c to c8c2203 Compare September 16, 2026 18:49
@bratpiorka
bratpiorka requested review from szymon-zadworny and a lite review from Copilot September 16, 2026 19:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Only minor documentation nits were identified; no blocking issues remain.

Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread sycl/sycl-rs-sys/src/event-sys.rs Outdated
Comment thread sycl/sycl-rs-sys/src/types-sys.rs Outdated
Comment thread sycl/sycl-rs/src/queue.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed changes have no unresolved approval-blocking issues.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@szymon-zadworny szymon-zadworny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@szymon-zadworny
szymon-zadworny merged commit 6b0a436 into oneapi-src:main Sep 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants