Each filter is dedicated to removing bad trees from the data, e.g. trees that are too big.
Moreover, each filter works only for certain levels of granulaity.
Here we describe all filters provided by PSIMiner
.
Each description contains the corresponding JSON config.
granularity: files, functions
Exclude trees that are too small or too big by counting the amount nodes in it.
{
"name": "tree size",
"minSize": 0,
"maxSize": null
}
minSize
and maxSize
are optional parameters.
granularity: files, functions
Exclude trees that correspond to code with to small or to many lines. Each code snippet normalized before counting lines, e.g. remove lines with only parenthesis.
{
"name": "code lines",
"minCodeLines": 0,
"maxCodeLines": null
}
minCodeLines
and maxCodeLines
are optional parameters.
granularity: functions
Exclude constructors.
{
"name": "constructor"
}
granularity: functions
Exclude functions that have certain annotations (e.g. @Override
)
{
"name": "by annotations",
"excludeAnnotations": ["Override"]
}
granularity: functions
Exclude functions with certain modifiers (e.g. abstract
functions)
{
"name": "by modifiers",
"excludeModifiers": ["abstract"]
}
granularity: functions
Exclude functions with empty body and functions without body
{
"name": "empty method"
}
To add new filter following next steps: