From 7f190fcdad6abe82df259fedbb2c602aff1bfec7 Mon Sep 17 00:00:00 2001 From: Juan Sebastian Valencia Londono <¨valencialondonojuansebastian@gmail.com¨> Date: Fri, 10 Jul 2026 16:31:51 -0500 Subject: [PATCH 1/5] feauture: add codeql worflow --- .github/workflows/codeql.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..67ebc2f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,39 @@ +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '0 0 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + security-events: write + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + # focus on Rust code only + language: [ 'rust'] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{ matrix.language }}" + From 73016f06bcfc5b6cc150da85c37732d78d09656f Mon Sep 17 00:00:00 2001 From: Juan Sebastian Valencia Londono <¨valencialondonojuansebastian@gmail.com¨> Date: Sat, 11 Jul 2026 13:21:39 -0500 Subject: [PATCH 2/5] chore: refactor debug_assert to debug_assert_eq --- crates/tinyxml2/src/entity.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/tinyxml2/src/entity.rs b/crates/tinyxml2/src/entity.rs index 3ab6309..e0aeb85 100644 --- a/crates/tinyxml2/src/entity.rs +++ b/crates/tinyxml2/src/entity.rs @@ -123,7 +123,7 @@ pub fn decode_numeric_only(input: &str) -> String { /// Attempts to decode a single numeric entity reference starting at the given byte slice. fn try_decode_numeric_entity(bytes: &[u8]) -> Option<(char, usize)> { - debug_assert!(bytes[0] == b'&'); + debug_assert_eq!(bytes[0], b'&'); // Find the semicolon let semi_pos = bytes.iter().position(|&b| b == b';')?; @@ -165,7 +165,7 @@ fn try_decode_numeric_entity(bytes: &[u8]) -> Option<(char, usize)> { /// Returns `Some((char, bytes_consumed))` if a valid entity was decoded, /// or `None` if the input does not start with a valid entity reference. fn try_decode_entity(bytes: &[u8]) -> Option<(char, usize)> { - debug_assert!(bytes[0] == b'&'); + debug_assert_eq!(bytes[0], b'&'); // Find the semicolon let semi_pos = bytes.iter().position(|&b| b == b';')?; From a064f3843b57aa7afe735f515ab6be70b602acce Mon Sep 17 00:00:00 2001 From: Juan Sebastian Valencia Londono <¨valencialondonojuansebastian@gmail.com¨> Date: Sat, 11 Jul 2026 19:43:43 -0500 Subject: [PATCH 3/5] chore: add persist-credentials false and undo changes on entity.rs --- .github/workflows/codeql.yml | 2 ++ crates/tinyxml2/src/entity.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 67ebc2f..a0be528 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -26,6 +26,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + persist-credentials: false - name: Initialize CodeQL uses: github/codeql-action/init@v4 diff --git a/crates/tinyxml2/src/entity.rs b/crates/tinyxml2/src/entity.rs index e0aeb85..3ab6309 100644 --- a/crates/tinyxml2/src/entity.rs +++ b/crates/tinyxml2/src/entity.rs @@ -123,7 +123,7 @@ pub fn decode_numeric_only(input: &str) -> String { /// Attempts to decode a single numeric entity reference starting at the given byte slice. fn try_decode_numeric_entity(bytes: &[u8]) -> Option<(char, usize)> { - debug_assert_eq!(bytes[0], b'&'); + debug_assert!(bytes[0] == b'&'); // Find the semicolon let semi_pos = bytes.iter().position(|&b| b == b';')?; @@ -165,7 +165,7 @@ fn try_decode_numeric_entity(bytes: &[u8]) -> Option<(char, usize)> { /// Returns `Some((char, bytes_consumed))` if a valid entity was decoded, /// or `None` if the input does not start with a valid entity reference. fn try_decode_entity(bytes: &[u8]) -> Option<(char, usize)> { - debug_assert_eq!(bytes[0], b'&'); + debug_assert!(bytes[0] == b'&'); // Find the semicolon let semi_pos = bytes.iter().position(|&b| b == b';')?; From 5e4aebda8b272d4fda9143eac757e741f81b969f Mon Sep 17 00:00:00 2001 From: Juan Sebastian Valencia Londono <¨valencialondonojuansebastian@gmail.com¨> Date: Sat, 11 Jul 2026 20:12:36 -0500 Subject: [PATCH 4/5] chore: refactor to lines blocks suggested by clippy --- crates/tinyxml2/src/entity.rs | 4 ++-- tests/compat/harness.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/tinyxml2/src/entity.rs b/crates/tinyxml2/src/entity.rs index 3ab6309..e0aeb85 100644 --- a/crates/tinyxml2/src/entity.rs +++ b/crates/tinyxml2/src/entity.rs @@ -123,7 +123,7 @@ pub fn decode_numeric_only(input: &str) -> String { /// Attempts to decode a single numeric entity reference starting at the given byte slice. fn try_decode_numeric_entity(bytes: &[u8]) -> Option<(char, usize)> { - debug_assert!(bytes[0] == b'&'); + debug_assert_eq!(bytes[0], b'&'); // Find the semicolon let semi_pos = bytes.iter().position(|&b| b == b';')?; @@ -165,7 +165,7 @@ fn try_decode_numeric_entity(bytes: &[u8]) -> Option<(char, usize)> { /// Returns `Some((char, bytes_consumed))` if a valid entity was decoded, /// or `None` if the input does not start with a valid entity reference. fn try_decode_entity(bytes: &[u8]) -> Option<(char, usize)> { - debug_assert!(bytes[0] == b'&'); + debug_assert_eq!(bytes[0], b'&'); // Find the semicolon let semi_pos = bytes.iter().position(|&b| b == b';')?; diff --git a/tests/compat/harness.rs b/tests/compat/harness.rs index ec26230..c2746ea 100644 --- a/tests/compat/harness.rs +++ b/tests/compat/harness.rs @@ -191,10 +191,10 @@ fn find_workspace_root() -> Option { if dir.join("tests").join("corpus").exists() { return Some(dir); } - if let Some(parent) = dir.parent() { + { + // lines suggested by clippy + let parent = dir.parent()?; dir = parent.to_path_buf(); - } else { - return None; } } } From 7ef2e6fa48fbd243095b4c7e028c22799230e626 Mon Sep 17 00:00:00 2001 From: Juan Sebastian Valencia Londono <¨valencialondonojuansebastian@gmail.com¨> Date: Sat, 11 Jul 2026 20:51:07 -0500 Subject: [PATCH 5/5] chore: delete unnecesary comment on harness.rs --- tests/compat/harness.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/compat/harness.rs b/tests/compat/harness.rs index c2746ea..beede67 100644 --- a/tests/compat/harness.rs +++ b/tests/compat/harness.rs @@ -192,7 +192,6 @@ fn find_workspace_root() -> Option { return Some(dir); } { - // lines suggested by clippy let parent = dir.parent()?; dir = parent.to_path_buf(); }