The codeimprover.yaml configuration file
Configuration of the CodeImprover analysis behavior is done in a programmer-friendly way – by adding a source code file to the root of the repository.
The added configuration file controls the behavior of the analytical engine – thus affecting the analysis result shown via apps and portals alike.
The configuration file name is: codeimprover.yaml
The codeimprover.yaml file contains YAML style markup that determines the configuration settings.
Remark: The configuration file is optional. If no configuration file is found – CodeImprover falls back on hardcoded default values, noted on each setting.
Most real word scenarios probably will get a configuration file at some point.
Settings regarding Duplication analysis
The number of lines in the file to compare
Default value: 7
How many lines of source code must be identical for the occurrence to be considered a duplication?
A low number results in more duplications findings. The optimal lowest value depends on a lot of things, including programming language and style.
File paths to exclude from analysis
Default value: Every path is included.
If the repo contains paths that consist of copies (of other paths) or contains tool-generated code – it might be desirable to exclude such paths from the analysis.
Setting paths to exclude protects you from being overflowed with duplication detections of no relevance.
File types to exclude from analysis
Default value: All non-binary files are included.
It is possible to exclude specific file types. This pattern is also written as regular expressions. The typical usages are excluding by extension. But any file hit by a filename exclusion expression is – excluded.
There is no way to include binary files in the analysis.
Line patterns to exclude from analysis
Default value: No lines excluded.
Add patterns here to exclude lines in files that contain a specific pattern. In many programming languages, each file starts with an import/include/using statements, which might be duplicated across your repo, but which you don’t want to be reported.
The line exclusions regular expressions can exclude any line that matches.
Warning 1: The yaml format is forgiving.
The standard yaml reader implementation takes the same forgiving approach as HTML readers. It reads whatever possible and ignores the rest. If you make a yaml file formatting error – often the offending settings will be completely ignored without any error message.
A common mistake is to miss the correct indention – thereby creating a mess in the yaml hierarchy. Leading whitespaces do have meaning in the yaml file format.
Warning 2: For all exclude expressions.
If an exclude pattern is not matched at least once, during duplication analysis, an error will be raised. This is a design choice to help guard you against typos or misunderstandings in the sometimes tricky world of regular expressions. Getting this kind of error can be solved by commenting out the offending exclude expression.
Warning 3: codeimprover. yaml configures all CodeImprover apps.
The codeimprover.yaml file is optionel, but If a codeimprover.yaml file exists, it must be error-free.
Errors in the codeimprover.yaml file breaks all CodeImprover apps if the error is detected, see warning 1.
Settings regarding Metrics analysis
Currently, there are no configuration settings for the Metric app.
codeimprover.yaml file and branching
Each branch may have its very own version of the .codeimprover.yaml configuration file.
CodeImprover applications and apps will act accordingly to the configuration file found in the branch in question. However, this feature might result in somewhat confusing results. In general, we encourage you to use identical settings for all branches in a repository.