no-silent-exception
Ast Rule: try block
no-silent-exception
function visit(node, filename, code) {
const allClausesWithPass = node.exceptClauses.filter(e => e.getCodeBlock() && e.getCodeBlock() === "pass");
allClausesWithPass.forEach(c => {
const error = buildError(c.start.line, c.start.col, c.end.line, c.end.col, "silent exception", "WARNING", "BEST_PRACTICES");
addError(error);
});
}
pass-only-in-exception.py
Expected test result: has error
Make the exception silent and do not log anything, missing potential information.
do-not-ignore-exception.py
Expected test result: no error