def is_valid_beta_description(self): """Check if beta disclaimer exists in detailed description""" data_dictionary = get_yaml(self.file_path) description_in_yml = data_dictionary.get('detaileddescription', '') if data_dictionary else '' if not re.match(PACKS_INTEGRATION_YML_REGEX, self.file_path, re.IGNORECASE): try: md_file_path = glob.glob(os.path.join(os.path.dirname(self.file_path), '*_description.md'))[0] except IndexError: error_message, error_code = Errors.description_missing_in_beta_integration() if self.handle_error(error_message, error_code, file_path=self.file_path): self._is_valid = False return False with open(md_file_path) as description_file: description = description_file.read() if BETA_INTEGRATION_DISCLAIMER not in description: error_message, error_code = Errors.no_beta_disclaimer_in_description() if self.handle_error(error_message, error_code, file_path=self.file_path): self._is_valid = False return False else: return True elif BETA_INTEGRATION_DISCLAIMER not in description_in_yml: error_message, error_code = Errors.no_beta_disclaimer_in_yml() if self.handle_error(error_message, error_code, file_path=self.file_path): self._is_valid = False return False return True
def is_valid_beta_description(self): """Check if beta disclaimer exists in detailed description""" description_in_yml = self.data_dictionary.get('detaileddescription', '') if self.data_dictionary else '' is_unified_integration = self.data_dictionary.get('script', {}).get('script', '') not in {'-', ''} if not is_unified_integration: try: md_file_path = glob.glob(os.path.join(os.path.dirname(self.file_path), '*_description.md'))[0] except IndexError: error_message, error_code = Errors.description_missing_in_beta_integration() if self.handle_error(error_message, error_code, file_path=self.file_path): self._is_valid = False return False with open(md_file_path) as description_file: description = description_file.read() if BETA_INTEGRATION_DISCLAIMER not in description: error_message, error_code = Errors.no_beta_disclaimer_in_description() if self.handle_error(error_message, error_code, file_path=self.file_path): self._is_valid = False return False else: return True # unified integration case elif BETA_INTEGRATION_DISCLAIMER not in description_in_yml: error_message, error_code = Errors.no_beta_disclaimer_in_yml() if self.handle_error(error_message, error_code, file_path=self.file_path): self._is_valid = False return False return True