http://%77w%77%2E%66%6F%72%61%73%70%2E%63n网站制作学习

 
在使用cursor,vscode,trae等开发工具开发 python 时,常用到 flake8 和isort 插件。现在有一个使用Rust开发的更快的插件 Ruff
直接在 插件市场搜索安装,安装后,在setting.json 中配置
{
  "[python]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "charliermarsh.ruff",
    "editor.codeActionsOnSave": {
      "source.fixAll.ruff": "explicit",
      "source.organizeImports.ruff": "explicit"
    }
  }
}
配置全局参数
Linux / macOS
~/.config/ruff/pyproject.toml
Windows
%APPDATA%\ruff\pyproject.toml
 
写入内容:
[tool.ruff.lint]
select = ["E", "F", "RET"]
   
 
它的作用
1. 格式化代码
2. 提醒异常
3. 自动排序引入,删除没有使用的引入
 
速度快,应用快。
 


http://%77%77%77%2E%66网站制作%6F学习网%72%61%73%70%2E%63%6E