def full_json(self, path): """Create and fill an object, then create the JSON file to the given path This one is for debugging purpose :param path string: the path to create the file """ tmp = { 'project': GNAThub.Project.name(), '_total_message_count': sum(self.message_count.itervalues()), '_database': GNAThub.database(), 'creation_time': int(time.time()), 'properties': self.props or None, 'tools': self.tools or None, 'rules': self.rules or None, 'ranking': self.ranking or None, 'review_status': self.review_status or None, 'modules': [module.to_json() for name, module in self.modules.iteritems()], 'sources': self.sources } _write_json(path, tmp, indent=2)
def _generate(self): """Generate the :file:`sonar-project.properties` configuration. Do not create the file yet. See :meth:`write` for this. """ kwargs = { 'db_path': _escpath(GNAThub.database()), 'project_name': GNAThub.Project.name(), 'suffixes': [s[1:] if s.startswith('.') else s for s in GNAThub.Project.source_suffixes('Ada')] } if len(GNAThub.Project.source_dirs()) == 1: self._generate_single_module(**kwargs) else: self._generate_multi_module(**kwargs)
def filter_to_json(self, path): """Create and fill an object, then create the JSON file to the given path This one is for filter panel :param path string: the path to create the file """ tmp = { 'project': GNAThub.Project.name(), '_total_message_count': sum(self.message_count.itervalues()), '_database': GNAThub.database(), 'creation_time': int(time.time()), 'properties': self.props or None, 'tools': self.tools or None, 'rules': self.rules or None, 'ranking': self.ranking or None, 'review_status': self.review_status or None } _write_json(path, tmp, indent=2)
:param str path: The full path. :returns: str """ return os.path.relpath(path, BASEDIR) assertTrue(os.path.isdir(GNAThub.root())) assertEqual(relpath(GNAThub.root()), os.path.join('obj', 'gnathub')) assertTrue(os.path.isdir(GNAThub.logs())) assertEqual(relpath(GNAThub.logs()), os.path.join('obj', 'gnathub', 'logs')) assertTrue(os.path.isfile(GNAThub.database())) assertEqual(relpath(GNAThub.database()), os.path.join('obj', 'gnathub', 'gnathub.db')) #DB content check # Check tool exists TOOL = 'gnatcheck' assertTrue(contains(TOOL)) # Tools dictionary fron DB tools = {tool.id: tool for tool in GNAThub.Tool.list()} assertEqual(len(tools), 1) # Rules dictionary from DB rules = {rule.id: rule for rule in GNAThub.Rule.list()}
:param str path: The full path. :returns: str """ return os.path.relpath(path, BASEDIR) assertTrue(os.path.isdir(GNAThub.root())) assertEqual(relpath(GNAThub.root()), os.path.join('obj', 'gnathub')) assertTrue(os.path.isdir(GNAThub.logs())) assertEqual(relpath(GNAThub.logs()), os.path.join('obj', 'gnathub', 'logs')) assertTrue(os.path.isfile(GNAThub.database())) assertEqual( relpath(GNAThub.database()), os.path.join('obj', 'gnathub', 'gnathub.db') ) #DB content check # Check tool exists TOOL = 'gnatmetric' assertTrue(contains(TOOL)) # Tools dictionary fron DB tools = {tool.id: tool for tool in GNAThub.Tool.list()} assertEqual(len(tools), 1)