PyCharm 3的PEP8代码风格警告提示信息

来源:互联网 发布:js里面遍历map 编辑:程序博客网 时间:2024/06/15 18:23

PyCharm好心的PEP8提示却有碍代码观感,怎样才能关闭我不需要的警告信息呢?


通过Google发现了如下信息:

In pycharm, click the settings icon, or go to the settings via the menu bar.
In the project settings section, click ‘inspections’
In the list that appears, click ‘python’.
Under python, scroll down and click PEP8.
Now, underneath the description, you’ll se an ‘ignore errors’ section. Click the + at the bottom.
Now, go here. This is a page of the pep8.py documentation, listing all possible errors and warnings.
Find an error you want to ignore, and copy the error code at the left.
Paste this error code into the field you just added in the settings window.
Add all the errors you want to ignore and click apply.

主要是在PyCharm项目设置中找到inspections选项,然后找到PEP 8 coding style violation,在右边的ignore errors,点击下面的加号,添加要忽略的警告信息编码,这个编码可以参考PEP8.py的官方网站,如下图所示我添加了E221、E401、E203这几个要忽略的信息。

只要取消掉PEP8风格警告和校验警告即可:


后来JetBrains的开发者Dmitry Jemerov与作者联系提供了一个更为简便的办法,那就是点击要忽略的错误所在,然后按Alt+Enter,在弹出下拉菜单选择ignore errors like this,就可以快速忽略了。


0 0
原创粉丝点击