-
-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--diff
works incorrectly with files that have CRLF line endings
#1348
Comments
Hi @jack1142, Thanks for raising this issue! Can you confirm what version of isort you are running (you can use isort --version). Additional optional information to help reproduction:
Thanks! ~Timothy |
isort version: 5.1.4 Output of `isort . --show-config`{
"_known_patterns": null,
"_section_comments": null,
"py_version": "py3",
"force_to_top": [],
"skip": [
"buck-out",
".tox",
".git",
".venv",
".eggs",
".mypy_cache",
"_build",
".hg",
"build",
"dist",
".stubs/discord"
],
"skip_glob": [],
"line_length": 88,
"wrap_length": 0,
"line_ending": "",
"sections": [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
],
"no_sections": false,
"known_future_library": [
"__future__"
],
"known_third_party": [
"google.appengine.api"
],
"known_first_party": [],
"known_standard_library": [
"tarfile",
"py_compile",
"configparser",
"fpectl",
"http",
"pwd",
"bdb",
"base64",
"syslog",
"binascii",
"code",
"shutil",
"socketserver",
"traceback",
"token",
"json",
"stat",
"pkgutil",
"filecmp",
"ensurepip",
"faulthandler",
"timeit",
"xml",
"formatter",
"ssl",
"pipes",
"sre_parse",
"getopt",
"sysconfig",
"_thread",
"hmac",
"select",
"struct",
"plistlib",
"sqlite3",
"copyreg",
"difflib",
"doctest",
"readline",
"pydoc",
"_dummy_thread",
"fnmatch",
"profile",
"selectors",
"unittest",
"builtins",
"inspect",
"spwd",
"binhex",
"numbers",
"os",
"tkinter",
"collections",
"msilib",
"gettext",
"fractions",
"cgi",
"curses",
"signal",
"warnings",
"atexit",
"nntplib",
"shelve",
"pdb",
"unicodedata",
"subprocess",
"urllib",
"secrets",
"ftplib",
"email",
"imghdr",
"zlib",
"abc",
"ntpath",
"stringprep",
"uuid",
"errno",
"contextlib",
"gc",
"tempfile",
"trace",
"modulefinder",
"wave",
"string",
"cgitb",
"fcntl",
"cProfile",
"asyncore",
"mimetypes",
"crypt",
"fileinput",
"pty",
"mmap",
"mailcap",
"lzma",
"codecs",
"getpass",
"statistics",
"platform",
"grp",
"re",
"queue",
"rlcompleter",
"typing",
"imaplib",
"argparse",
"tokenize",
"types",
"mailbox",
"tracemalloc",
"venv",
"wsgiref",
"dis",
"sys",
"heapq",
"uu",
"time",
"ctypes",
"keyword",
"pstats",
"netrc",
"xdrlib",
"hashlib",
"asynchat",
"webbrowser",
"compileall",
"dataclasses",
"symtable",
"test",
"weakref",
"sre_compile",
"operator",
"sre_constants",
"pprint",
"decimal",
"calendar",
"smtpd",
"winreg",
"multiprocessing",
"poplib",
"chunk",
"winsound",
"site",
"colorsys",
"tty",
"imp",
"io",
"termios",
"zipapp",
"enum",
"textwrap",
"sndhdr",
"threading",
"audioop",
"asyncio",
"glob",
"linecache",
"sre",
"aifc",
"dbm",
"posixpath",
"msvcrt",
"html",
"ipaddress",
"quopri",
"array",
"bz2",
"pickle",
"smtplib",
"sched",
"sunau",
"concurrent",
"logging",
"contextvars",
"pathlib",
"dummy_threading",
"locale",
"telnetlib",
"symbol",
"turtle",
"pickletools",
"math",
"functools",
"bisect",
"posix",
"importlib",
"reprlib",
"xmlrpc",
"zipfile",
"runpy",
"random",
"ossaudiodev",
"csv",
"cmath",
"shlex",
"nis",
"turtledemo",
"itertools",
"marshal",
"ast",
"gzip",
"socket",
"codeop",
"datetime",
"resource",
"copy",
"zipimport",
"pyclbr",
"distutils",
"macpath",
"cmd",
"lib2to3",
"tabnanny",
"encodings",
"parser",
"optparse"
],
"extra_standard_library": [],
"known_other": {},
"multi_line_output": "VERTICAL_HANGING_INDENT",
"forced_separate": [],
"indent": " ",
"comment_prefix": " #",
"length_sort": false,
"length_sort_sections": [],
"add_imports": [],
"remove_imports": [],
"reverse_relative": false,
"force_single_line": false,
"single_line_exclusions": [],
"default_section": "THIRDPARTY",
"import_headings": {},
"balanced_wrapping": false,
"use_parentheses": true,
"order_by_type": true,
"atomic": false,
"lines_after_imports": -1,
"lines_between_sections": 1,
"lines_between_types": 0,
"combine_as_imports": false,
"combine_star": false,
"include_trailing_comma": true,
"from_first": false,
"verbose": false,
"quiet": false,
"force_adds": false,
"force_alphabetical_sort_within_sections": false,
"force_alphabetical_sort": false,
"force_grid_wrap": 0,
"force_sort_within_sections": false,
"lexicographical": false,
"ignore_whitespace": false,
"no_lines_before": [],
"no_inline_sort": false,
"ignore_comments": false,
"case_sensitive": false,
"sources": [
{
"py_version": "py3",
"force_to_top": [],
"skip": [
"buck-out",
".tox",
".git",
".pants.d",
".venv",
"venv",
".eggs",
"node_modules",
".nox",
".mypy_cache",
"_build",
".hg",
"build",
"dist"
],
"skip_glob": [],
"line_length": 79,
"wrap_length": 0,
"line_ending": "",
"sections": [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
],
"no_sections": false,
"known_future_library": [
"__future__"
],
"known_third_party": [
"google.appengine.api"
],
"known_first_party": [],
"known_standard_library": [
"tarfile",
"py_compile",
"configparser",
"fpectl",
"http",
"pwd",
"bdb",
"base64",
"syslog",
"binascii",
"code",
"shutil",
"socketserver",
"traceback",
"token",
"json",
"stat",
"pkgutil",
"filecmp",
"ensurepip",
"faulthandler",
"timeit",
"xml",
"formatter",
"ssl",
"pipes",
"sre_parse",
"getopt",
"sysconfig",
"_thread",
"hmac",
"select",
"struct",
"plistlib",
"sqlite3",
"copyreg",
"difflib",
"doctest",
"readline",
"pydoc",
"_dummy_thread",
"fnmatch",
"profile",
"selectors",
"unittest",
"builtins",
"inspect",
"spwd",
"binhex",
"numbers",
"os",
"tkinter",
"collections",
"msilib",
"gettext",
"fractions",
"cgi",
"curses",
"signal",
"warnings",
"atexit",
"nntplib",
"shelve",
"pdb",
"unicodedata",
"subprocess",
"urllib",
"secrets",
"ftplib",
"email",
"imghdr",
"zlib",
"abc",
"ntpath",
"stringprep",
"uuid",
"errno",
"contextlib",
"gc",
"tempfile",
"trace",
"modulefinder",
"wave",
"string",
"cgitb",
"fcntl",
"cProfile",
"asyncore",
"mimetypes",
"crypt",
"fileinput",
"pty",
"mmap",
"mailcap",
"lzma",
"codecs",
"getpass",
"statistics",
"platform",
"grp",
"re",
"queue",
"rlcompleter",
"typing",
"imaplib",
"argparse",
"tokenize",
"types",
"mailbox",
"tracemalloc",
"venv",
"wsgiref",
"dis",
"sys",
"heapq",
"uu",
"time",
"ctypes",
"keyword",
"pstats",
"netrc",
"xdrlib",
"hashlib",
"asynchat",
"webbrowser",
"compileall",
"dataclasses",
"symtable",
"test",
"weakref",
"sre_compile",
"operator",
"sre_constants",
"pprint",
"decimal",
"calendar",
"smtpd",
"winreg",
"multiprocessing",
"poplib",
"chunk",
"winsound",
"site",
"colorsys",
"tty",
"imp",
"io",
"termios",
"zipapp",
"enum",
"textwrap",
"sndhdr",
"threading",
"audioop",
"asyncio",
"glob",
"linecache",
"sre",
"aifc",
"dbm",
"posixpath",
"msvcrt",
"html",
"ipaddress",
"quopri",
"array",
"bz2",
"pickle",
"smtplib",
"sched",
"sunau",
"concurrent",
"logging",
"contextvars",
"pathlib",
"dummy_threading",
"locale",
"telnetlib",
"symbol",
"turtle",
"pickletools",
"math",
"functools",
"bisect",
"posix",
"importlib",
"reprlib",
"xmlrpc",
"zipfile",
"runpy",
"random",
"ossaudiodev",
"csv",
"cmath",
"shlex",
"nis",
"turtledemo",
"itertools",
"marshal",
"ast",
"gzip",
"socket",
"codeop",
"datetime",
"resource",
"copy",
"zipimport",
"pyclbr",
"distutils",
"macpath",
"cmd",
"lib2to3",
"tabnanny",
"encodings",
"parser",
"optparse"
],
"extra_standard_library": [],
"known_other": {},
"multi_line_output": "GRID",
"forced_separate": [],
"indent": " ",
"comment_prefix": " #",
"length_sort": false,
"length_sort_sections": [],
"add_imports": [],
"remove_imports": [],
"reverse_relative": false,
"force_single_line": false,
"single_line_exclusions": [],
"default_section": "THIRDPARTY",
"import_headings": {},
"balanced_wrapping": false,
"use_parentheses": false,
"order_by_type": true,
"atomic": false,
"lines_after_imports": -1,
"lines_between_sections": 1,
"lines_between_types": 0,
"combine_as_imports": false,
"combine_star": false,
"include_trailing_comma": false,
"from_first": false,
"verbose": false,
"quiet": false,
"force_adds": false,
"force_alphabetical_sort_within_sections": false,
"force_alphabetical_sort": false,
"force_grid_wrap": 0,
"force_sort_within_sections": false,
"lexicographical": false,
"ignore_whitespace": false,
"no_lines_before": [],
"no_inline_sort": false,
"ignore_comments": false,
"case_sensitive": false,
"sources": [],
"virtual_env": "",
"conda_env": "",
"ensure_newline_before_comments": false,
"directory": "",
"profile": "",
"honor_noqa": false,
"src_paths": [],
"old_finders": false,
"remove_redundant_aliases": false,
"float_to_top": false,
"source": "defaults"
},
{
"multi_line_output": 3,
"include_trailing_comma": true,
"force_grid_wrap": 0,
"use_parentheses": true,
"ensure_newline_before_comments": true,
"line_length": 88,
"source": "black profile"
},
{
"profile": "black",
"skip": [
"buck-out",
".tox",
".git",
".venv",
".eggs",
".mypy_cache",
"_build",
".hg",
"build",
"dist",
".stubs/discord"
],
"source": "C:\\Users\\Jakub\\OneDrive\\Dokumenty\\JackCogs\\pyproject.toml"
}
],
"virtual_env": "",
"conda_env": "",
"ensure_newline_before_comments": true,
"directory": "C:\\Users\\Jakub\\OneDrive\\Dokumenty\\JackCogs",
"profile": "black",
"honor_noqa": false,
"src_paths": [
"C:\\Users\\Jakub\\OneDrive\\Dokumenty\\JackCogs",
"C:\\Users\\Jakub\\OneDrive\\Dokumenty\\JackCogs\\src"
],
"old_finders": false,
"remove_redundant_aliases": false,
"float_to_top": false
} Ran from Let me know if you need anything else. |
A fix for this issue was just deployed with version 5.2.0 of isort. Thanks! ~Timothy |
Reproduction:
test.py
and save it with Windows line endings (CRLF):isort --diff test.py
For comparison, saving the file with Unix line endings (LF), gives this diff:
The text was updated successfully, but these errors were encountered: