%SYSTEM.CodeScanner
Class %SYSTEM.CodeScanner Extends %SYSTEM.Help
Used to scan user code looking for references to deprecated functionality.
Parameters
DOMAIN
Parameter DOMAIN = "%Utility";
Methods
AddRow
ClassMethod AddRow(idx As %Integer, doc As %String, location As %String, message As %String) [ Internal, Private ]
Create a row in the PPG.
ReportClassDeprecated
ClassMethod ReportClassDeprecated(idx As %Integer, doc As %String, location As %String, cls As %String) [ Internal, Private ]
Create a row that reports cls
as deprecated.
NormalizeClassAndReport
ClassMethod NormalizeClassAndReport(idx As %Integer, doc As %String, location As %String, cls As %String, ByRef imports) As %String [ Internal, Private ]
Normalize cls
using imports
and create a row if it's deprecated. Create a row with the error text if the normalization fails. Returns the normalized class name, or the empty string if normalization failed.
CheckLine
ClassMethod CheckLine(idx As %Integer, line As %String, doc As %String, docType As %Integer, location As %String, ByRef imports, ByRef zuFns, ByRef vars) [ Internal, Private ]
Search line
of ObjectScript for references to deprecated functions.
SetUpZuFns
ClassMethod SetUpZuFns(Output zuFns As %String) [ Internal, Private ]
Output a subscripted array of deprecated $ZUTIL
functions and their replacements. Functions taken from InterSystems Language Server VS Code extension.
ScanDocumentsExecute
ClassMethod ScanDocumentsExecute(ByRef qHandle As %Binary, mapped As %Boolean = 0) As %Status [ Internal ]
Scan user-defined classes and routines in this namespace for references to classes and system functions that have been deprecated or should be replaced.
ObjectScript code in the routine body, Property SqlComputeCode
, and Method and Trigger implementations with Language = objectscript
is scanned. Classes defined with the Deprecated
keyword will not be scanned. The mapped argument controls whether documents mapped from a non-default database are scanned. By default, only documents in the default database will be scanned.
The query returns:
- Document - The name of the document, including the file extension.
- Location - A line number or class keyword describing where the deprecated reference is located in Document.
- Message - A string describing the deprecated reference at Location in Document. A row will be returned if the following code structures are encountered:
- A class defined with the
Deprecated
keyword that is:- Referenced in ObjectScript code using
##class()
or$SYSTEM.class.method()
syntax. - In the superclass,
CompileAfter
,DependsOn
, orPropertyClass
list of a class definition. - Defined as the type of an argument in a Method or class Query's argument list.
- Defined as the return type of a Method.
- Defined as the type of a Property or class Query.
- Referenced in ObjectScript code using
- A Method defined with the
Deprecated
keyword that is referenced using:##class().method()
syntax.$SYSTEM.class.method()
syntax.variable.method()
syntax, wherevariable
is a method argument defined with a type or a local variable with a type declared using#Dim
.$THIS.method()
syntax, when in a class definition.- Relative dot (
..method()
) syntax, when in a class definition.
- A Property defined with the
Deprecated
keyword that is referenced using:variable.property
syntax, wherevariable
is a method argument defined with a type or a local variable with a type declared using#Dim
.$THIS.property
syntax, when in a class definition.- Instance variable (
i%property
) syntax, when in a class definition.
- A Parameter defined with the
Deprecated
keyword that is referenced using:##class().#parameter
syntax.variable.#parameter
syntax, wherevariable
is a method argument defined with a type or a local variable with a type declared using#Dim
.$THIS.#parameter
syntax, when in a class definition.- Relative dot (
..#parameter
) syntax, when in a class definition.
- A
$ZUTIL
function listed in the $ZUTIL Replacements documentation. - A
$ZOBJ
function that has been replaced with a standard system function. - The #sqlcompile mode macro preprocessor directive.
$ZF(-1)
or$ZF(-2)
.- Class keyword
LegacyInstanceContext
or a reference to the obsolete%this
variable. - Property keyword
SqlListDelimiter
orSqlListType
. - A Method or Trigger with keyword
CodeMode
set to 'generator'. - A system function that is not supported in user code.
- A short class name that did not match a class in any of the imported packages.
- A short class name that matched classes in multiple imported packages and therefore was ambiguous.
- A Method or class Query argument list that is formatted incorrectly.
ScanDocumentsClose
ClassMethod ScanDocumentsClose(qHandle As %Binary) As %Status [ Internal ]
ScanDocumentsFetch
ClassMethod ScanDocumentsFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ Internal ]
SetupPatterns
ClassMethod SetupPatterns(ByRef patterns As %String, ByRef info As %String) [ Internal, Private ]
Define the list of things to scan for. The format is:
- patterns(num)=pattern
- patterns(num,"case")=case sensitive
- patterns(num,"version")=version customer will see the problem in
- patterns(num,"info")=description of the problem
- patterns(num,"whole")=whole word pattern match
ScanAll
ClassMethod ScanAll(SearchList As %String = "*.*") [ Deprecated ]
This method is deprecated. Use the ScanDocuments class Query instead.
Scan all namespaces on this system looking for code that may not work correctly due to use of unsupported features. You can pass an options SearchList argument which is a mask of which documents to search for.
Scan
ClassMethod Scan(SearchList As %String = "*.*") [ Deprecated ]
This method is deprecated. Use the ScanDocuments class Query instead.
Scan this namespace looking for code that may not work correctly due to use of unsupported features. You can pass an options SearchList argument which is a mask of which documents to search for.
searchItem
ClassMethod searchItem(pattern As %String, Name As %String, ByRef Found As %Integer = 0, wild As %Boolean = 0, CaseSensitive As %Boolean = 1, Max As %Integer = 200, Pattern As %String, WholeWords As %Boolean = 0) As %Boolean [ Internal, Private ]
Search this specific items for the string
searchClassNode
ClassMethod searchClassNode(Name As %String, ref As %String, type As %String, NewName As %String, pattern As %String, ByRef Found As %Integer, Tree As %String, CaseSensitive As %Boolean = 1, Max As %Integer = 200, Wild As %Boolean = 0) [ Internal, Private ]
Search this class for the string