简体   繁体   中英

How to config hound-ci to support python2.7

Hound ci使用flake8,而flake8取决于运行env的python,hound ci似乎使用python3作为env,是否知道如何配置hound ci以与python2.7一起使用?

There is no way to configure HoundCI to check code written on python 2.x at this moment. Hound support only python3.x in a proper way. If you trying to check the code you probably got "wrong" hound's messages for python2 like:

print "hello"
# should be flagged as a Syntax Error

or in other cases like a missed builtins namespace in Python 3 which you may use for version 2.x like

for _ in xrange(n)]
# should be flagged as undefined name 'xrange'

So, in this cases, you can hack HundCI. To configure Hound to ignore this errors put configuration file for flake8 .flake8.ini in your project root:

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

 # But in 'undefined name' case would be better to specify builtins
 builtins = 'xrange'

Here is a list of Errors / Violations

Then, tell Hound to use linter config with specified ignores. Add path to flake8 config to your .hound.yml :

python:
  enabled: true
  config_file: .flake8.ini

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM