src/nitpick/plugins/ini.py
def _read_file(self) -> Iterator[Fuss]:
        """Read the .ini file or special files like .editorconfig."""
        parsing_err: Optional[Error] = None
        try:
            self.updater.read(str(self.file_path))
        except MissingSectionHeaderError as err:
            if self.needs_top_section:
                original_contents = self.file_path.read_text()
                self.updater.read_string(f"[{TOP_SECTION}]\n{original_contents}")
                return

            # If this is not an .editorconfig file, report this as a regular parsing error
            parsing_err = err
        except DuplicateOptionError as err:
            parsing_err = err

        if not parsing_err:
            return

        # Don't change the file if there was a parsing error
        self.fix = False
        yield self.reporter.make_fuss(Violations.PARSING_ERROR, cls=parsing_err.__class__.__name__, msg=parsing_err)
        raise Error
Read the .ini file or special files like .editorconfig.
Read the .ini file or special files like .editorconfig.
Read the . ini file or special files like . editorconfig .
def _read_file(self) -> Iterator[Fuss]:
        parsing_err: Optional[Error] = None
        try:
            self.updater.read(str(self.file_path))
        except MissingSectionHeaderError as err:
            if self.needs_top_section:
                original_contents = self.file_path.read_text()
                self.updater.read_string(f"[{TOP_SECTION}]\n{original_contents}")
                return
            parsing_err = err
        except DuplicateOptionError as err:
            parsing_err = err
        if not parsing_err:
            return
        self.fix = False
        yield self.reporter.make_fuss(Violations.PARSING_ERROR, cls=parsing_err.__class__.__name__, msg=parsing_err)
        raise Error
def _read_file ( self ) -> Iterator [ Fuss ] : parsing_err : Optional [ Error ] = None try : self . updater . read ( str ( self . file_path ) ) except MissingSectionHeaderError as err : if self . needs_top_section : original_contents = self . file_path . read_text ( ) self . updater . read_string ( f"[{TOP_SECTION}]\n{original_contents}" ) return parsing_err = err except DuplicateOptionError as err : parsing_err = err if not parsing_err : return self . fix = False yield self . reporter . make_fuss ( Violations . PARSING_ERROR , cls = parsing_err . __class__ . __name__ , msg = parsing_err ) raise Error
Read the .ini file or special files like .editorconfig.
Read the . ini file or special files like . editorconfig .
"""Read the .ini file or special files like .editorconfig.""" # If this is not an .editorconfig file, report this as a regular parsing error # Don't change the file if there was a parsing error
self