Skip to content

Commit

Permalink
Minor update on existing rules
Browse files Browse the repository at this point in the history
  • Loading branch information
desmarest committed Mar 1, 2019
1 parent 6ad5797 commit d079eaf
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion rules/X++/BalancedTtsStatement.xq
Expand Up @@ -6,7 +6,7 @@
<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/BalancedTtsStatement' Version='1.0'>
{
let $scopes := ("IfStatement", "IfThenElseStatement", "WhileStatement", "DoWhileStatement", "ForStatement", "TryStatement", "CatchStatement", "FinallyStatement", "SearchStatement", "SwitchEntryStatement", "Method", "FunctionDeclaration")
for $a in //(Table | Class | Form | Query)
for $a in /*
for $m in $a//Method
for $s in ($m, $m//*[local-name() = $scopes])
let $ttsbegin := count( ($s/CompoundStatement/TtsBeginStatement) | ($s/TtsBeginStatement) )
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/BooleanExpressionWithLiteral.xq
Expand Up @@ -5,7 +5,7 @@

<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/BooleanWithLiterals' Version='1.0'>
{
for $c in //(Class | Table | Form | Query)
for $c in /*
for $m in $c//Method
let $exprs := $m//OrExpression/BooleanLiteralExpression
| $m//AndExpression/BooleanLiteralExpression
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/Breakpoint.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/Breakpoint' Version='1.0'>
{
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a//Method
for $s in $m//BreakpointStatement
return
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/ComplexityIndentationCombined.xq
Expand Up @@ -63,7 +63,7 @@ declare function local:visitMethod($m as element(Method)) as xs:integer
let $complexityLimit := xs:integer(30)
let $indentationLimit := xs:integer(2)

for $c in //(Class | Table | Form | Query)
for $c in /*
for $m in $c//Method
let $cmpl := local:MethodComplexity($m)
where $cmpl > $complexityLimit
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/DeleteFromNotUsed.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/DeleteFromNotUsed' Version='1.0'>
{
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a//Method
for $s in $m//SearchStatement
where count($s/CompoundStatement/*) = 1
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/DirectSQL.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/DirectSQL' Version='1.0'>
{
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a/Method
for $qc in $m//QualifiedCall
where $qc/ExpressionQualifier[@Type = "Statement"]
Expand Down
4 changes: 2 additions & 2 deletions rules/X++/ExtensionsWithoutPrefix.xq
Expand Up @@ -4,9 +4,9 @@

<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/ExtensionsWithoutPrefix' Version='1.0'>
{
for $a in //Class
for $a in /Class
where $a/AttributeList/Attribute[@Name = "ExtensionOf"]
let $targetClass := $a/string(@ExtensionTarget)
let $targetClass := $a/AttributeList/Attribute[@Name = "ExtensionOf"]/AttributeExpression/IntrinsicAttributeLiteral[@FunctionName = "classStr"]/string(@Arg1)
where $a/@Name = fn:concat($targetClass, "_Extension")
return
<Diagnostic>
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/InsertInLoop.xq
Expand Up @@ -5,7 +5,7 @@
<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/InsertInLoop' Version='1.0'>
{
let $ins := ("Insert", "doInsert")
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a//Method
for $s in $m//(SearchStatement | DoWhileStatement | ForStatement | WhileStatement)
for $e in $s//CompoundStatement/ExpressionStatement//QualifiedCall[@MethodName = $ins]
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/MissingClassDocumentation.xq
Expand Up @@ -10,7 +10,7 @@ declare function functx:trim ( $arg as xs:string? ) as xs:string

<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/MissingClassDocumentation' Version='1.0'>
{
for $c in //(Class | Table | Form | Query)[@IsPrivate = "false" and functx:trim(@Comments) = ""]
for $c in /(Class | Table | Form | Query)[@IsPrivate = "false" and functx:trim(@Comments) = ""]
return
<Diagnostic>
<Moniker>MissingClassDocumentation</Moniker>
Expand Down
16 changes: 8 additions & 8 deletions rules/X++/MissingMethodDocumentation.xq
Expand Up @@ -10,19 +10,19 @@ declare function functx:trim ( $arg as xs:string? ) as xs:string

<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/MissingMethodDocumentation' Version='1.0'>
{
for $c in //(Class | Table | Form)[@IsPrivate = "false"]
for $m in $c//Method[@IsPrivate = "false" and functx:trim(@Comments) = ""]
for $c in /(Class | Table | Form)[@IsPrivate = "false"]
where $c//Method[@IsPrivate = "false" and functx:trim(@Comments) = ""]
return
<Diagnostic>
<Moniker>MissingMethodDocumentation</Moniker>
<Severity>Warning</Severity>
<Path>{string($c/@PathPrefix)}/Method/{string($m/@Name)}</Path>
<Message>Documentation is missing for non-private method on non-private class. XML documentation should be created to provide information related to usage.</Message>
<Path>{string($c/@PathPrefix)}</Path>
<Message>Documentation is missing for non-private method on this non-private class. XML documentation should be created to provide information related to usage.</Message>
<DiagnosticType>AppChecker</DiagnosticType>
<Line>{string($m/@StartLine)}</Line>
<Column>{string($m/@StartCol)}</Column>
<EndLine>{string($m/@EndLine)}</EndLine>
<EndColumn>{string($m/@EndCol)}</EndColumn>
<Line>{string($c/@StartLine)}</Line>
<Column>{string($c/@StartCol)}</Column>
<EndLine>{string($c/@EndLine)}</EndLine>
<EndColumn>{string($c/@EndCol)}</EndColumn>
</Diagnostic>
}
</Diagnostics>
2 changes: 1 addition & 1 deletion rules/X++/NestedSearch.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/NestedSearch' Version='1.0'>
{
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a/Method
for $nested in $m//(SearchStatement | DoWhileStatement | ForStatement | WhileStatement)//SearchStatement
return
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/SelectForUpdateAbsent.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/SelectForUpdateAbsent' Version='1.0'>
{
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a/Method
for $q in $m//Query
where $q/data(SelectionHints) = "ForUpdate"
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/SelectUsingFirstOnly.xq
Expand Up @@ -5,7 +5,7 @@
<Diagnostics Category='Best practice' href='docs.microsoft.com/Socratex/SelectUsingFirstOnly' Version='1.0'>
{
let $hints := ("FirstOnly1", "FirstOnly", "NoFetch")
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a//Method
for $q in $m//Query
where string(node-name($q/..)) != "JoinSpecification" (: only outermost query :)
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/SystemReflection.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/SystemReflection' Version='1.0'>
{
for $a in //(Class | Table | Form | Query)
for $a in /*
for $m in $a//Method
where $m//*[starts-with(@Type, "System.Reflection")]
return
Expand Down
2 changes: 1 addition & 1 deletion rules/X++/TableIndex.xq
Expand Up @@ -4,7 +4,7 @@

<Diagnostics Category='Mandatory' href='docs.microsoft.com/Socratex/TableIndex' Version='1.0'>
{
for $t in //Table
for $t in /Table
where not (exists ($t//ClusteredIndex))
return
<Diagnostic>
Expand Down

0 comments on commit d079eaf

Please sign in to comment.