Skip to content

Refines code quality and addresses warnings#295

Merged
hellobertrand merged 6 commits into
mainfrom
fix/sonaurqube-findings-4
Jun 22, 2026
Merged

Refines code quality and addresses warnings#295
hellobertrand merged 6 commits into
mainfrom
fix/sonaurqube-findings-4

Conversation

@hellobertrand

Copy link
Copy Markdown
Owner

This pull request improves code quality and readability by addressing various static analysis findings and compiler warnings across the codebase.

Key changes include:

  • Silences unused function parameters using (void) casts in CLI and Python wrapper functions.
  • Eliminates redundant type casts (e.g., (size_t), (uint32_t), (int64_t)), simplifying expressions in compression, decompression, and dispatch logic.
  • Simplifies conditional logic and expression syntax, such as combining fseeko checks and cleaning up ternary operators.
  • Enforces const correctness for a stream pointer in the Huffman encoding module.
  • Updates the Node.js wrapper to adopt modern C++ practices, including std::array for fixed-size buffers and auto for type deduction.
  • Streamlines state handling in the zxc_pstream.c by removing a redundant CS_DRAIN_HEADER case.

Relates to SonarQube findings.

Casts unused function parameters to void to suppress compiler warnings, addressing static analysis findings. Also refactors a nested conditional for improved readability and reduced complexity.
Refactors conditional expressions for clarity and factors common terms. Consolidates duplicate `case` blocks in the state machine, reducing redundancy and improving maintainability. These changes address static analysis findings.
Replaces a C-style array with `std::array` for improved type safety and resource management. Also introduces `auto` for variable type deduction, aligning with modern C++ best practices and addressing static analysis findings.
Casts unused function parameters to void to suppress compiler warnings. Additionally, refactors conditional expressions for byte resizing into a more concise form. These changes address static analysis findings.
Removes unnecessary explicit type casts where the variable is already compatible, improving code clarity and addressing a static analysis finding.
Updates the type of 'stream_start' to reflect that the data it points to is not modified, addressing a static analysis finding.
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hellobertrand hellobertrand merged commit 57d90de into main Jun 22, 2026
83 of 84 checks passed
@hellobertrand hellobertrand deleted the fix/sonaurqube-findings-4 branch June 22, 2026 18:38
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

1 participant