Exemplo n.º 1
0
def run_tidy(sha="HEAD", is_rev_range=False):
    patch_file = tempfile.NamedTemporaryFile()
    cmd = [
        "git", "diff" if is_rev_range else "show", sha,
        "--src-prefix=%s/" % ROOT,
        "--dst-prefix=%s/" % ROOT
    ]
    subprocess.check_call(cmd, stdout=patch_file)
    return subprocess.check_output(
        [CLANG_TIDY_DIFF, "-clang-tidy-binary", CLANG_TIDY, "-p0", "--"] +
        compile_flags.get_flags(),
        stdin=file(patch_file.name))
Exemplo n.º 2
0
 def tidy_on_path(path):
     patch_file = tempfile.NamedTemporaryFile()
     cmd = diff_cmdline + [
         "--src-prefix=%s/" % ROOT,
         "--dst-prefix=%s/" % ROOT, "--", path
     ]
     subprocess.check_call(cmd, stdout=patch_file, cwd=ROOT)
     cmdline = [
         CLANG_TIDY_DIFF, "-clang-tidy-binary", CLANG_TIDY, "-p0", "--",
         "-DCLANG_TIDY"
     ] + compile_flags.get_flags()
     return subprocess.check_output(cmdline,
                                    stdin=file(patch_file.name),
                                    cwd=ROOT)
def run_tidy(sha="HEAD"):
    patch_file = tempfile.NamedTemporaryFile()
    cmd = [
        "git", "show", sha,
        "--src-prefix=%s/" % ROOT,
        "--dst-prefix=%s/" % ROOT]
    subprocess.check_call(cmd,
                          stdout=patch_file)
    return subprocess.check_output(
        [CLANG_TIDY_DIFF,
         "-clang-tidy-binary", CLANG_TIDY,
         "-p0",
         "--"] + compile_flags.get_flags(),
        stdin=file(patch_file.name))
Exemplo n.º 4
0
 def tidy_on_path(path):
     patch_file = tempfile.NamedTemporaryFile()
     cmd = diff_cmdline + [
         "--src-prefix=%s/" % ROOT,
         "--dst-prefix=%s/" % ROOT,
         "--",
         path]
     subprocess.check_call(cmd, stdout=patch_file, cwd=ROOT)
     cmdline = [CLANG_TIDY_DIFF,
                "-clang-tidy-binary", CLANG_TIDY,
                "-p0",
                "--",
                "-DCLANG_TIDY"] + compile_flags.get_flags()
     return subprocess.check_output(
         cmdline,
         stdin=file(patch_file.name),
         cwd=ROOT)
    def tidy_on_path(path):
        #patch_file = tempfile.NamedTemporaryFile()
        patch_file = tempfile.NamedTemporaryFile(prefix='review_robot.',
                                                 delete=False)
        cmd = diff_cmdline + [
            "-U0",
            "--src-prefix=%s/" % ROOT,
            "--dst-prefix=%s/" % ROOT, "--", path
        ]
        logging.info("path=%s", path)
        logging.info("cmd=%s", cmd)
        logging.info("patch_file=%s", patch_file.name)
        subprocess.check_call(cmd, stdout=patch_file, cwd=ROOT)

        cmdline = [
            CLANG_TIDY_DIFF, "-clang-tidy-binary", CLANG_TIDY, "-p0", "--",
            "-DCLANG_TIDY"
        ] + compile_flags.get_flags()

        logging.info("cmdline=%s", cmdline)

        return subprocess.check_output(cmdline,
                                       stdin=file(patch_file.name),
                                       cwd=ROOT)
Exemplo n.º 6
0
# g:ycm_extra_conf_globlist variable in your .vimrc file. For details on how to
# install and configure YouCompleteMe, see
# https://github.com/Valloric/YouCompleteMe
#
# This file is based on the example configuration file from YouCompleteMe.

import os
import sys
import ycm_core

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "build-support"))
from compile_flags import get_flags

# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
flags = get_flags()

# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''

if os.path.exists( compilation_database_folder ):
  database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
  database = None

SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]