commit
71f3f1ef27
13
.style.yapf
13
.style.yapf
@ -1,4 +1,15 @@
|
||||
[style]
|
||||
based_on_style = google
|
||||
split_before_logical_operator = true
|
||||
spaces_before_comment=2, 4
|
||||
SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED = true
|
||||
SPLIT_ALL_COMMA_SEPARATED_VALUES = true
|
||||
SPLIT_BEFORE_BITWISE_OPERATOR = true
|
||||
SPLIT_BEFORE_CLOSING_BRACKET = true
|
||||
SPLIT_BEFORE_DICT_SET_GENERATOR = true
|
||||
SPLIT_BEFORE_DOT = true
|
||||
SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = true
|
||||
SPLIT_BEFORE_FIRST_ARGUMENT = true
|
||||
SPLIT_BEFORE_LOGICAL_OPERATOR = true
|
||||
SPLIT_BEFORE_NAMED_ASSIGNS = true
|
||||
SPLIT_COMPLEX_COMPREHENSION = true
|
||||
DEDENT_CLOSING_BRACKETS=true
|
||||
|
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@ -0,0 +1,12 @@
|
||||
language: python
|
||||
python:
|
||||
- "3.7-dev"
|
||||
install:
|
||||
- pip install -r requirements.txt
|
||||
- pip install -r travis/requirements.txt
|
||||
- pip install -r requirements-dev.txt
|
||||
# command to run tests
|
||||
script:
|
||||
- python travis/format_check.py
|
||||
- pylint --rcfile=.pylintrc vnpy
|
||||
- python tests/test_all.py
|
21
Readme.md
Normal file
21
Readme.md
Normal file
@ -0,0 +1,21 @@
|
||||
vnpy 2.0
|
||||
|
||||
## 贡献代码
|
||||
---
|
||||
|
||||
如果你遇到了任何BUG,欢迎[创建 Issue]。
|
||||
|
||||
我们热烈欢迎任何人为我们的项目贡献代码。无论是多么细小的改工,都可以[提交PR],我们会认真对待每一个PR。
|
||||
|
||||
在提交代码的时候,请遵守以下规则,以提高代码质量:
|
||||
|
||||
* 使用[yapf](目前必须使用github上的最新代码:```pip install https://github.com/google/yapf/archive/master.zip```)格式化你的代码。对你的每一个文件运行```yapf --style .style.yapf <file>```即可。
|
||||
* 使用[pylint]检查你的代码,确保没有error和warning。我们使用的pylint规则在项目根目录下。运行```pylint --rcfile=pylintrc vnpy```即可。
|
||||
|
||||
[yapf]:https://github.com/google/yapf
|
||||
[pylint]:https://github.com/PyCQA/pylint
|
||||
[提交PR]:https://help.github.com/articles/creating-a-pull-request/
|
||||
[创建 Issue]:http://pylint.pycqa.org/en/latest/tutorial.html
|
||||
|
||||
|
||||
|
2
requirements-dev.txt
Normal file
2
requirements-dev.txt
Normal file
@ -0,0 +1,2 @@
|
||||
pylint
|
||||
https://github.com/google/yapf/archive/master.zip
|
4
tests/test_all.py
Normal file
4
tests/test_all.py
Normal file
@ -0,0 +1,4 @@
|
||||
import unittest
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
27
travis/format_check.py
Normal file
27
travis/format_check.py
Normal file
@ -0,0 +1,27 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from yapf.yapflib.yapf_api import FormatFile
|
||||
|
||||
logger = logging.Logger(__file__)
|
||||
|
||||
if __name__ == '__main__':
|
||||
has_changed = False
|
||||
for root, dir, filenames in os.walk("vnpy"):
|
||||
for filename in filenames:
|
||||
basename, ext = os.path.splitext(filename)
|
||||
if ext == '.py':
|
||||
path = os.path.join(root, filename)
|
||||
reformatted_code, encoding, changed = FormatFile(filename=path,
|
||||
style_config='.style.yapf',
|
||||
print_diff=True,
|
||||
verify=False,
|
||||
in_place=False,
|
||||
logger=None
|
||||
)
|
||||
if changed:
|
||||
has_changed = True
|
||||
logger.warning("File {} not formatted!".format(path))
|
||||
else:
|
||||
logger.info("File {} is formatted!".format(path))
|
||||
exit(has_changed)
|
0
travis/requirements.txt
Normal file
0
travis/requirements.txt
Normal file
Loading…
Reference in New Issue
Block a user