GithubHelp home page GithubHelp logo

sylvainlaurent / docker-intellij-inspect Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 32 KB

docker image to help running IntelliJ inspections

License: Apache License 2.0

Java 63.84% Shell 36.16%
nullability-analysis docker docker-image intellij-inspections

docker-intellij-inspect's Introduction

docker image to help running IntelliJ inspections.

docker hub

It includes

  • IntelliJ CE 2017.3
  • bentolor/idea-cli-inspector to launch the inspection and analyze the result
  • a predefined jdk.table.xml that declares a unique JDK named 1.8 (that can be referenced for analysis)

How to build the image?

cd src/main/docker
docker build --tag intellij-inspect:latest .

How to run?

  • (assuming a macOS or Linux machine, it should also work on Windows with some adaptations to the commands)
  • open a shell at the root of the IntelliJ project you want to analyze
  • either
  • launch a one-off docker container, mapping the following volumes:
    • the idea project to be inspected on the host to the /home/ijinspector/idea-project directory in the container
    • the host maven repository to the /home/ijinspector/.m2/repository directory in the container. Note that the maven dependencies must have previously been downloaded on the host. If some dependency is not available during the inspection, you'll see errors like Please configure library 'Maven:....

Example:

docker run -it --rm -v `pwd`:/home/ijinspector/idea-project -v ~/.m2/repository:/home/ijinspector/.m2/repository docker-intellij-inspect

(notice the `pwd` command which allows to have the full path of the current directory as required by docker to map a volume to a directory on the host)

The docker command returns when the inspection and result analysis is done and has the same result code as bentolor/idea-cli-inspector.

How to use external annotations

IntelliJ inspections are quite powerful but can be even more so when using external annotations for third-party libraries or the JDK. Here are the requirements:

  • JDK annotations must be available in /home/ijinspector/idea-jdk-external-annotations inside the docker container. This path is set in jdk.table.xml that is built in the image.
  • annotations for libraries must also be available inside the container. Usually a path relative to the IntelliJ project is used, such as file://$PROJECT_DIR$/../intellij-external-annotations (see this example file. Thus, you can bind the annotations directory to /home/ijinspector/intellij-external-annotations inside the container.

The following docker-compose.yml is an example (for a maven project):

version: '3'
services:
  inspect:
    image: intellij-inspect:latest
    volumes:
      - .:/home/ijinspector/idea-project:ro
      - ~/.m2/repository:/home/ijinspector/.m2/repository
      - ../intellij-external-annotations:/home/ijinspector/idea-jdk-external-annotations:ro
      - ../intellij-external-annotations:/home/ijinspector/intellij-external-annotations:ro
    command: 
      - --rootfile
      - /home/ijinspector/idea-project/pom.xml
      - --profile
      - CLI_inspection_profile.xml

Future work

  • automatically reference external annotations in modules *.xml files if not provided in the inspected repository (e.g. fresh git checkout and files in .gitignore)

docker-intellij-inspect's People

Contributors

sylvainlaurent avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

docker-intellij-inspect's Issues

Join sylvainlaurent/docker-intellij-inspect with idea-cli-inspector

Hello @sylvainlaurent

In bentolor/idea-cli-inspector#16 you mentioned that you were working on building a Docker-based implementation for idea-cli-inspector.

Unfortunately I totally missed to keep that in mind or track your repository. Later on I realized, how much benefit user have in being able to use Docker container to run the idea inspections. Lately I struggled with very low effort and priority to create my own Docker-based version which also would be available on Docker Hub.

I got the basic things running including the first automatic builds & publishing of bentolor/idea-cli-inspector on Docker Hub. Rather by accident stumbled again over your issue and your comment that you had already done the same. Damn!

On browsing your solution I realized, that your solution is by far superior in term of implementation depth and quality. Instead of further replicating work I'd love to join forces, though I looks to me that you are no longer using/maintaining your version.

It would be great if a Docker container could help to support IDEA inspection get more traction within the CI space. My current scope / focus is to enable the Ultimate edition features so that users with valid licenses can directly use a container to inspect their changes.

Do you think it would be better to join & further enhance your solution or to port / merge our two approaches?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.