如何自动修复 pylint 报告的 lint 问题? [英] How do I automatically fix lint issues reported by pylint?

查看:41
本文介绍了如何自动修复 pylint 报告的 lint 问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像我们有 "eslint --fix" 自动修复 Javascript 代码中的 lint 问题,我们是否也有用于 Python 代码的 pylint 的东西?

Just like we have "eslint --fix" to automatically fix lint problems in Javascript code, do we have something for pylint too for Python code?

推荐答案

pylint 报告的一些错误代码可以用下面的 lib 修复https://github.com/hhatto/autopep8

Few of the error codes reported by pylint can be fixed with below lib https://github.com/hhatto/autopep8

此外,如果您使用 pycharm 作为编辑器,它可以选择重新格式化代码,这将有助于解决 pylint 报告的大多数问题

additionally if you are using pycharm as editor it is having option to reformat-code which will help to solve most of the issues reported by pylint

这篇关于如何自动修复 pylint 报告的 lint 问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆