def METHOD_NAME(self) -> None:
    """For each file, read it, execute transforms on it, then write it."""
    for file, matches in self.matches_per_file.items():
        # str() convinces mypy that "text/yaml" is a valid Literal.
        # Otherwise, it thinks base_kind is one of playbook, meta, tasks, ...
        file_is_yaml = str(file.base_kind) == "text/yaml"
        try:
            data: str = file.content
        except (UnicodeDecodeError, IsADirectoryError):
            # we hit a binary file (eg a jar or tar.gz) or a directory
            data = ""
            file_is_yaml = False
        ruamel_data: CommentedMap | CommentedSeq | None = None
        if file_is_yaml:
            # We need a fresh YAML() instance for each load because ruamel.yaml
            # stores intermediate state during load which could affect loading
            # any other files. (Based on suggestion from ruamel.yaml author)
            yaml = FormattedYAML()
            ruamel_data = yaml.loads(data)
            if not isinstance(ruamel_data, (CommentedMap, CommentedSeq)):
                # This is an empty vars file or similar which loads as None.
                # It is not safe to write this file or data-loss is likely.
                # Only maps and sequences can preserve comments. Skip it.
                _logger.debug(
                    "Ignored reformatting %s because current implementation in ruamel.yaml would drop comments. See https://sourceforge.net/p/ruamel-yaml/tickets/460/",
                    file,
                )
                continue
        if self.write_set != {"none"}:
            self._do_transforms(file, ruamel_data or data, file_is_yaml, matches)
        if file_is_yaml:
            # noinspection PyUnboundLocalVariable
            file.content = yaml.dumps(ruamel_data)
        if file.updated:
            file.write()