All Projects → zabio3 → Godolint

zabio3 / Godolint

Licence: other
Dockerfile linter, written in Golang 🐳

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Godolint

Sublimelinter Eslint
This linter plugin for SublimeLinter provides an interface to ESLint
Stars: ✭ 839 (+1398.21%)
Mutual labels:  linter
Ale Sensible
Pretty, responsive and smooth defaults for a sane ALE, gets you started in 30 seconds
Stars: ✭ 30 (-46.43%)
Mutual labels:  linter
Pyflakes
A simple program which checks Python source files for errors
Stars: ✭ 991 (+1669.64%)
Mutual labels:  linter
Pyupgrade
A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
Stars: ✭ 883 (+1476.79%)
Mutual labels:  linter
Rubocop Packaging
A RuboCop extension focused on enforcing upstream best practices and coding conventions.
Stars: ✭ 29 (-48.21%)
Mutual labels:  linter
Prettylint
Run Prettier as a linter
Stars: ✭ 33 (-41.07%)
Mutual labels:  linter
Cuke linter
A linting tool for Cucumber
Stars: ✭ 24 (-57.14%)
Mutual labels:  linter
Format Graphql
Formats GraphQL schema definition language (SDL) document.
Stars: ✭ 55 (-1.79%)
Mutual labels:  linter
Aurora
📦 A set of configs and rules for Typescript projects.
Stars: ✭ 30 (-46.43%)
Mutual labels:  linter
Policial
Review pull requests for style guide violations
Stars: ✭ 36 (-35.71%)
Mutual labels:  linter
Eslint Closure
ESLint Plugin and Config for the Google JavaScript Style Guide
Stars: ✭ 21 (-62.5%)
Mutual labels:  linter
Eryngii
[WIP] Erlang lint and formatter
Stars: ✭ 28 (-50%)
Mutual labels:  linter
Whale Linter
A simple non professional Dockerfile linter
Stars: ✭ 33 (-41.07%)
Mutual labels:  linter
Go Critic
The most opinionated Go source code linter for code audit.
Stars: ✭ 875 (+1462.5%)
Mutual labels:  linter
Devreplay
A linter that replay your developing style
Stars: ✭ 39 (-30.36%)
Mutual labels:  linter
Bpmn Js Bpmnlint
A bpmnlint plug-in for bpmn-js.
Stars: ✭ 26 (-53.57%)
Mutual labels:  linter
Wartremover
Flexible Scala code linting tool
Stars: ✭ 956 (+1607.14%)
Mutual labels:  linter
Clj Kondo
A linter for Clojure code that sparks joy.
Stars: ✭ 1,083 (+1833.93%)
Mutual labels:  linter
Validator
Nu Html Checker – Helps you catch problems in your HTML/CSS/SVG
Stars: ✭ 1,024 (+1728.57%)
Mutual labels:  linter
Vale
📝 A syntax-aware linter for prose built with speed and extensibility in mind.
Stars: ✭ 978 (+1646.43%)
Mutual labels:  linter

godolint

GitHub release Actions Status Golang CI Go Report Card GoDoc Maintainability MIT License

A Dockerfile linter that helps you build best practice Docker images (inspired by Haskell Dockerfile Linter). For static analysis of AST, moby/buildkit parser is used, and lint check is done. This tool performs docker rule checks based on the parsed AST.

Dependency

Usage

You can run godolint locally to lint your Dockerfile.

$ godolint <Dockerfile>
Example

To check Dockerfile

$ godolint testdata/DL3000_Dockerfile
#3 DL3000 Use absolute WORKDIR. 

$ godolint testdata/DL3001_Dockerfile
#6 DL3001 For some bash commands it makes no sense running them in a Docker container like `ssh`, `vim`, `shutdown`, `service`, `ps`, `free`, `top`, `kill`, `mount`, `ifconfig`. 

Options

You can set some options:

Available options:
  --ignore RULECODE     A rule to ignore. If present, the ignore list in the
                        config file is ignored

Other Commands:
  --help        -h      Help about any command
  --version     -v      Print the version information
Example

To check Dockerfile (exclude specific rules).

$ godolint --ignore DL3000 testdata/DL3000_Dockerfile

Install

You can download binary from release page and place it in $PATH directory.

Or you can use go get

$ go get github.com/zabio3/godolint

Rules

An implemented rules. (Dockerfile lint rule provided by hadolint)

Rule Description
DL3000 Use absolute WORKDIR.
DL3001 For some bash commands it makes no sense running them in a Docker container like ssh, vim, shutdown, service, ps, free, top, kill, mount, ifconfig.
DL3002 Last user should not be root.
DL3003 Use WORKDIR to switch to a directory.
DL3004 Do not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root.
DL3005 Do not use apt-get upgrade or dist-upgrade.
DL3007 Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag.
DL3006 Always tag the version of an image explicitly.
DL3008 Pin versions in apt-get install.
DL3009 Delete the apt-get lists after installing something.
DL3010 Use ADD for extracting archives into an image.
DL3011 Valid UNIX ports range from 0 to 65535.
DL3012 Provide an email address or URL as maintainer. (This rule is DEPRECATED and no longer active)
DL3013 Pin versions in pip.
DL3014 Use the -y switch.
DL3015 Avoid additional packages by specifying --no-install-recommends.
DL3016 Pin versions in npm.
DL3017 Do not use apk upgrade.
DL3018 Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>.
DL3019 Use the --no-cache switch to avoid the need to use --update and remove /var/cache/apk/* when done installing packages.
DL3020 Use COPY instead of ADD for files and folders.
DL3021 COPY with more than 2 arguments requires the last argument to end with /.
DL3022 COPY --from should reference a previously defined FROM alias.
DL3023 COPY --from cannot reference its own FROM alias.
DL3024 FROM aliases (stage names) must be unique.
DL3025 Use arguments JSON notation for CMD and ENTRYPOINT arguments.
DL4000 MAINTAINER is deprecated.
DL4001 Either use Wget or Curl but not both.
DL4003 Multiple CMD instructions found.
DL4004 Multiple ENTRYPOINT instructions found.
DL4005 Use SHELL to change the default shell.
DL4006 Set the SHELL option -o pipefail before RUN with a pipe in it.

AST

Dockerfile syntax is fully described in the Dockerfile reference. Just take a look at moby/buildkit in the language-docker project to see the AST definition.

Contribution

Contributions are of course always welcome!

  1. Fork zabio3/godolint (https://github.com/zabio3/godolint/fork)
  2. Run go get to install dependencies
  3. Create a feature branch
  4. Commit your changes
  5. Run test using go test ./...
  6. Create a Pull Request

See CONTRIBUTING.md for details.

Build Docker Image

  1. Run make docker
  2. Create a new tag for that release (in this example 0.1.2): docker tag zabio3/godolint zabio3/godolint:v0.1.2
  3. Push to Docker hub: docker push zabio3/godolint zabio3/godolint:v0.1.2
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].