From d8b58617b9d6cb8fe51b2906ae647f86f7792d2e Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 22 Nov 2022 16:14:22 -0500 Subject: xlint: improve scanning of deprecated variables previously, deprecated variables showed some spurious and confusing messages. now they should have a better message. --- xlint | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlint') diff --git a/xlint b/xlint index 19bb98d..34ca604 100755 --- a/xlint +++ b/xlint @@ -15,6 +15,10 @@ scan() { done } +check_old_vars() { + sed -E 's/^([^:]+:[0-9]+:).*: ('"$old_variables"')=.*$/\1 \2 is deprecated and should not be used/' +} + regex_escape() { sed 's/\([.*+]\)/\\\1/g' } @@ -271,6 +275,9 @@ version xml_catalogs xml_entries" | tr '\n' '|') +old_variables=$(echo -n "long_desc +wrksrc" | tr '\n' '|') + old_accounts=$(echo -n "at avahi bitlbee @@ -445,7 +452,7 @@ for argument; do scan 'homepage=.*\$' "homepage should not use variables" scan 'maintainer=(?!.*<.*@.*>).*' "maintainer needs email address" scan 'maintainer=.*<.*@users.noreply.github.com>.*' "maintainer needs a valid address for sending mail" - scan '^(?!\s*('"$variables"'))[^\s=-]+=' "custom variables should use _ prefix: \\\2" + scan '^(?!\s*('"$variables"'))[^\s=-]+=' "custom variables should use _ prefix: \\\2" | check_old_vars scan '^[^ =]*=(""|''|)$' "variable set to empty string: \\\2" scan '^(.*)-docs_package().*' 'use -doc subpackage for documentation' scan 'distfiles=.*github.com.*/archive/.*\.zip[\"]?$' 'Use the distfile .tar.gz instead of .zip' @@ -465,7 +472,6 @@ for argument; do scan 'distfiles=.*xorg\.freedesktop\.org/wiki/' 'use $XORG_HOME' scan 'usr/lib/python3.[0-9]/site-packages' 'use $py3_sitelib' scan 'pycompile_module=' 'do not set pycompile_module, it is autodetected' - scan '^wrksrc=' 'wrksrc should not be defined' scan '^\t*function\b' 'do not use the function keyword' scan '^\t*[^ ]* *\(\)' 'do not use space before function parenthesis' scan '^\t*[^ ]*\(\)(| *){' 'use one space after function parenthesis' @@ -480,7 +486,7 @@ for argument; do scan "cargo update (--package|-p) [A-Za-z_][A-Za-z0-9_]*(?!\:[0-9]+\.[0-9]+\.[0-9]+)(\s.+)?$" '"cargo update" commands should include the specific version we are updating from in the --package SPEC' scan "cargo update (--package|-p) [A-Za-z_][A-Za-z0-9_-]*\:[0-9]+\.[0-9]+\.[0-9]+(?!--precise [0-9]+\.[0-9]+\.[0-9]+)$" '"cargo update" commands should include the specific version we are updating to, using --precise' scan '-D([[:alnum:]_-]+)=\$\(vopt_if \1 true false\)' 'use $(vopt_bool ...) instead of -D...=$(vopt_if ...)' - variables_order + variables_order | grep -Pv "($old_variables)=" header file_end explain_make_check -- cgit 1.4.1