您的位置:首页 > 编程语言

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

2015-11-16 11:07 786 查看
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
,就可以快速忽略了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: