travis_ci
This commit is contained in:
8
.travis.yml
Normal file
8
.travis.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
language: python
|
||||||
|
|
||||||
|
python:
|
||||||
|
-3.6
|
||||||
|
install:
|
||||||
|
pip install requirements.txt
|
||||||
|
script:
|
||||||
|
python3 scripts/pretty.py
|
||||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
yapf==0.20.0
|
||||||
@ -2,15 +2,15 @@ from yapf.yapflib.yapf_api import FormatCode
|
|||||||
import re
|
import re
|
||||||
import pprint
|
import pprint
|
||||||
import os
|
import os
|
||||||
files = os.listdir('../snippets')
|
files = os.listdir('snippets')
|
||||||
codeRe = "```\s*python([\s\S]*?)```"
|
codeRe = "```\s*python([\s\S]*?)```"
|
||||||
for file in files:
|
for file in files:
|
||||||
someFile = open("../snippets/" + file)
|
someFile = open("snippets/" + file)
|
||||||
fileData = someFile.read()
|
fileData = someFile.read()
|
||||||
someFile.close()
|
someFile.close()
|
||||||
originalCode = re.search(codeRe,fileData).group(0)
|
originalCode = re.search(codeRe,fileData).group(0)
|
||||||
formatedCode = FormatCode(re.split(codeRe,fileData)[1])
|
formatedCode = FormatCode(re.split(codeRe,fileData)[1])
|
||||||
fileToSave = fileData.replace(originalCode,('```python \n'+formatedCode[0]+'\n```\n'))
|
fileToSave = fileData.replace(originalCode,('```python \n'+formatedCode[0]+'\n```'))
|
||||||
someFile = open("../snippets/"+file,'w')
|
someFile = open("snippets/"+file,'w')
|
||||||
someFile.write(fileToSave)
|
someFile.write(fileToSave)
|
||||||
someFile.close()
|
someFile.close()
|
||||||
Reference in New Issue
Block a user