utils/checkpackagelib: extend hint about unprefixed variables
User may get confused when they see the current hint, and take that as the proper replacement, while we're only reporting the stem of the variable name: .../foo.mk:16: possible typo: BLA -> *FOO* There is usually no easy way to actually suggest the proper variable name, though, so let's make it a little bit more obvious that we meant the variable was improperly prefixed: .../foo.mk:16: possible typo, variable not properly prefixed: BLA -> *FOO_XXX* And while at it, throw in the URL to the corresponding manual entry. Adapt the test accordingly. Reported-by: "Frager, Neal" <neal.frager@amd.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br> Reviewed-by: Neal Frager <neal.frager@amd.com> [Arnout: also update new test, scoped -> prefixed] Signed-off-by: Arnout Vandecappelle <arnout@mind.be> (cherry picked from commit 5836b797626db56958fec09810e16af1c75d2b4c) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
713db62f05
commit
6beb77d27e
@ -317,8 +317,8 @@ class TypoInPackageVariable(_CheckFunction):
|
||||
if self.ALLOWED.match(variable):
|
||||
return
|
||||
if self.REGEX.search(variable) is None:
|
||||
return ["{}:{}: possible typo: {} -> *{}*"
|
||||
.format(self.filename, lineno, variable, self.package),
|
||||
return ["{}:{}: possible typo, variable not properly prefixed: {} -> *{}_XXXX* ({}#_tips_and_tricks)"
|
||||
.format(self.filename, lineno, variable, self.package, self.url_to_manual),
|
||||
text]
|
||||
|
||||
|
||||
|
@ -546,27 +546,27 @@ TypoInPackageVariable = [
|
||||
('bad =',
|
||||
'any.mk',
|
||||
'OTHER_VAR = \n',
|
||||
[['any.mk:1: possible typo: OTHER_VAR -> *ANY*',
|
||||
[['any.mk:1: possible typo, variable not properly prefixed: OTHER_VAR -> *ANY_XXXX* (url#_tips_and_tricks)',
|
||||
'OTHER_VAR = \n']]),
|
||||
('bad +=',
|
||||
'any.mk',
|
||||
'OTHER_VAR += \n',
|
||||
[['any.mk:1: possible typo: OTHER_VAR -> *ANY*',
|
||||
[['any.mk:1: possible typo, variable not properly prefixed: OTHER_VAR -> *ANY_XXXX* (url#_tips_and_tricks)',
|
||||
'OTHER_VAR += \n']]),
|
||||
('ignore missing space',
|
||||
'any.mk',
|
||||
'OTHER_VAR= \n',
|
||||
[['any.mk:1: possible typo: OTHER_VAR -> *ANY*',
|
||||
[['any.mk:1: possible typo, variable not properly prefixed: OTHER_VAR -> *ANY_XXXX* (url#_tips_and_tricks)',
|
||||
'OTHER_VAR= \n']]),
|
||||
('use path in the warning',
|
||||
'./any.mk',
|
||||
'OTHER_VAR = \n',
|
||||
[['./any.mk:1: possible typo: OTHER_VAR -> *ANY*',
|
||||
[['./any.mk:1: possible typo, variable not properly prefixed: OTHER_VAR -> *ANY_XXXX* (url#_tips_and_tricks)',
|
||||
'OTHER_VAR = \n']]),
|
||||
('another name',
|
||||
'other.mk',
|
||||
'ANY_VAR = \n',
|
||||
[['other.mk:1: possible typo: ANY_VAR -> *OTHER*',
|
||||
[['other.mk:1: possible typo, variable not properly prefixed: ANY_VAR -> *OTHER_XXXX* (url#_tips_and_tricks)',
|
||||
'ANY_VAR = \n']]),
|
||||
('libc exception',
|
||||
'./any.mk',
|
||||
@ -583,7 +583,7 @@ TypoInPackageVariable = [
|
||||
('host (bad)',
|
||||
'any.mk',
|
||||
'HOST_OTHER_VAR = \n',
|
||||
[['any.mk:1: possible typo: HOST_OTHER_VAR -> *ANY*',
|
||||
[['any.mk:1: possible typo, variable not properly prefixed: HOST_OTHER_VAR -> *ANY_XXXX* (url#_tips_and_tricks)',
|
||||
'HOST_OTHER_VAR = \n']]),
|
||||
('provides',
|
||||
'any.mk',
|
||||
@ -599,13 +599,14 @@ TypoInPackageVariable = [
|
||||
'any.mk',
|
||||
'ANY_PROVIDES = other\n'
|
||||
'OTHERS_VAR = \n',
|
||||
[['any.mk:2: possible typo: OTHERS_VAR -> *ANY*',
|
||||
[['any.mk:2: possible typo, variable not properly prefixed: OTHERS_VAR -> *ANY_XXXX* (url#_tips_and_tricks)',
|
||||
'OTHERS_VAR = \n']]),
|
||||
('linux tool',
|
||||
'package/linux-tools/linux-tool-cpupower.mk.in',
|
||||
'CPUPOWER_DEPENDENCIES =\n'
|
||||
'POWER_DEPENDENCIES +=\n',
|
||||
[['package/linux-tools/linux-tool-cpupower.mk.in:2: possible typo: POWER_DEPENDENCIES -> *CPUPOWER*',
|
||||
[['package/linux-tools/linux-tool-cpupower.mk.in:2: possible typo, variable not properly prefixed: '
|
||||
'POWER_DEPENDENCIES -> *CPUPOWER_XXXX* (url#_tips_and_tricks)',
|
||||
'POWER_DEPENDENCIES +=\n']]),
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user