mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +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:
parent
0ed51cf434
commit
79fa12ae4b
|
@ -23,7 +23,7 @@ __config_regexp__ = re.compile( r"""
|
||||||
(?P<var>[a-zA-Z0-9\-_+.${}/~:]*?)
|
(?P<var>[a-zA-Z0-9\-_+.${}/~:]*?)
|
||||||
(\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@/]*)\])?
|
(\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@/]*)\])?
|
||||||
|
|
||||||
\s* (
|
(?P<whitespace>\s*) (
|
||||||
(?P<colon>:=) |
|
(?P<colon>:=) |
|
||||||
(?P<lazyques>\?\?=) |
|
(?P<lazyques>\?\?=) |
|
||||||
(?P<ques>\?=) |
|
(?P<ques>\?=) |
|
||||||
|
@ -32,7 +32,7 @@ __config_regexp__ = re.compile( r"""
|
||||||
(?P<predot>=\.) |
|
(?P<predot>=\.) |
|
||||||
(?P<postdot>\.=) |
|
(?P<postdot>\.=) |
|
||||||
=
|
=
|
||||||
) \s*
|
) (?P<whitespace2>\s*)
|
||||||
|
|
||||||
(?!'[^']*'[^']*'$)
|
(?!'[^']*'[^']*'$)
|
||||||
(?!\"[^\"]*\"[^\"]*\"$)
|
(?!\"[^\"]*\"[^\"]*\"$)
|
||||||
|
@ -168,6 +168,8 @@ def feeder(lineno, s, fn, statements, baseconfig=False, conffile=True):
|
||||||
groupd = m.groupdict()
|
groupd = m.groupdict()
|
||||||
if groupd['var'] == "":
|
if groupd['var'] == "":
|
||||||
raise ParseError("Empty variable name in assignment: '%s'" % s, fn, lineno);
|
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)
|
ast.handleData(statements, fn, lineno, groupd)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user