Code Quality

The purpose of the code quality tool is to ensure that coding conventions and standards are being followed by the application developers. The tool can enforce coding conventions, detect potential errors, detect deprecated syntax, and provide guidance during code development or migration.

By using the tool, coding conventions can be verified by the developers during the build process before committing code changes. The lint rules file defines the rules governing code quality, and the tool can be activated or deactivated by setting the GSLINTENABLED environment variable.

The gslint application focuses on Genero BDL code, however additional rules could be checked by third-party tools. For example, rules could be added to validate text file formatting, such as the use of tabs versus spaces, or the proper CR/LF format.

The gslint tool can be run from the command line.

The lint rules file

The rules governing code quality is defined in a lint rules file. By default, the path is $GSTDIR/tools/gslint/src/default.gslint. You can specify a different lint rules file, see Enabling the lint rules file below.

When lint rules are enabled, the rules are applied at build time, and errors, warnings, and informational messages are written to the Output view.

Enabling the lint rules file

To enable (or disable) the code quality tools, set these two environment variables:
  • GSLINTRULES defines the path to the lint rules file.
  • GSLINTENABLED specifies whether the code quality tool is enabled (1) or disabled (0).

Genero Studio provides the default environment set Studio Linter Tool, where you can set or alter these environment variables.

The format of rules in the lint rules file

Lint rules are provided using a key/value format:
ruleId.option = value

The option specifies what option is to be checked for a specific ruleId.

Enabling a rule

In order for a rule to be applied, it must be enabled using the .enabled option. Valid values are true or false. For example, to enable ruleId:
ruleId.enabled = true

Setting the severity of a rule

When enabled, any non-compliance to a rule is written to the output with a severity level based on the setting of the .severity option. Valid values are error, info, or warning (default).

Warning: If the severity is set to error, the compilation will fail if the rule is broken.
For example, to set the severity of ruleId to error:
ruleId.severity = error

Running the Code Quality tool

The Code Quality tool is a Genero BDL application. The executable can be found at $GSTDIR/tools/gslint/bin.

If enabled, the Code Quality tools are applied when you build your application within Genero Studio.

You can also run the tool from the command line. To view command line options, type gslint -h.