updated python configs
This commit is contained in:
81
.ruff.toml
81
.ruff.toml
@@ -1,7 +1,8 @@
|
||||
[tool.ruff.lint]
|
||||
# need to add to ~/appdata/Roaming/ruff/ruff.toml
|
||||
select = [
|
||||
# pycodestyle
|
||||
"E",
|
||||
"W",
|
||||
# Pyflakes
|
||||
"F",
|
||||
# pyupgrade
|
||||
@@ -12,3 +13,81 @@ select = [
|
||||
"SIM",
|
||||
# isort
|
||||
"I",
|
||||
# pep8-naming
|
||||
"N",
|
||||
# pycodestyle
|
||||
# "D",
|
||||
# "TD",
|
||||
]
|
||||
# Exclude a variety of commonly ignored directories.
|
||||
exclude = [
|
||||
".bzr",
|
||||
".direnv",
|
||||
".eggs",
|
||||
".git",
|
||||
".git-rewrite",
|
||||
".hg",
|
||||
".ipynb_checkpoints",
|
||||
".mypy_cache",
|
||||
".nox",
|
||||
".pants.d",
|
||||
".pyenv",
|
||||
".pytest_cache",
|
||||
".pytype",
|
||||
".ruff_cache",
|
||||
".svn",
|
||||
".tox",
|
||||
".venv",
|
||||
".vscode",
|
||||
"__pypackages__",
|
||||
"_build",
|
||||
"buck-out",
|
||||
"build",
|
||||
"dist",
|
||||
"node_modules",
|
||||
"site-packages",
|
||||
"venv",
|
||||
]
|
||||
|
||||
# Same as Black.
|
||||
line-length = 79
|
||||
indent-width = 4
|
||||
|
||||
# Assume Python 3.8
|
||||
|
||||
[lint]
|
||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||
# McCabe complexity (`C901`) by default.
|
||||
select = [
|
||||
# pycodestyle
|
||||
"E",
|
||||
"W",
|
||||
# Pyflakes
|
||||
"F",
|
||||
# pyupgrade
|
||||
"UP",
|
||||
# flake8-bugbear
|
||||
"B",
|
||||
# flake8-simplify
|
||||
"SIM",
|
||||
# isort
|
||||
"I",
|
||||
# pep8-naming
|
||||
"N",
|
||||
# pycodestyle
|
||||
# "D",
|
||||
# "TD",
|
||||
]
|
||||
ignore = [
|
||||
"N812"
|
||||
]
|
||||
|
||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||
fixable = ["ALL"]
|
||||
unfixable = []
|
||||
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
[format]
|
||||
quote-style = "single"
|
||||
|
||||
@@ -4,17 +4,17 @@ return {
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
python = { "ruff" },
|
||||
python = { "flake8" },
|
||||
}
|
||||
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
-- local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
-- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
-- group = lint_augroup,
|
||||
-- callback = function()
|
||||
-- lint.try_lint()
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
vim.keymap.set("n", "<leader>l", function()
|
||||
lint.try_lint()
|
||||
|
||||
@@ -8,6 +8,21 @@ return {
|
||||
opts = {
|
||||
inlay_hints = { enabled = false },
|
||||
servers = {
|
||||
ruff = {
|
||||
cmd_env = { RUFF_TRACE = "messages" },
|
||||
init_options = {
|
||||
settings = {
|
||||
logLevel = "error",
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
},
|
||||
},
|
||||
basedpyright = {
|
||||
cmd_env = { RUFF_TRACE = "messages" },
|
||||
init_options = {
|
||||
@@ -29,7 +44,7 @@ return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = function(_, opts)
|
||||
local servers = { "basedpyright", "ruff" }
|
||||
local servers = { "basedpyright" }
|
||||
for _, server in ipairs(servers) do
|
||||
opts.servers[server] = opts.servers[server] or {}
|
||||
opts.servers[server].enabled = server == "basedpyright"
|
||||
|
||||
Reference in New Issue
Block a user