Extend lint to reject 'blank' files (#23994)
This commit is contained in:
@@ -24,7 +24,7 @@ def _get_chunks(it, size):
|
||||
return iter(lambda: tuple(islice(it, size)), ())
|
||||
|
||||
|
||||
def _preprocess_c_file(file):
|
||||
def preprocess_c_file(file):
|
||||
"""Load file and strip comments
|
||||
"""
|
||||
file_contents = file.read_text(encoding='utf-8')
|
||||
@@ -66,7 +66,7 @@ def find_layouts(file):
|
||||
parsed_layouts = {}
|
||||
|
||||
# Search the file for LAYOUT macros and aliases
|
||||
file_contents = _preprocess_c_file(file)
|
||||
file_contents = preprocess_c_file(file)
|
||||
|
||||
for line in file_contents.split('\n'):
|
||||
if layout_macro_define_regex.match(line.lstrip()) and '(' in line and 'LAYOUT' in line:
|
||||
@@ -248,7 +248,7 @@ def _parse_led_config(file, matrix_cols, matrix_rows):
|
||||
current_row_index = 0
|
||||
current_row = []
|
||||
|
||||
for _type, value in lex(_preprocess_c_file(file), CLexer()):
|
||||
for _type, value in lex(preprocess_c_file(file), CLexer()):
|
||||
if not found_g_led_config:
|
||||
# Check for type
|
||||
if value == 'led_config_t':
|
||||
|
||||
Reference in New Issue
Block a user