[PatchCheck] Add exception file types (#523)

The PatchCheck.py will skip specified file types in skip_check_file_types.
As of now, .patch and .pem files are in skip list.

Signed-off-by: Aiden Park <aiden.park@intel.com>
This commit is contained in:
Aiden Park 2020-01-08 11:19:42 -08:00 committed by GitHub
parent 5bbf0122eb
commit e79890742f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -360,7 +360,16 @@ class GitDiffCheck:
''',
re.VERBOSE)
skip_check_file_types = (
'.patch',
'.pem',
)
def check_added_line(self, line):
f_name, f_ext = os.path.splitext(self.filename)
if f_ext in self.skip_check_file_types:
return
eol = ''
for an_eol in self.line_endings:
if line.endswith(an_eol):
@ -369,7 +378,7 @@ class GitDiffCheck:
stripped = line.rstrip()
if self.force_crlf and eol != '\r\n' and not self.filename.endswith('.patch'):
if self.force_crlf and eol != '\r\n':
self.added_line_error('Line ending (%s) is not CRLF' % repr(eol),
line)
if '\t' in line: