def are_release_notes_complete(self): is_valid = True modified_added_files = itertools.chain.from_iterable( (self.added_files or [], self.modified_files or [])) if modified_added_files: for file in modified_added_files: # renamed files will appear in the modified list as a tuple: (old path, new path) if isinstance(file, tuple): file = file[1] checked_file_pack_name = get_pack_name(file) if find_type(file) in SKIP_RELEASE_NOTES_FOR_TYPES: continue elif checked_file_pack_name and checked_file_pack_name == self.pack_name: # Refer image and description file paths to the corresponding yml files file = UpdateRN.change_image_or_desc_file_path(file) update_rn_util = UpdateRN(pack_path=self.pack_path, modified_files_in_pack=set(), update_type=None, added_files=set(), pack=self.pack_name) file_name, file_type = update_rn_util.get_changed_file_name_and_type( file) if file_name and file_type: if (RN_HEADER_BY_FILE_TYPE[file_type] not in self.latest_release_notes) or \ (file_name not in self.latest_release_notes): entity_name = update_rn_util.get_display_name(file) error_message, error_code = Errors.missing_release_notes_entry( file_type, self.pack_name, entity_name) if self.handle_error(error_message, error_code, self.release_notes_file_path): is_valid = False return is_valid
def format_user_input(self) -> Dict[str, str]: """ Replace the content item name with the content item display name if exists to match the template that being generated by the UpdateRN class by calling UpdateRN class function get_display_name(file_path) Build a dictionary with the release notes text per content item detected. Returns: Dict: Key is content item name, value is release note entry """ entity_identifier = '##### ' content_item_type_identifier = '#### ' rn_per_content_item: dict = defaultdict(str) entity_name = 'NonEntityRelated' items_path = { content_item.get('source_id'): content_item.get('source_file_name') for content_item in self.detected_content_items } for line in filter(None, self.release_notes.splitlines()): if line.startswith(entity_identifier): entity_name = line.lstrip(entity_identifier) if items_path.get(entity_name): entity_name = UpdateRN.get_display_name( items_path.get(entity_name)) elif not line.startswith(content_item_type_identifier): rn_per_content_item[entity_name] = rn_per_content_item[ entity_name] + line + '\n' return rn_per_content_item
def are_release_notes_complete(self): is_valid = True modified_added_files = itertools.chain.from_iterable((self.added_files or [], self.modified_files or [])) if modified_added_files: for file in modified_added_files: # renamed files will appear in the modified list as a tuple: (old path, new path) if isinstance(file, tuple): file = file[1] if find_type(file) in self.file_types_that_should_not_appear_in_rn: continue elif self.pack_name + '/' in file: # Refer image and description file paths to the corresponding yml files file = UpdateRN.check_for_release_notes_valid_file_path(file) update_rn_util = UpdateRN(pack_path=self.release_notes_file_path, modified_files_in_pack=set(), update_type=None, added_files=set(), pack=self.pack_name) file_name, file_type = update_rn_util.identify_changed_file_type(file) if file_name and file_type: if (file_type not in self.latest_release_notes) or (file_name not in self.latest_release_notes): entity_name = update_rn_util.get_display_name(file) error_message, error_code = Errors.missing_release_notes_entry(file_type, self.pack_name, entity_name) if self.handle_error(error_message, error_code, self.release_notes_file_path): is_valid = False return is_valid
def are_release_notes_complete(self): is_valid = True modified_added_files = itertools.chain.from_iterable((self.added_files or [], self.modified_files or [])) if modified_added_files: for file in modified_added_files: if not any(permitted_type in file for permitted_type in VALIDATED_PACK_ITEM_TYPES): continue elif self.pack_name in file: update_rn_util = UpdateRN(pack=self.pack_name, pack_files=set(), update_type=None, added_files=set()) file_name, file_type = update_rn_util.identify_changed_file_type(file) if file_name and file_type: if (file_type not in self.latest_release_notes) or (file_name not in self.latest_release_notes): entity_name = update_rn_util.get_display_name(file) error_message, error_code = Errors.missing_release_notes_entry(file_type, self.pack_name, entity_name) if self.handle_error(error_message, error_code, self.file_path): is_valid = False return is_valid