class
IScriptConventions.
IScriptConventions
Bases: object
Scripting API to build convention table results.
get_all_conventions
Returns the available and valid convention names.
The available convention queries.
IList
full_conventions_table
contextNodeUri=None
Starts the Code Analysis and returns the conventions table.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result
conventions_table
ruleset_object
contextNodeUri=None
Starts the Code Analysis and returns the conventions table for requested ruleset object.
ruleset_object (IScriptRuleSet) -- The ruleset object to analyze.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result.
conventions_table_from_query_chain_names
query_chain_names
contextNodeUri=None
Starts the Code Analysis and returns the conventions table for requested query chains.
query_chain_names (IEnumerable<string>) -- The names of the query chains to execute.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result.
The example shows how a conventions table for all Variable Naming conventions can be created.
active_app = projects.primary.active_application
# Get a list of all available conventions
all_conventions = projects.primary.active_application.code_analysis.conventions.get_all_conventions()
# Filter conventions for variable naming conventions
variable_naming_conventions = filter(lambda x: x.startswith('Variable Name'), all_conventions)
# Create conventions table with specific queries, selected by their names
conventions_table = active_app.code_analysis.conventions.conventions_table_from_query_chain_names(variable_naming_conventions)
# Store a html report of the conventions table
conventions_table.store_as_html(r"c:\Temp\ConventionsResultReport.html")
conventions_table_from_query_chain_name
query_chain_name
contextNodeUri=None
Starts the Code Analysis and returns the conventions table for requested query chain.
query_chain_name (string) -- The name of the query chain or ruleset to analyze.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result.
The example shows how a conventions table for a specific convention can be created.
active_app = projects.primary.active_application
# Create conventions table with single selected query chain
conventions_table = active_app.code_analysis.conventions.conventions_table_from_query_chain_name('Local Variable overwrites Global Variable')
# Store a html report of the conventions table
conventions_table.store_as_html(r"c:\Temp\ConventionsResultReport.html")
conventions_table_from_ruleset_name
ruleset_name
contextNodeUri=None
Starts the Code Analysis and returns the conventions table for requested ruleset.
ruleset_name (string) -- The name of the ruleset to analyze.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result.
The example shows how a conventions table for all Schneider Electric Basic Rules conventions can be created.
active_app = projects.primary.active_application
# Create conventions table with conventions in the Schneider Electric Basic Rules
conventions_table = active_app.code_analysis.conventions.conventions_table_from_ruleset_name('Schneider Electric Basic Rules')
# Store a html report of the conventions table
conventions_table.store_as_html(r"c:\Temp\MetricsResultReport.html")
conventions_table_from_query_chain_object
query_chain_object
contextNodeUri=None
Starts the Code Analysis and returns the conventions table for requested query_chain object.
query_chain_object (IScriptQueryChain) -- The query chain object to analyze.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result.
conventions_table_from_ruleset_object
ruleset_object
contextNodeUri=None
Starts the Code Analysis and returns the conventions table for requested ruleset object.
ruleset_object (IScriptRuleSet) -- The ruleset object to analyze.
contextNodeUri (string) -- The context node uri of a folder in application tree, if only a specific part of the application should be analyzed. If not set, the whole application or POU area (in case of a library) is analyzed.
Conventions table result.