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 granularity.
Here we describe all filters provided by astminer
and provide corresponding YAML examples.
You can apply several filters at once.
Some filters are specific to a language or a parser.
If a language or parser does not support a certain filter,
FunctionInfoPropertyNotImplementedException
appears.
To get the necessary information about a function or file, extend astminer
with the specific logic of parsing an AST.
Filter config classes are defined in FilterConfigs.kt.
granularity: files, functions
Exclude ASTs that are too small or too big.
name: 'by tree size'
minTreeSize: 1
maxTreeSize: 100
granularity: files, functions
Exclude ASTs that have too many words in any token.
name: by words number
maxTokenWordsNumber: 10
granularity: functions
Exclude functions that have too many words in their name.
name: by function name length
maxWordsNumber: 10
granularity: functions
Exclude constructors
name: no constructors
granularity: functions
Exclude functions that have certain annotations (e.g. @Override
)
name: by annotations
annotations: [ override ]
granularity: functions
Exclude functions with certain modifiers (e.g. private
functions)
name: by modifiers
modifiers: [ private ]
granularity: functions
Exclude functions with empty body and functions without body
name: no blank functions