summaryrefslogtreecommitdiff
path: root/tools/lint.py
blob: 1fa0d461d3042bcd31492d58bec9fa0e20985fbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# Does google-lint on c++ files and ts-lint on typescript files

import os
import subprocess

root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
third_party_path = os.path.join(root_path, "third_party")
cpplint = os.path.join(third_party_path, "cpplint", "cpplint.py")
tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
                      "tslint")


def run(args):
    print(" ".join(args))
    env = os.environ.copy()
    subprocess.check_call(args, env=env)


def main():
    os.chdir(root_path)
    run([
        "python", cpplint, "--filter=-build/include_subdir",
        "--repository=src", "--extensions=cc,h", "--recursive", "src/."
    ])
    run(["node", tslint, "-p", ".", "--exclude", "js/msg_generated.ts"])


if __name__ == "__main__":
    main()