pep8 - 整个项目的统计数据

pep8 - statistics for whole project

我正在做一个 Python 项目,我正在使用 PyPI pep8 检查器。

有没有一种简单的方法可以让我的项目获得 pep8 评级?喜欢一个百分比(例如,10 行与 pep8 不匹配,在 100 行中)或任何数字来评价它?

据我所知,pep8 / pycodestyle 不提供此类功能。

根据您使用的代码编辑器(在我的例子中是 PyCharm),查找 "run code inspection"。这将为您提供有关代码中违反 PEP8 的所有警告。

编辑: 你提到你正在使用 "PyPI pep8 checker." On their github page it states they use pycodestyle to check the code, the main page explains how to get the statistics you asked for, and there's a more complete error list here。但是,您最好还是使用 IDE...

您可能会使用 Pylint。它提供了评级和非常好的描述性报告。
此外,还有比 PEP8 更多的验证检查和选项。