boolean-positional-value-in-call (FBT003) (调用中的布尔位置值)
Derived from the flake8-boolean-trap linter. (源自 flake8-boolean-trap 代码检查器。)
作用
Checks for boolean positional arguments in function calls. (检查函数调用中的布尔位置参数。)
Some functions are whitelisted by default. To extend the list of allowed calls configure the lint.flake8-boolean-trap.extend-allowed-calls
option. (默认情况下,一些函数会被加入白名单。要扩展允许调用的列表,请配置 lint.flake8-boolean-trap.extend-allowed-calls
选项。)
为什么这不好?
Calling a function with boolean positional arguments is confusing as the meaning of the boolean value is not clear to the caller, and to future readers of the code. (使用布尔位置参数调用函数会令人困惑,因为布尔值的含义对于调用者和代码的未来读者来说并不清楚。)
示例
建议改为