如何配置hound ci以支持Python 2.7

如何配置hound ci以支持Python 2.7,python,styles,Python,Styles,Hound ci使用flake8,flake8依赖于运行env的python,看起来Hound ci使用python3作为env,是否知道如何配置Hound ci以使用python2.7?目前无法配置HoundCI来检查在python2.x上编写的代码。Hound以适当的方式仅支持python3.x。 如果您试图检查代码,可能会收到python2的“错误”hound消息,如: print "hello" # should be flagged as a Syntax Error 或者在其他情况

Hound ci使用flake8,flake8依赖于运行env的python,看起来Hound ci使用python3作为env,是否知道如何配置Hound ci以使用python2.7?

目前无法配置HoundCI来检查在python2.x上编写的代码。Hound以适当的方式仅支持python3.x。 如果您试图检查代码,可能会收到python2的“错误”hound消息,如:

print "hello"
# should be flagged as a Syntax Error
或者在其他情况下,比如Python3中缺少的内置名称空间,您可以将其用于2.x版,比如

for _ in xrange(n)]
# should be flagged as undefined name 'xrange'
所以,在这种情况下,你可以攻击HundCI。要将Hound配置为忽略此错误,请将flake8的配置文件
.flake8.ini
放入项目根目录中:

[flake8]
ignore =
    # E999 SyntaxError
    E999,
    # undefined name
    F821

 # But in 'undefined name' case would be better to specify builtins
 builtins = 'xrange'
以下是一系列错误/违规行为

然后,告诉Hound使用指定忽略的linter配置。将flake8配置的路径添加到您的
.hound.yml

python:
  enabled: true
  config_file: .flake8.ini

Thx,这真的很有帮助