-
Notifications
You must be signed in to change notification settings - Fork 3
Overview of architecture
After clicking the Search for refactorings... button AutomaticRefactoringAction
is run by IDEA internal mechanisms. It receives current Project
and AnalysisScope
as its parameters. Project
is just a current project and AnalysisScope
stores all the data (set of files) that should be processed. Both these objects are passed to a RefactoringExecutionContext
which calculates metrics, executes various algorithms and shows the results to the user.
Metrics calculation is performed by another plugin, MetricsReloaded, that we build upon. Each metric is represented by a MetricInstance
— actual metric, upper and lower thresholds and enable flag. All MetricInstance
s are stored in MetricsProfile
. Metrics are calculated by MetricsExecutionContextImpl
and the results are stored in MetricsRun
.
Entity
represents a project entity (class, method or field). Each of these entities has a vector of features that contains a subset of metrics from MetricsRun
. Also, each Entity
has a list of relevant properties. RelevantProperties
is a storage of classes, methods, and fields that are somehow related to the original Entity
. Each of these properties has a certain weight.
After metrics calculation is over RefactoringExecutionContext
runs EntitySearcher
to find entities in a given scope. In order to filter unacceptable entities EntitySearcher
uses FinderStrategy
. FinderStrategy
is also responsible for giving initial weights to properties described above. EntitySearcher
produces EntitySearchResult
that stores all found entities with their RelevantProperties
.
Finally, each Algorithm
is being run, receiving EntitySearchResult
as input and producing refactoring suggestions as output.