Skip to content

cpp-linter/clang-tools-docker

Repository files navigation

Clang Tools Docker image

Docker Pulls GitHub Repo Maintenance CI Snyk Container

🐳 The Clang Tools Docker image includes the clang-format and clang-tidy.

You can find all the clang-tools Docker images on Docker Hub registry or GitHub Packages registry.

Supported tags and respective Dockerfile links

How to use clang-tools Docker images

Docker run image

# Check clang-format version
$ docker run xianpengshen/clang-tools:17 clang-format --version
Ubuntu clang-format version 17.0.0 (+rc4-1~exp5ubuntu1)
# Format code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src xianpengshen/clang-tools:17 clang-format --dry-run -i helloworld.c

# Check clang-tidy version
$ docker run xianpengshen/clang-tools:17 clang-tidy --version
Ubuntu LLVM version 17.0.0
  Optimized build.

# Diagnostic code (helloworld.c in the demo directory)
$ docker run -v $PWD:/src xianpengshen/clang-tools:17 clang-tidy helloworld.c \
-checks=boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-cplusplus-*,clang-analyzer-*,cppcoreguidelines-*

As base image in Dockerfile

FROM xianpengshen/clang-tools:17

WORKDIR /src

COPY . .

CMD [ "" ]

Then build and run the Docker image:

$ docker build -t clang-tools .

# Check clang-format version
$ docker run clang-tools clang-format --version
Ubuntu clang-format version 17.0.0 (+rc4-1~exp5ubuntu1)
# Format code
$ docker run clang-tools clang-format --dry-run -i helloworld.c

# Check clang-tidy version
$ docker run clang-tools clang-tidy --version
Ubuntu LLVM version 17.0.0
  Optimized build.
# Diagnostic code
$ docker run clang-tools clang-tidy helloworld.c \
-checks=boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-cplusplus-*,clang-analyzer-*,cppcoreguidelines-*

Have question or feedback?

To provide feedback (requesting a feature or reporting a bug) please post to issues.

License

Apache License