mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Unify line ending rules in '.editorconfig' and '.gitattributes' (#5231)
* Unify line ending rules in '.editorconfig' and '.gitattributes' * Revert '.gitattributes' - fix invalid comments in the check-source.py
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
fd51fadaac
commit
f93d0f6ac1
@@ -1,7 +1,7 @@
|
|||||||
root = true
|
root = true
|
||||||
[*.{cpp,cc,h,sh}]
|
# Don't set line endings to avoid conflict with core.autocrlf flag.
|
||||||
end_of_line = LF
|
# Line endings on checkout/checkin are controlled by .gitattributes file.
|
||||||
|
[*]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
|
|||||||
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1 +1,2 @@
|
|||||||
|
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||||
* text=auto
|
* text=auto
|
||||||
|
|||||||
@@ -18,12 +18,11 @@ def check_encoding(encoding, scan_dir, regex_pattern):
|
|||||||
btext.decode(encoding=encoding, errors="strict")
|
btext.decode(encoding=encoding, errors="strict")
|
||||||
if encoding == "utf-8" and btext.startswith(b'\xEF\xBB\xBF'):
|
if encoding == "utf-8" and btext.startswith(b'\xEF\xBB\xBF'):
|
||||||
raise ValueError("unexpected BOM in file")
|
raise ValueError("unexpected BOM in file")
|
||||||
# check strict CRLF line-ending
|
# check LF line endings
|
||||||
LF = btext.count(b'\r')
|
LF = btext.count(b'\n')
|
||||||
CRLF = btext.count(b'\r\n')
|
CR = btext.count(b'\r')
|
||||||
assert LF >= CRLF, "CRLF logic error"
|
if CR!=0:
|
||||||
if CRLF != LF:
|
raise ValueError("invalid line endings: LF({})/CR({})".format(LF, CR))
|
||||||
raise ValueError("CRLF violation: found {} LF characters".format(LF - CRLF))
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print("ERROR with [{}]: {}".format(fname, err))
|
print("ERROR with [{}]: {}".format(fname, err))
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
Reference in New Issue
Block a user