mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
bitbake: parse/ConfHandler: Add warning for deprecated whitespace usage
A lack of whitespace around variable assignment operators makes the files harder to read. There is a deeper issue in that a "+" character can sometimes be confused between the variable name and the assignment operator. Start showing warnings for such usage so we encourage people to use consistent whitespace which helps with file readability in general. (Bitbake rev: 24772dd2ae6c0cd11540a260f15065f906fb0997) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -23,7 +23,7 @@ __config_regexp__ = re.compile( r"""
|
||||
(?P<var>[a-zA-Z0-9\-_+.${}/~:]*?)
|
||||
(\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@/]*)\])?
|
||||
|
||||
\s* (
|
||||
(?P<whitespace>\s*) (
|
||||
(?P<colon>:=) |
|
||||
(?P<lazyques>\?\?=) |
|
||||
(?P<ques>\?=) |
|
||||
@@ -32,7 +32,7 @@ __config_regexp__ = re.compile( r"""
|
||||
(?P<predot>=\.) |
|
||||
(?P<postdot>\.=) |
|
||||
=
|
||||
) \s*
|
||||
) (?P<whitespace2>\s*)
|
||||
|
||||
(?!'[^']*'[^']*'$)
|
||||
(?!\"[^\"]*\"[^\"]*\"$)
|
||||
@@ -168,6 +168,8 @@ def feeder(lineno, s, fn, statements, baseconfig=False, conffile=True):
|
||||
groupd = m.groupdict()
|
||||
if groupd['var'] == "":
|
||||
raise ParseError("Empty variable name in assignment: '%s'" % s, fn, lineno);
|
||||
if not groupd['whitespace'] or not groupd['whitespace2']:
|
||||
logger.warning("%s:%s has a lack of whitespace around the assignment: '%s'" % (fn, lineno, s))
|
||||
ast.handleData(statements, fn, lineno, groupd)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user