codeCheck: codeCheck

View source: R/codeCheck.R

codeCheckR Documentation

codeCheck

Description

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.

Usage

codeCheck(
  path = ".",
  modulepath = "modules",
  core_files = c("core/*.gms", "main.gms"),
  returnDebug = FALSE,
  interactive = FALSE,
  test_switches = TRUE,
  strict = FALSE,
  details = FALSE
)

Arguments

path

path of the main folder of the model

modulepath

path to the module folder relative to "path"

core_files

list of files that belong to the core (wildcard expansion is supported)

returnDebug

If TRUE additional information will be returned useful for debugging the codeCheck function

interactive

activates an interactive developer mode in which some of the warnings can be fixed interactively.

test_switches

(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

strict

(boolean) test strictness. If set to TRUE warnings from codeCheck will stop calculations at the end of the analysis. Useful to enforce clean code.

details

(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.

Details

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

Value

A list of all modules containing the interfaces for each module. Or more detailed output if either details or returnDebug is set to TRUE.

Author(s)

Jan Philipp Dietrich

See Also

codeExtract,readDeclarations

Examples

# check code consistency of dummy model
codeCheck(system.file("dummymodel", package = "gms"))


gms documentation built on June 29, 2024, 9:07 a.m.