0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00
denoland-deno/tools/format.py
Ryan Dahl f917c5e722 Clean up tools/
- Factor out tools/util.py
- Move js/*.py to tools.
- Rewrite tools/format.sh in python.
- Run lint first in travis.
2018-07-08 13:40:18 -04:00

25 lines
765 B
Python
Executable file

#!/usr/bin/env python
import os
from glob import glob
from util import run
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.chdir(root_path)
# TODO(ry) Install clang-format in third_party.
run(["clang-format", "-i", "-style", "Google"] + glob("src/*.cc") +
glob("src/*.h"))
for fn in ["BUILD.gn", ".gn"] + glob("build_extra/**/*.gn*"):
run(["gn", "format", fn])
# TODO(ry) Install yapf in third_party.
run(["yapf", "-i"] + glob("tools/*.py"))
# TODO(ry) Install prettier in third_party.
run([
"prettier", "--write", "js/deno.d.ts", "js/main.ts", "js/mock_runtime.js",
"tsconfig.json"
])
# Do not format these.
# js/msg_generated.ts
# js/flatbuffers.js
run(["rustfmt", "--write-mode", "overwrite"] + glob("src/*.rs"))