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
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
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
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
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
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