don't read whole file to detect encoding

This commit is contained in:
Spencer Young
2020-03-24 22:19:01 -07:00
parent 10daf4c45f
commit d60e9fd0f6

View File

@@ -31,7 +31,7 @@ from yamllint.linter import PROBLEM_LEVELS
def determine_encoding(file):
with io.open(file, 'rb') as raw_file:
data = raw_file.read()
data = raw_file.read(4)
if data.startswith(codecs.BOM_UTF16_LE):
encoding = 'utf-16-le'
elif data.startswith(codecs.BOM_UTF16_BE):