本文介绍了在Eclipse中如何集成pep8.py?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一点背景:


  • 是Python代码风格指南。它包含所有python程序员应遵循的约定。

  • 是一个很棒的IDE。使用扩展程序,可用于开发Python

  • PEP 8 is the Style Guide for Python Code. It contains the conventions all python programmers should follow.
  • pep8.py is a (very useful) script that checks the code formating of a given python script, according to PEP 8.
  • Eclipse is a great IDE. With the Pydev extension, it that can be used to develop Python

我在脚本时手动运行pep8.py,但是我更喜欢使用Eclipse。
将pep8.py整合到Eclipse / Pydev中是非常有用的,因此可以在项目中的所有文件中自动运行,并指向包含警告的行。
也许有一个明显的方法来做,但我还没有找到。

I run pep8.py manually when I'm scripting, but with bigger projects I prefer to use Eclipse.It would be really useful to integrate pep8.py in Eclipse/Pydev, so it can be run automatically in all the files in the project, and point to the lines containing the warnings.Maybe there is an obvious way to do it, but I haven't found it yet.

问题是:如何整合pep8.py在Eclipse中?

推荐答案

截至PyDev 2.3.0, pep8 默认情况下集成到PyDev中,甚至可以使用默认版本发送。

As of PyDev 2.3.0, pep8 is integrated in PyDev by default, even shipping with a default version of it.

打开窗口>首选项

它必须在PyDev>编辑器>代码分析> pep8.py

It must be enabled in PyDev > Editor > Code Analysis > pep8.py

中启用错误/警告应显示为标记(与常规代码分析中的其他内容一样) )。

Errors/Warnings should be shown as markers (as other things in the regular code analysis).

如果文件未分析,请参阅。

In the event a file is not analyzed, see https://stackoverflow.com/a/31001619/832230.

这篇关于在Eclipse中如何集成pep8.py?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 08:41