[JAVA] Run static analysis Infer in Windows environment

Facebook OSS static analysis tool "infer" http://fbinfer.com/ java analyzes where (potentially) a slimy spot occurs and about memory leaks. In the analysis of Nullpo, it seems to be much stronger than findbugs, so I wanted to put it in, but it is not compatible with Windows. There was docker for the time being, so I managed to run it with docker-toolbox.

Premise

Introduction of docker-toolbox

https://www.docker.com/products/docker-toolbox Get from here

Get Dockerfile

Create an infer directory directly under C (anywhere else is OK)

Start Docker Quickstart Terminal.

Get the Dockerfile and launch shell.

$ curl https://raw.githubusercontent.com/facebook/infer/master/docker/Dockerfile > /c/infer/Dockerfile
$ curl https://raw.githubusercontent.com/facebook/infer/master/docker/run.sh > /c/infer/run.sh

Is the Dockerfile buggy when you hit the shell as it is? (As of June 9, 2017) It will fail, so I will modify the Dockerfile a little. Modified as below

# Base image
FROM buildpack-deps:xenial-curl

MAINTAINER I2

# Debian config
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
            aspcud \
            autoconf \
            automake \
            gcc \
            g++ \
            git \
            groff-base \
            libc6-dev \
            libgmp-dev \
            libmpc-dev \
            libmpfr-dev \
            m4 \
            make \
            ncurses-dev \
            ocaml \
            opam \
            openjdk-8-jdk-headless \
            pkg-config \
            python2.7 \
            rsync \
            unzip \
            zlib1g-dev && \
    rm -rf /var/lib/apt/lists/*

# Download the latest Infer release
RUN git clone https://github.com/facebook/infer.git

RUN cd infer && ./build-infer.sh java

ENV PATH $PATH:/infer/infer/bin

Create and start docker-image

Hit the shell

$ cd /c/infer
$ ./run.sh

Wait a long time. It will move.

You can pass it through example, but if you clone it from git, you can analyze it for existing projects.

What to do from now on

I want to write another article about how the analysis of Nullpo is amazing

Recommended Posts

Run static analysis Infer in Windows environment
Self-hosting with Docker of AuteMuteUs in Windows environment
Static code analysis with Checkstyle in Java + Gradle
[Rails] Run LINEBot in local environment using ngrok
Cross-compile Qt – GUI Windows Application in Ubuntu 18.04 MinGW environment
Beginners use ubuntu in windows to prepare rails environment
Penronse environment construction [Windows]
Install / run a standalone robot simulator in wsl2 / docker environment!
Resolve CreateProcess error = 206 when running Java in a Windows environment
Use Java Web Start in an OpenJDK environment on Windows
Zip compression with Java in Windows environment without garbled characters