OCLint can load configuration files (
.oclint) and populates arguments from there.
There are three levels of configurations files-
- System Configuration File
- is saved into
oclintmain binary is installed into
/bin/oclintfor the most common case, then this is the regular
/etc/oclintfile. The configurations saved into this file change the behaviors of OCLint throughout the entire system.
- User Configuration File
- is preserved to
~/.oclint, which is under the home directory of the current user. User preferences can be saved into this file, and only scope the current user. Configurations in this file can override the existing ones in the system configuration file.
- Project Configuration File
- is usually placed at the root folder of the project, where
oclintis usually invoked from. This file is scanned and configurations are only for the current project. Configurations in this file can override the ones in user configuration file, and in sequence, override the ones in system configuration file.
Arguments passing to the command line invocation would override the ones in the configuration file.
The acceptable configuration file is written in YAML format, with the following available options:
|Option||Type||Mapping Command Option|
|rules||List of strings||-rule|
|disable-rules||List of strings||-disable-rule|
|rule-paths||List of strings||-R|
|rule-configurations||List of associative arrays||-rc|
An example of a
.oclint file might looks like this:
disable-rules: - LongLine rulePaths: - /etc/rules rule-configurations: - key: CYCLOMATIC_COMPLEXITY value: 15 - key: NPATH_COMPLEXITY value: 300 output: oclint.xml report-type: xml max-priority-1: 20 max-priority-2: 40 max-priority-3: 60 enable-clang-static-analyzer: false