rust-keylime icon indicating copy to clipboard operation
rust-keylime copied to clipboard

[DONOTMERGEYET] Make compilation to fail on warnings

Open sarroutbi opened this issue 4 months ago • 2 comments

The new workflow runs on every push and pull request to the master branch and performs the following checks:

  • cargo build: Compiles the main application.
  • cargo test: Compiles the test suite.

Both steps are executed with the RUSTFLAGS="-D warnings" environment variable. This flag instructs the Rust compiler to treat all warnings as fatal errors, which will cause the build to fail if any warnings are present. This helps prevent latent bugs and ensures the code base remains clean.

These are some reasons to enforce a "No Warnings" Policy:

  1. Future-Proofing Code: A warning in the current version of a compiler might become a hard error in a future version. Code that compiles with warnings today may fail to compile tomorrow after a simple rustup update, causing unexpected build failures. Enforcing a "no warnings" policy ensures your code is robust against compiler updates.

  2. Preventing Latent Bugs: Many warnings are not just stylistic suggestions; they often point to subtle logical flaws, potential null pointer dereferences, race conditions, or undefined behavior. A classic example is an "unused variable" warning, which can indicate that a necessary calculation was performed but its result was never used.

  3. Improving Code Readability and Reducing Noise: When a build produces dozens of warnings, developers become desensitized to them. This "warning fatigue" can cause them to miss a new, critical warning that appears among the noise. A clean, warning-free build ensures that any new message from the compiler gets immediate attention.

  4. Maintaining a Culture of Quality: A strict "no warnings" policy sets a high standard for the team. It encourages developers to write clean, precise, and intentional code, fostering a culture where quality is not negotiable.

sarroutbi avatar Sep 03 '25 07:09 sarroutbi

This will be kept until compilation warnings are fixed in master branch. Once they are, new job should PASS and it should be merged to keep master branch clean

sarroutbi avatar Sep 03 '25 07:09 sarroutbi

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 57.43%. Comparing base (c3e25cb) to head (18e6de8).

Additional details and impacted files
Flag Coverage Δ
e2e-testsuite 57.43% <ø> (-0.03%) :arrow_down:
upstream-unit-tests 57.43% <ø> (-0.03%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more. see 3 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 03 '25 09:09 codecov[bot]