我不能从Python脚本运行PEP8检查。
我不想显式地运行pep8 8.exe,因为我想自动执行这个检查,并且pep8.exe可执行文件可以放在不同平台上的不同位置。
发布于 2015-03-20 17:28:48
Python涵盖了在PEP8 advanced usage脚本中使用pep8。
举个例子:
import unittest
import pep8
class TestCodeFormat(unittest.TestCase):
def test_pep8_conformance(self):
"""Test that we conform to PEP8."""
pep8style = pep8.StyleGuide(quiet=True)
result = pep8style.check_files(['file1.py', 'file2.py'])
self.assertEqual(result.total_errors, 0,
"Found code style errors (and warnings).")https://stackoverflow.com/questions/29163117
复制相似问题