Giter Site home page Giter Site logo

cpp-linter / clang-tools-docker Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 125 KB

๐Ÿณ Clang Tools Docker image includes the clang-format and clang-tidy.

Home Page: https://hub.docker.com/r/xianpengshen/clang-tools

License: Other

Dockerfile 22.03% Makefile 37.22% HCL 40.75%
clang-format clang-tidy code-formatter clang-tools-extra clang-tool llvm-clang llvm-tools docker-image cpp-linter

clang-tools-docker's Introduction

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

clang-tools-docker's People

Contributors

dependabot[bot] avatar shenxianpeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

clang-tools-docker's Issues

Update GitHub Packages registry from shenxianpeng to cpp-linter

Since I have transferred this docker image repo to cpp-linter, I should also update the registry account to cpp-linter.

I also want to do a download docker images performance test comparison.

  • Download form Docker hub
  • Download from GitHub package registry

To see if could reduce the download image time of cpp-linter-action project.

Update Dockerfiles to fix issues reported by hadolint

For example:

sh-4.2$ make lint FILE=11/Dockerfile 
echo 11/Dockerfile
11/Dockerfile
== Linting 11/Dockerfile...
Output Lint results
-:5 DL3015 info: Avoid additional packages by specifying `--no-install-recommends`
-:5 SC2086 info: Double quote to prevent globbing and word splitting.
make: *** [lint] Error 1

LLVM's clang license agreement

I was just reading through part 4 of the Apache License distributed with clang software. I think you need to include a copy of that License (you may keep your MIT License in addition) with this repo because you're (in a way) distributing clang software.

Maybe docker images are an exception to this (a copy of the License should already be in the built docker image), but it would probably be safer to do it anyway (there are stipulations about redistributing in either "source" or "object" forms).

System.IO.IOException: No space left on device

https://github.com/cpp-linter/clang-tools-docker/actions/runs/8246898893

[build](https://github.com/cpp-linter/clang-tools-docker/actions/runs/8246898893/job/22553930490)
System.IO.IOException: No space left on device : '/home/runner/runners/2.314.1/_diag/Worker_20240312-100158-utc.log'
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
   at GitHub.Runner.Worker.Worker.RunAsync(String pipeIn, String pipeOut)
   at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args)
System.IO.IOException: No space left on device : '/home/runner/runners/2.314.1/_diag/Worker_20240312-100158-utc.log'
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
   at GitHub.Runner.Common.Tracing.Error(Exception exception)
   at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args)
Unhandled exception. System.IO.IOException: No space left on device : '/home/runner/runners/2.314.1/_diag/Worker_20240312-100158-utc.log'
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at System.Diagnostics.TraceSource.Flush()
   at GitHub.Runner.Common.TraceManager.Dispose(Boolean disposing)
   at GitHub.Runner.Common.TraceManager.Dispose()
   at GitHub.Runner.Common.HostContext.Dispose(Boolean disposing)
   at GitHub.Runner.Common.HostContext.Dispose()
   at GitHub.Runner.Worker.Program.Main(String[] args)

Change ENV variable to `CLANG_VERSIONS` in Dockerfiles

Based on @2bndy5's proposal in the issue cpp-linter/cpp-linter-action#73

@shenxianpeng It might be easier to identify when using the docker at runtime if the docker image set a environment variable. We could probably do this from the action.yml in this repo, but it might be good to have in the docker container.

If we could more easily identify when the docker is in use (at runtime), then we can make this path prepending conditional on the presence of the docker workspace.

To meet the above needs and have a specific ENV variable name, we don't need to add a new one, just change the current ENV from VERSIONS to CLANG_VERSIONS should be OK.
https://github.com/cpp-linter/clang-tools/blob/c864e94186fd1fce17fd12775636b9cf507c5243/all/Dockerfile#L5
https://github.com/cpp-linter/clang-tools/blob/c864e94186fd1fce17fd12775636b9cf507c5243/all/Dockerfile#L15

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.