Function -- {'IsPython': False, 'IsFakeroot': False, 'FuncName': 'foo', 'FuncNameComplete': 'foo', 'SubItem': '', 'SubItems': [], 'FuncBody': " echo '", 'FuncBodyStripped': "echo '", 'FuncBodyRaw': "\necho '}'", 'Line': 1, 'Raw': "foo() {\n echo '}'\n", 'Origin': '/home/msieron/dev/other/oelint-adv/test.bb', 'InFileLine': 1, 'RealRaw': "foo() {\n echo '}'\n", 'IsFromClass': False, 'OverrideDelimiter': ':', 'IsNewStyleOverrideSyntax': True, 'InlineBlocks': []}
Item -- {'Line': 3, 'Raw': ' echo\n', 'Origin': '/home/msieron/dev/other/oelint-adv/test.bb', 'InFileLine': 3, 'RealRaw': ' echo\n', 'IsFromClass': False, 'OverrideDelimiter': ':', 'IsNewStyleOverrideSyntax': True, 'InlineBlocks': []}
Item -- {'Line': 4, 'Raw': '}\n', 'Origin': '/home/msieron/dev/other/oelint-adv/test.bb', 'InFileLine': 4, 'RealRaw': '}\n', 'IsFromClass': False, 'OverrideDelimiter': ':', 'IsNewStyleOverrideSyntax': True, 'InlineBlocks': []}
IMO there is no need to handle nested scopes or even support closing bracket that is not the only thing on the line.
Bitbake itself will only close function scope when it encounters sole } in a line (lib/bb/parse/parse_py/BBHandler.py#L187-L195):
if __infunc__:
if s == '}':
__body__.append('')
ast.handleMethod(statements, fn, lineno, __infunc__[0], __body__, __infunc__[3], __infunc__[4])
__infunc__ = []
__body__ = []
else:
__body__.append(s)
return
I am not sure why oelint-parser tries to handle nested scopes in bitbake functions, but it results in incorrect parsing output.
Example:
results in
which is incorrect and is visible for example when one enables
oelint.spaces.linebeginningrule in oelint-adv.IMO there is no need to handle nested scopes or even support closing bracket that is not the only thing on the line.
Bitbake itself will only close function scope when it encounters sole
}in a line (lib/bb/parse/parse_py/BBHandler.py#L187-L195):