Checks GAMS code for consistency. Throws out warnings if something is wrong in the code and returns a list containing the interfaces of each module of the code.
codeCheck(
path = ".",
modulepath = "modules",
core_files = c("core/*.gms", "main.gms"),
returnDebug = FALSE,
interactive = FALSE,
test_switches = TRUE,
strict = FALSE,
details = FALSE
)
A list of all modules containing the interfaces for each module. Or more detailed output if either
details
or returnDebug
is set to TRUE.
path of the main folder of the model
path to the module folder relative to "path"
list of files that belong to the core (wildcard expansion is supported)
If TRUE additional information will be returned useful for debugging the codeCheck function
activates an interactive developer mode in which some of the warnings can be fixed interactively.
(boolean) Should realization switches in model core be tested for completeness? Usually set to TRUE but should be set to FALSE for standalone models only using a subset of existing modules
(boolean) test strictness. If set to TRUE warnings from codeCheck will stop calculations at the end of the analysis. Useful to enforce clean code.
(boolean) If activated the function will return more detailed output. Besides interface information it will provide a table containing all declarations in the code, an appearance table listing the appearance of all objects in the code and information about the existing modules. The format is list(interfaceInfo,declarations,appearance,modulesInfo). This setting will be ignored when returnDebug is set to TRUE.
Jan Philipp Dietrich
Additional settings can be provided via a yaml file ".codeCheck" in the main folder of the model. Currently supported settings are: - capitalExclusionList: a list of names that should be ignored when checking for unified capitalization of variables
codeExtract
,readDeclarations
# check code consistency of dummy model
codeCheck(system.file("dummymodel", package = "gms"))
Run the code above in your browser using DataLab