I later found out that flake8, which is on by default, has a mccabe complexity warning, also on by default. I used this code in my lspconfig.lua file:
local flake_ignores = {"E203", -- whitespace before :
"W503", -- line break before binary operator
"E501", -- line too long
"C901"} -- mccabe complexity
local settings = {
pylsp = {
plugins = {
mccabe = { enabled = false },
flake8 = {
enabled = true,
ignore = table.concat(flake_ignores, ",")
}
}
},
}