google / shipshape

Program analysis platform
Apache License 2.0
271 stars 35 forks source link

Shipshape is not actively maintained. The GitHub project has been archived.

Overview of Shipshape

Last updated: 2016-08-29

Build Status

Shipshape is a static program analysis platform that allows custom analyzers to plug in through a common interface. Shipshape is packaged in a docker image. When that image is run, a Shipshape analyzer service starts up and processes analysis requests. Structured analysis results are generated. Shipshape can be run as a command-line interface, or as a Jenkins plugin. The requirements to run are that you are running Linux with docker installed and the source code you want to analyze available on disk.

The source code for Shipshape is located in the "shipshape" directory. Third-party libraries used by Shipshape are all in the "third_party" directory.

Download and Run Shipshape

Shipshape has been tested on Ubuntu (>=14.04) and Debian unstable, but should work on other Linux distributions.

Shipshape requires Docker to run.

Install instructions for Linux.

Install instructions for GCE.

Once you've installed it, running is easy!

$ shipshape <Directory>

For examples for how to use it, see our documentation.

Building from source

Shipshape uses the Bazel build tool. Once you have Docker and Bazel installed, you can build Shipshape with:

$ ./configure
$ bazel build //...

The binary will be saved in bazel-bin/shipshape/cli/shipshape.

Analyzers

The following analyzers are bundled with Shipshape:

Contributed analyzers

The following analyzers were contributed by external developers:

Add a new analyzer

See our documentation on how to create more analyzers of your own. We also have a complete example.

Contributing to shipshape

To contribute to shipshape, first read our contribution guidelines and then make sure you can build and run shipshape from source.

Running the Jenkins Plugin

Instructions are located in shipshape/jenkins_plugin/README.md.

Package Structure of Shipshape

analyzers -- implementation for several simple analyzers run by the go_dispatcher. The canonical simplest analyzer is in analyzers/postmessage

androidlint_analyzer -- implementation for AndroidLint packaged as a complete Shipshape analyzer service, using libraries from the service package

api -- go API used by analyzers running under the go_dispatcher

cli -- code for the CLI that pulls down a Shipshape service, starts it running on a specified directory, and outputs analysis results

docker -- Dockerfiles for the various docker packages produced by Shipshape

java -- code for a javac dispatcher analyzer service that runs analyzers that build off of javac

jenkins_plugin -- code for the jenkins plugin that runs Shipshape

proto -- the protocol buffer APIs for writing new analyzers. Shipshape analyzers are services that implement the rpcs listed in the ShipshapeService interface in proto/shipshape_rpc.proto. Analyzers produce structured output in the form of Note messages, defined in proto/note.proto

service -- core Shipshape code. go_dispatcher -- dispatching Shipshape analyzer service for the go language. calls out to analyzers in the analyzer package. shipshape -- main shipshape service loop driver -- controller for calling out to all passed in analyzer services (including the go_dispatcher and the javac_analyzer) config -- processes .shipshape config files to determine which analyzers run

test -- manual integration tests to simplify the process of running Shipshape locally on test input, useful when developing new analyzer services

util -- various go utilities that simplify Shipshape code, e.g. for working with slices, execing docker commands, or writing tests