Production code should be free from debugging artifacts that reduce readability and maintainability. Remove all debugging print statements, commented-out code blocks, and other temporary debugging elements before merging code.
Production code should be free from debugging artifacts that reduce readability and maintainability. Remove all debugging print statements, commented-out code blocks, and other temporary debugging elements before merging code.
Specifically:
Remove all debugging print statements: Debug prints should only appear in development branches or be wrapped in appropriate debug-only conditions.
// BAD: Unconditional debug printing
sd_printf("Before op execution \n", 0);
// GOOD: Conditional printing only when needed
if (LOG_LEVEL >= DEBUG) {
sd_printf("Before op execution \n", 0);
}
Delete commented-out code: Commented-out code creates confusion about which implementation is correct and clutters the codebase.
// BAD: Leaving commented-out code without explanation
//REQUIRE_TRUE(expectedUpdShape == updShape, 0, "SCATTER_ADD OP: wrong shape of updates array...");
// GOOD: Either remove it entirely or provide a clear justification comment
// REQUIRE statement intentionally disabled during beta testing until shape validation is fixed in issue #1234
//REQUIRE_TRUE(expectedUpdShape == updShape, 0, "SCATTER_ADD OP: wrong shape of updates array...");
Clean up unused variables and redundant operations: Remove variables that are declared but never used.
If debugging functionality needs to be preserved for future troubleshooting, consider implementing proper logging with configurable levels rather than leaving print statements scattered throughout the code.
Enter the URL of a public GitHub repository