org.autoplot.jythonsupport.StaticCodeAnalysis
Static Code Analysis checks for bug patterns like variable writes without a read.
StaticCodeAnalysis( )
showReadButNotAssigned
showReadButNotAssigned( String script, boolean appContext, String pwd ) → List
return any node where a name is read but has not been assigned. This is an
error which would show when the code is run.
Parameters
script - the script code (not the filename).
appContext - true if application codes are loaded
pwd - null or the value of the working directory.
Returns:
a java.util.List
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
showReassignFunctionCall
showReassignFunctionCall( String script, boolean appContext, String pwd ) → List
return any name which is used as a function call but has been reassigned.
Parameters
script - the script code (not the filename).
appContext - true if application codes are loaded
pwd - null or the value of the working directory.
Returns:
a java.util.List
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
showUsage
showUsage( String script, String symbol ) → List
get the nodes where the symbol is used.
Parameters
script - the jython script which is parsed.
symbol - the symbol to look for, a Jython name
Returns:
the AST nodes which contain location information.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
showWriteWithoutRead
showWriteWithoutRead( String script ) → List
return any node where a variable is assigned but then not later read. This is
not an error, but is a nice way to flag suspicious code.
Parameters
script - the script code (not the filename).
Returns:
a java.util.List
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]