Configuring rulesets within TICS

Base configuration

A ruleset (in RULESETS) must be configured for metrics CODINGSTANDARD, COMPILERWARNING, ABSTRACTINTERPRETATION and SECURITY. A ruleset must have a unique name a corresponding metric and a unique rule directory. A metric may be associated with more than one ruleset.

A ruleset NAME must be (globally) unique. This is just a string identifying the ruleset. Usually, something of the form owner language metric; e.g., Acme C Coding Standard, Acme C++ Compiler Warnings.

A ruleset metric name must be one of CODINGSTANDARD, COMPILERWARNING, ABSTRACTINTERPRETATION, SECURITY.

RULESDIR specifies the location of the coding standard configuration files RULES.txt and IMPL.txt. Each ruleset must specify its rule configuration in a separate directory. For more information on the contents of RULES and IMPL: see RULES/IMPL.txt.

The property DYNAMICRULESET defines whether a given ruleset is internally an aggregate of multiple different rulesets. For each file separately a choice is made on this ruleset dependent on the compiler version.

For enabling a dynamic ruleset, it is necessary to set the DYNAMICRULESET: 1 property in a ruleset. An example of the configuration in SERVER.yaml is given: for further configuration and the contents of this rules.json file, see the specific section for dynamic rulesets for a more detailed explanation.

RULESETS:
- NAME: C++ Dynamic Ruleset
  METRIC: CODINGSTANDARD
  RULESDIR: 4.0/codingstandards/CPP
  DYNAMICRULESET: 1

Coding standard viewer properties

The properties DOCNAME, DOCSUF, SEP and ANCHOR may be set to configure the coding standard viewer for the corresponding language. In case the TICS coding standard viewer is used, setting DOCNAME to the coding standard viewer location for the language is sufficient. In case DOCNAME points to (static) HTML pages, SEP and ANCHOR may also have to be set (to be able to point to individual rules).

The SEI CERT Secure Coding Rules are supported as follows.

RULESETS:
- NAME: SEI CERT C++ Coding Standard
  METRIC: SECURITY
  ...
  DOCNAME: https://wiki.sei.cmu.edu/confluence/display/
  DOCSUF: SYNOPSIS
  ANCHOR: /

So by setting DOCNAME, DOCSUF and ANCHOR (to the values above).

DOCNAME points to the TICS coding standard viewer or another document located on a web server, e.g., http://outserver/codingstandard.html.

ANCHOR is the static part that redirects to the specific rule within a coding standard document. For example, if the document contains anchors named <a name="Rule100">, where 100 is the ID of the rule, then the ANCHOR should be '#Rule'. For TICS coding standard viewers, this option can be omitted.

SEP overrides unencoded HTML entities in the coding standard document. In some cases, symbols that are not allowed in URLs, but that are part of the name of a coding standard rule, such as '#', are replaced by another character in the coding standard document. For example, a rule C#100 might be defined as anchor in the coding standard document as follows: <a name="RuleC_100"> (i.e., the '#' has been replaced by '_'). In this case, SEP must be specified as '_'. An alternative (better) approach would be to use the URL-encoded character in the document; in this case: <a name="RuleC%23100"> (since '%23' is the URL-encoding of '#'), and avoid having to specify SEP altogether. For TICS coding standard viewers, this option can be omitted.