예제 #1
0
파일: Git.py 프로젝트: jderehag/swat
    def _git(self, args, with_errno=False):
        if isinstance(args, str):
            args = args.split(' ')
        output = sysutils.call_subprocess([self._path_to_git] + args, with_errno=with_errno, cwd=self._repo)

        if with_errno:
            output = output[0], output[1].strip()
        else:
            output = output.strip()

        return output
예제 #2
0
    def _git(self, args, with_errno=False):
        if isinstance(args, str):
            args = args.split(' ')
        output = sysutils.call_subprocess([self._path_to_git] + args,
                                          with_errno=with_errno,
                                          cwd=self._repo)

        if with_errno:
            output = output[0], output[1].strip()
        else:
            output = output.strip()

        return output
예제 #3
0
파일: ClearCase.py 프로젝트: tmnilsson/swat
    def update_repo(self):
        """
        Updates view to the stream config-spec.
        i.e, calls:
        $>cleartool setcs --stream

        Raises:
            None
        Returns:
            (Boolean): True if update succeeded, otherwise False
        """
        rc, _ = sysutils.call_subprocess([self._path_to_clearcase, 'setcs', '--stream'], with_errno=True)
        if rc is 0:
            return True
        else:
            return False
예제 #4
0
def _get_complexity(curr_version_file, transformer):
    return_complexity = {}
    lizard_data = None
    if transformer is not None:
        mockfile = sysutils.call_subprocess(transformer.split() +
                                            [curr_version_file])
        lizard_data = LizardWrapper.run_lizard("mock.cpp", mockfile)
    else:
        lizard_data = LizardWrapper.run_lizard(curr_version_file)

    if lizard_data is not None:
        return_complexity = {
            func['name']: (func['cyclomatic_complexity'], func['token_count'],
                           len(func['parameters']))
            for func in lizard_data
        }
    return return_complexity
예제 #5
0
파일: analyze.py 프로젝트: mehrdad89/swat
def _get_complexity(curr_version_file, transformer):
    return_complexity = {}
    lizard_data = None
    if transformer is not None:
        mockfile = sysutils.call_subprocess(transformer.split() + [curr_version_file])
        lizard_data = LizardWrapper.run_lizard("mock.cpp", mockfile)
    else:
        lizard_data = LizardWrapper.run_lizard(curr_version_file)

    if lizard_data is not None:
        return_complexity = {func['name']: (func['cyclomatic_complexity'],
                                            func['token_count'],
                                            len(func['parameters']),
                                            func.get('max_nesting_depth', None),
                                            func.get('fan_in', None),
                                            func.get('fan_out', None)) for func in lizard_data}
    return return_complexity
예제 #6
0
파일: PyDiffer.py 프로젝트: jderehag/swat
    def _get_indexer(self, file_):
        content = []
        indexer = IndexerStub(file_)

        if file_ is not None:
            fileext_ = os.path.splitext(self._symbolic_filename_translator(file_))[1]
            transformer = self._transformer_dictionary.get(fileext_, None)
            if transformer is not None:
                mockfile = sysutils.call_subprocess(transformer.split() + [file_])
                indexer = LizardIndexer('mock.cpp', filecontent=mockfile)
                content = mockfile.splitlines()

            elif LizardIndexer.is_analyzable(self._symbolic_filename_translator(file_)):
                indexer = LizardIndexer(file_, symbolic_filename_translator=self._symbolic_filename_translator)
                with open(file_) as f:
                    content = f.readlines()
            else:
                with open(file_) as f:
                    content = f.readlines()

        return indexer, content
예제 #7
0
파일: analyze.py 프로젝트: jderehag/swat
def _get_complexity(curr_version_file, transformer):
    return_complexity = {}
    lizard_data = None
    if transformer is not None:
        mockfile = sysutils.call_subprocess(transformer.split() + [curr_version_file])
        lizard_data = LizardWrapper.run_lizard("mock.cpp", mockfile)
    else:
        lizard_data = LizardWrapper.run_lizard(curr_version_file)

    if lizard_data is not None:
        return_complexity = {
            func["name"]: (
                func["cyclomatic_complexity"],
                func["token_count"],
                len(func["parameters"]),
                func.get("max_nesting_depth", None),
                func.get("fan_in", None),
                func.get("fan_out", None),
            )
            for func in lizard_data
        }
    return return_complexity