@@ -337,4 +337,107 @@ module MakeConsistency<
337337 )
338338 )
339339 }
340+
341+ /**
342+ * Gets counts of inconsistencies of each type.
343+ */
344+ int getInconsistencyCounts ( string type ) {
345+ // total results from all the AST consistency query predicates.
346+ type = "Node should have one enclosing callable" and
347+ result = count ( Node n | uniqueEnclosingCallable ( n , _) )
348+ or
349+ type = "Call should have one enclosing callable" and
350+ result = count ( DataFlowCall c | uniqueCallEnclosingCallable ( c , _) )
351+ or
352+ type = "Node should have one type" and
353+ result = count ( Node n | uniqueType ( n , _) )
354+ or
355+ type = "Node should have one location" and
356+ result = count ( Node n | uniqueNodeLocation ( n , _) )
357+ or
358+ type = "Nodes without location" and
359+ result = count ( | missingLocation ( _) | 1 )
360+ or
361+ type = "Node should have one toString" and
362+ result = count ( Node n | uniqueNodeToString ( n , _) )
363+ or
364+ type = "Callable mismatch for parameter" and
365+ result = count ( ParameterNode p | parameterCallable ( p , _) )
366+ or
367+ type = "Local flow step does not preserve enclosing callable" and
368+ result = count ( Node n1 , Node n2 | localFlowIsLocal ( n1 , n2 , _) )
369+ or
370+ type = "Read step does not preserve enclosing callable" and
371+ result = count ( Node n1 , Node n2 | readStepIsLocal ( n1 , n2 , _) )
372+ or
373+ type = "Store step does not preserve enclosing callable" and
374+ result = count ( Node n1 , Node n2 | storeStepIsLocal ( n1 , n2 , _) )
375+ or
376+ type = "Type compatibility predicate is not reflexive" and
377+ result = count ( DataFlowType t | compatibleTypesReflexive ( t , _) )
378+ or
379+ type = "Call context for isUnreachableInCall is inconsistent with call graph" and
380+ result = count ( Node n , DataFlowCall call | unreachableNodeCCtx ( n , call , _) )
381+ or
382+ type = "Node and call does not share enclosing callable" and
383+ result = count ( DataFlowCall call , Node n | localCallNodes ( call , n , _) )
384+ or
385+ type = "PostUpdateNode should not equal its pre-update node" and
386+ result = count ( PostUpdateNode n | postIsNotPre ( n , _) )
387+ or
388+ type = "PostUpdateNode should have one pre-update node" and
389+ result = count ( PostUpdateNode n | postHasUniquePre ( n , _) )
390+ or
391+ type = "Node has multiple PostUpdateNodes" and
392+ result = count ( Node n | uniquePostUpdate ( n , _) )
393+ or
394+ type = "PostUpdateNode does not share callable with its pre-update node" and
395+ result = count ( PostUpdateNode n | postIsInSameCallable ( n , _) )
396+ or
397+ type = "Origin of readStep is missing a PostUpdateNode" and
398+ result = count ( Node n | reverseRead ( n , _) )
399+ or
400+ type = "ArgumentNode is missing PostUpdateNode" and
401+ result = count ( ArgumentNode n | argHasPostUpdate ( n , _) )
402+ or
403+ type = "PostUpdateNode should not be the target of local flow" and
404+ result = count ( PostUpdateNode n | postWithInFlow ( n , _) )
405+ or
406+ type = "Call context too large" and
407+ result =
408+ count ( DataFlowCall call , DataFlowCall ctx , DataFlowCallable callable |
409+ viableImplInCallContextTooLarge ( call , ctx , callable )
410+ )
411+ or
412+ type = "Parameters with overlapping positions" and
413+ result =
414+ count ( DataFlowCallable c , ParameterPosition pos , Node p |
415+ uniqueParameterNodeAtPosition ( c , pos , p , _)
416+ )
417+ or
418+ type = "Parameter node with multiple positions" and
419+ result =
420+ count ( DataFlowCallable c , ParameterPosition pos , Node p |
421+ uniqueParameterNodePosition ( c , pos , p , _)
422+ )
423+ or
424+ type = "Non-unique content approximation" and
425+ result = count ( Content c | uniqueContentApprox ( c , _) )
426+ or
427+ type = "Node steps to itself" and
428+ result = count ( Node n | identityLocalStep ( n , _) )
429+ or
430+ type = "Missing call for argument node" and
431+ result = count ( ArgumentNode n | missingArgumentCall ( n , _) )
432+ or
433+ type = "Multiple calls for argument node" and
434+ result = count ( ArgumentNode arg , DataFlowCall call | multipleArgumentCall ( arg , call , _) )
435+ or
436+ type = "Lambda call enclosing callable mismatch" and
437+ result =
438+ count ( DataFlowCall call , Node receiver | lambdaCallEnclosingCallableMismatch ( call , receiver ) )
439+ or
440+ type = "Speculative step already hasM Model" and
441+ result = count ( Node n1 , Node n2 | speculativeStepAlreadyHasModel ( n1 , n2 , _) )
442+ }
340443}
0 commit comments