You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When auto-fixing, added line-ending should match line-ending of file being edited #665
When auto-fixing, we use the \n character as a line-ending, but on Windows, the line-ending is more likely to be \r\n. We could use os.EOL but this may not match the file that we are fixing, so we should detect the line ending during parsing and then use that.
In order to implement this, we need to change how we parse files. Currently, we use readline, which handles line endings for us, but doesn't give us a way to determine what they are. Instead, we likely need to implement our own readline so that we can look at the line-endings ourselves. There may be a third-party library that will help with this.
As the issue says, we could do something that defers line-endings to the local OS (os.EOL), but that doesn't solve the problem since we can be processing files with different line endings to the system default.
Activity
somewhatabstract commentedon Mar 8, 2025
In order to implement this, we need to change how we parse files. Currently, we use
readline, which handles line endings for us, but doesn't give us a way to determine what they are. Instead, we likely need to implement our ownreadlineso that we can look at the line-endings ourselves. There may be a third-party library that will help with this.As the issue says, we could do something that defers line-endings to the local OS (
os.EOL), but that doesn't solve the problem since we can be processing files with different line endings to the system default.