Example #1
0
def clang_format():
    print "clang-format"
    exe = get_buildtools_tool_path("clang-format")
    source_files = git_ls_files(root_path, ["*.cc", "*.h"])
    run([exe, "-i", "-style", "Google", "--"] + source_files,
        env=google_env(),
        quiet=True)
Example #2
0
def yapf():
    print "yapf"
    script = os.path.join(third_party_path, "python_packages", "bin", "yapf")
    source_files = git_ls_files(root_path, ["*.py"])
    run([sys.executable, script, "-i", "--"] + source_files,
        env=python_env(),
        shell=False,
        quiet=True)
Example #3
0
def prettier():
    print "prettier"
    script = os.path.join(third_party_path, "node_modules", "prettier",
                          "bin-prettier.js")
    source_files = git_ls_files(root_path, ["*.js", "*.json", "*.ts", "*.md"])
    run(["node", script, "--write", "--loglevel=error", "--"] + source_files,
        shell=False,
        quiet=True)
Example #4
0
def pylint():
    print "pylint"
    script = os.path.join(third_party_path, "python_packages", "pylint")
    rcfile = os.path.join(third_party_path, "depot_tools", "pylintrc")
    source_files = git_ls_files(root_path, ["*.py", ":!:gclient_config.py"])
    run([sys.executable, script, "--rcfile=" + rcfile, "--"] + source_files,
        env=python_env(),
        shell=False,
        quiet=True)
Example #5
0
def rustfmt():
    print "rustfmt"
    config_file = os.path.join(root_path, ".rustfmt.toml")
    source_files = git_ls_files(root_path, ["*.rs"])
    run([
        "rustfmt",
        "--config-path=" + config_file,
        "--",
    ] + source_files,
        shell=False,
        quiet=True)
Example #6
0
def eslint():
    print "eslint"
    script = os.path.join(third_party_path, "node_modules", "eslint", "bin",
                          "eslint")
    # Find all *directories* in the main repo that contain .ts/.js files.
    source_files = git_ls_files(root_path, ["*.js", "*.ts"])
    source_dirs = set([os.path.dirname(f) for f in source_files])
    # Within the source dirs, eslint does its own globbing, taking into account
    # the exclusion rules listed in '.eslintignore'.
    source_globs = ["%s/*.{js,ts}" % d for d in source_dirs]
    run(["node", script, "--max-warnings=0", "--"] + source_globs,
        shell=False,
        quiet=True)
Example #7
0
def cpplint():
    print "cpplint"
    script = os.path.join(third_party_path, "cpplint", "cpplint.py")
    source_files = git_ls_files(libdeno_path, ["*.cc", "*.h"])
    run([
        sys.executable,
        script,
        "--quiet",
        "--filter=-build/include_subdir",
        "--repository=" + libdeno_path,
        "--",
    ] + source_files,
        env=python_env(),
        shell=False,
        quiet=True)
Example #8
0
def eslint():
    print "eslint"
    script = os.path.join(third_party_path, "node_modules", "eslint", "bin",
                          "eslint")
    # Find all *directories* in the main repo that contain .ts/.js files.
    source_files = git_ls_files(root_path, [
        "*.js", "*.ts", ":!:std/**/testdata/*", ":!:std/**/node_modules/*",
        ":!:cli/compilers/*"
    ])
    source_dirs = set([os.path.dirname(f) for f in source_files])
    # Within the source dirs, eslint does its own globbing, taking into account
    # the exclusion rules listed in '.eslintignore'.
    source_globs = ["%s/*.{js,ts}" % d for d in source_dirs]
    # Set NODE_PATH so we don't have to maintain a symlink in root_path.
    env = os.environ.copy()
    env["NODE_PATH"] = os.path.join(root_path, "third_party", "node_modules")
    run(["node", script, "--max-warnings=0", "--"] + source_globs,
        shell=False,
        env=env,
        quiet=True)
Example #9
0
def gn_format():
    print "gn format"
    exe = get_buildtools_tool_path("gn")
    source_files = git_ls_files(root_path, ["*.gn", "*.gni"])
    run([exe, "format", "--"] + source_files, env=google_env(), quiet=True)