"""__init__.py module for the Check AaC plugin."""# WARNING - DO NOT EDIT - YOUR CHANGES WILL NOT BE PROTECTED.# This file is auto-generated by the aac gen-plugin and may be overwritten.fromos.pathimportjoin,dirnamefromaac.execute.aac_execution_resultimport(ExecutionResult,ExecutionStatus,)fromaac.executeimporthookimplfromaac.context.language_contextimportLanguageContextfromaac.execute.plugin_runnerimportPluginRunnerfromaac.plugins.check.check_aac_implimportplugin_name,checkcheckaac_aac_file_name="check_aac.aac"
[docs]defrun_check(aac_file,fail_on_warn,verbose)->ExecutionResult:"""Perform AaC file quality checks using defined constraints in the AaC models."""result=ExecutionResult(plugin_name,"check",ExecutionStatus.SUCCESS,[])check_result=check(aac_file,fail_on_warn,verbose)ifnotcheck_result.is_success():returncheck_resultelse:result.add_messages(check_result.messages)returnresult
[docs]@hookimpldefregister_plugin()->None:""" Returns information about the plugin. Returns: A collection of information about the plugin and what it contributes. """active_context=LanguageContext()checkaac_aac_file=join(dirname(__file__),checkaac_aac_file_name)definitions=active_context.parse_and_load(checkaac_aac_file)checkaac_plugin_definition=[definitionfordefinitionindefinitionsifdefinition.name==plugin_name][0]plugin_instance=checkaac_plugin_definition.instanceforfile_to_loadinplugin_instance.definition_sources:active_context.parse_and_load(file_to_load)plugin_runner=PluginRunner(plugin_definition=checkaac_plugin_definition)plugin_runner.add_command_callback("check",run_check)active_context.register_plugin_runner(plugin_runner)