no-isnull
Ast Rule: function call
no-isnull
function visit(node, filename, code) {
const usePandas = node.context.imports.filter(i => i.astType === "importstatement" && i.packages.filter(p => p.name && p.name.value && p.name.value === "pandas").length > 0).length > 0;
if (!usePandas) {
return;
}
if (node.functionName && node.functionName.value && node.functionName.value === "isnull") {
if (node.moduleOrObject) {
const error = buildError(node.functionName.start.line, node.functionName.start.col, node.functionName.end.line, node.functionName.end.col,
"do not use isnull", "INFO", "BEST_PRACTICE");
const edit = buildEditUpdate(node.functionName.start.line, node.functionName.start.col,
node.functionName.end.line, node.functionName.end.col,
"isna");
const fix = buildFix("use isna", [edit]);
addError(error.addFix(fix));
}
}
}
no-import.py
Expected test result: no error
isna.py
Expected test result: has error