Skip to content

Chore: Deadcode and require/assert Bug #425

@NhoxxKienn

Description

@NhoxxKienn

Context

Many test cases currently use assert.NoError(t, err) without checking the returned bool. This can lead to false positives, where the test continues after an unexpected error, potentially masking failures.

According to the testify docs, require.NoError should be used when the test cannot continue meaningfully after an error.

Also the current codebase contains many legacy deadcode that should be investigated and cleaned up if not needed.

Suggested fix

  • Audit the codebase for uses of assert.NoError(t, err) that are not conditionally checked. Replace them with require.NoError(t, err) where the error should cause the test to fail immediately.
  • Audit the codebase for deadcode and remove them.

Scope

  • Leave existing usage as-is in current PRs to avoid scope creep.
  • Address this issue in a dedicated follow-up PR.
  • Publish a follow-up release (temp. name v0.14.1)

Example

Example of incorrect pattern:

assert.NoError(t, err) // not checked, test continues on unexpected error

Correct pattern:

require.NoError(t, err) // fails immediately if err != nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorNo logic but only implementation changes.testing-onlyOnly relevant for testing.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions