For detailed information about the different parts of source{d} Lookout, and how they interact you can go to the source{d} Lookout Architecture guide.
For information about how to create your own Analyzer, go to the source{d} Lookout Analyzer Creation guide.
Essentially, an analyzer is just a gRPC server that will be called by source{d} Lookout using protocol buffers whenever a Pull Request is ready to be analyzed, or it is updated.
To do so, the analyzer must implement Analyzer service interface:
service Analyzer {
rpc NotifyReviewEvent (ReviewEvent) returns (EventResponse);
rpc NotifyPushEvent (PushEvent) returns (EventResponse);
}
To process the Pull Request, the analyzer can request a stream (go, python) of files and changes from source{d} Lookout DataService that source{d} Lookout exposes, by default, on localhost:10301
.
The main responsibility of the Analyzer will be the NotifyReviewEvent
procedure, called from source{d} Lookout server when a Pull Requests should be reviewed.
The ReviewEvent
will cause the analysis of the Pull Request by the Analyzer; the result of the analysis will be an EventResponse
containing the Comments
to be posted to GitHub.
Important note: The response for NotifyPushEvent
allows a series of Comments
, but this is a placeholder for future functionality. The Analyzer is not expected to return any comment in the current version.
The NotifyPushEvent
procedure is called from source{d} Lookout server when there are new commits pushed to any watched repository.
The Analyzer is not enforced to do anything with this notification. It could be used, for example, to re-train an internal model using the new contents of the master branch.