From a73d5f0b83aca0a704fa2b6437a792c51b63d3a2 Mon Sep 17 00:00:00 2001 From: peter-villadsen <79116119+peter-villadsen@users.noreply.github.com> Date: Fri, 28 Jan 2022 17:25:48 -0800 Subject: [PATCH] Added query to determine if tablestr and methodstr (and their counterparts) have unbalanced --- .../X++/AttributesWithUnmatchedParms.xq | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Sample rules/X++/AttributesWithUnmatchedParms.xq diff --git a/Sample rules/X++/AttributesWithUnmatchedParms.xq b/Sample rules/X++/AttributesWithUnmatchedParms.xq new file mode 100644 index 0000000..51019d9 --- /dev/null +++ b/Sample rules/X++/AttributesWithUnmatchedParms.xq @@ -0,0 +1,19 @@ +(: Copyright (c) Microsoft Corporation. +Licensed under the MIT license. :) + +(: @Language Xpp :) +(: @Category Informational :) + +{ + for $a in /(Class | Table | Query | Form) + for $attr in $a//AttributeList/Attribute[count(*)>=2] + for $tablestrattr in $attr/AttributeExpression/IntrinsicAttributeLiteral[lower-case(@FunctionName) = ('tablestr', 'classstr', 'querystr', 'formstr')] + for $fieldstrattr in $attr/AttributeExpression/IntrinsicAttributeLiteral[lower-case(@FunctionName) = ('methodstr', 'formmethodstr', 'tablemethodstr', 'staticmethodstr', 'tablestaticstr', 'fieldstr')] + where lower-case(tablestrattr/@Arg1) != lower-case(fielstrattr/@Arg1) + + order by $a/@Artifact + return +} +