A service for assisted code review, that allows running custom code Analyzers on pull requests.
- Configuring lookout
- Usage
- Available Analyzers
- SDK for Analyzer Developers
- Development
- Contribute
- Code of Conduct
- License
Please refer to the Configuring lookout guide for documentation for the config.yml
file.
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
Go to the lookout releases page and download the latest lookoutd
and dummy
binaries from there.
lookout needs a running instance of:
- bblfshd to parse files into UAST.
- PostgreSQL.
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.
Following these steps you will be able to run separately the lookout dependencies, analyzers and the server itself.
-
Run the dependencies manually or using docker-compose, executing:
$ docker-compose up bblfsh postgres
-
Initialize the database.
This command will work for the PostgreSQL created by docker-compose, use-h
to see other options.$ lookoutd migrate
-
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
-
Copy the
config.yml.tpl
intoconfig.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. -
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
Note: This is a work in progress feature.
Please refer to the Running in Distributed Mode guide for documentation on the advanced distributed deployment.
This is a list of the available analyzers for lookout:
Name | Description | Maturity level |
---|---|---|
style-analyzer | Code style analyzer | development |
gometalint | Reports gometalinter results on pull requests | testing and demo |
sonarcheck | An analyzer that uses bblfsh UAST and sonar-checks to process pull requests | testing and demo |
terraform | An analyzer that checks if Terraform files are correctly formatted | usable |
If you are developing an Analyzer, please check the SDK documentation.
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
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
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 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.
Contributions are more than welcome, if you are interested please take a look at our Contributing Guidelines.
All activities under source{d} projects are governed by the source{d} code of conduct.
Affero GPL v3.0, see LICENSE.