Skip to content
/ lookout Public

Assisted code review, running custom code analyzers on pull requests

License

Notifications You must be signed in to change notification settings

src-d/lookout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lookout Build Status GoDoc Code Coverage Go Report Card development

A service for assisted code review, that allows running custom code Analyzers on pull requests.

Table of Contents

Configuring lookout

Please refer to the Configuring lookout guide for documentation for the config.yml file.

Usage

Running lookout with docker-compose

Using Docker Compose you can use the provided docker-compose.yml config file to start lookout, its dependencies (bblfsh and PostgreSQL) and the dummy analyzer which will add some stats to the watched pull requests.

To do so, clone this repository or download docker-compose.yml.

Create the config.yml file in the same directory where docker-compose.yml is, and run:

$ docker-compose pull
$ GITHUB_USER=<user> GITHUB_TOKEN=<token> docker-compose up --force-recreate

If you need to restart the database to a clean state, you can do so with:

$ docker rm lookout_postgres_1

Running lookout from Binaries

Installation

The following command will install the binaries lookoutd, lookout-sdk, and dummy.

$ go get github.com/src-d/lookout/...

Dependencies

lookout needs a running instance of:

You will also need to configure external Analyzers, that will perform the actual processing of the pull requests. You may use the included dummy Analyzer for testing purposes.

Quickstart

Following these steps you will be able to run separately the lookout dependencies, analyzers and the server itself.

  1. Run the dependencies manually or using docker-compose, executing:

    $ docker-compose up bblfsh postgres
  2. Initialize the database.
    This command will work for the PostgreSQL created by docker-compose, use -h to see other options.

    $ lookoutd migrate
  3. Start an analyzer before running lookout.
    You can use the dummy one as it is provided by this repository; to do so just run:

    $ dummy serve
  4. Copy the config.yml.tpl into config.yml and add the URLs of the repositories to be watched. Take a look at configuration and GitHub authentication for more details about lookout configuration.

  5. Start lookout server
    If you want to post the analysis results on GitHub, run:

    $ lookoutd serve --github-token <token> --github-user <user>

    If you want to avoid posting the analysis results on GitHub, and only print them, run:

    $ lookoutd serve --dry-run

SDK for Analyzer Developers

If you are developing an Analyzer, please check the SDK documentation.

Development

Build

You can separately build the binaries provided by lookout; the binaries will be stored under build/bin directory.

server:

$ make build

lookout-sdk:

$ make -f Makefile.sdk build

dummy analyzer:

$ make -f Makefile.dummy build

Code generation

To generate go code from kallax models, run:

$ go generate ./...

To update go-bindata with the new migration files:

$ kallax migrate --input ./store/models/ --out ./store/migrations --name <name>
$ make dependencies
$ make bindata

Testing

For unit-tests run:

$ make test

For lookout-sdk integration tests (-short will skip tests that require bblfsh):

$ make test-sdk
$ make test-sdk-short

For lookoutd serve integration tests:

$ make test-json

Dummy Analyzer Release

Dummy analyzer is a simple analyzer implementation example. It is part of the lookout codebase but it's release cycle is managed independently from main one.

To release a new version and publish the dummy analyzer container you need to create a tag with the dummy prefix, e.g. dummy-v0.0.1. Please note this doesn't require to do a GitHub release, we just need the Git tag.

A normal release tag will not publish this container.

Contribute

Contributions are more than welcome, if you are interested please take a look at our Contributing Guidelines.

Code of Conduct

All activities under source{d} projects are governed by the source{d} code of conduct.

License

Affero GPL v3.0, see LICENSE.