{"id":21001490,"url":"https://github.com/divio/lint","last_synced_at":"2026-04-29T07:32:35.291Z","repository":{"id":191656771,"uuid":"684992333","full_name":"divio/lint","owner":"divio","description":"Docker-packaged linting tools with sensible defaults.","archived":false,"fork":false,"pushed_at":"2024-06-13T15:10:10.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-01T02:38:13.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/divio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-30T09:27:15.000Z","updated_at":"2024-06-13T15:05:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"3b822f77-4feb-4895-ae7d-119c094620ed","html_url":"https://github.com/divio/lint","commit_stats":null,"previous_names":["divio/lint"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/divio/lint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divio%2Flint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divio%2Flint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divio%2Flint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divio%2Flint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divio","download_url":"https://codeload.github.com/divio/lint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divio%2Flint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32416145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T08:15:31.548Z","updated_at":"2026-04-29T07:32:35.276Z","avatar_url":"https://github.com/divio.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linter\n\nDocker-packaged linting tools with sensible defaults.\n\n\u003c!-- TOC start (generated with https://github.com/derlin/bitdowntoc) --\u003e\n\n- [Available linters](#available-linters)\n- [Usage](#usage)\n  * [Using it with bash](#using-it-with-bash)\n  * [Using it with make](#using-it-with-make)\n  * [Running from a pre-commit hook](#running-from-a-pre-commit-hook)\n- [Options](#options)\n  * [Environment variables](#environment-variables)\n  * [Script options](#script-options)\n- [Ruff configuration](#ruff-configuration)\n- [Development](#development)\n  * [Build the docker image](#build-the-docker-image)\n\n\u003c!-- TOC end --\u003e\n\n## Available linters\n\nThe following linters are available:\n\n* `docker`: runs [hadolint](https://github.com/hadolint/hadolint)\n* `python`: runs [ruff](https://github.com/astral-sh/ruff)\n\nEach tool is configured with sensible defaults adopted at [Divio](https://divio.com/), except ruff\nwhich requires a manual setup (see [Ruff configuration](#ruff-configuration)).\n\n## Usage\n\n### Using it with bash\n\nUse the following:\n```bash\nalias lint=\"docker run --rm -it --env-file=.lint -v $(pwd):/app divio/lint /bin/lint\"\n\n# Normal\nlint\n# Only check, do not fix\nlint --check\n# Apply unsafe fixes (python/ruff only)\nmake lint --unsafe-fixes\n# Only run hadolint\nmake --run=docker\n```\n\nFor an example of `.lint` file, see [Environment variables](#environment-variables).\n\n\n### Using it with make\n```\nlint:\n\tdocker run -it --rm --env-file=.lint -v $(PWD):/app divio/lint /bin/lint ${ARGS}\n```\n\n```bash\n# Normal\nmake lint\n# Only check, do not fix\nmake lint ARGS=--check\n# Apply unsafe fixes (python/ruff only)\nmake lint ARGS=\"--unsafe-fixes\"\n# Only run hadolint\nmake lint ARGS=\"--run=docker\"\n```\n\nFor an example of `.lint` file, see [Environment variables](#environment-variables).\n\n### Running from a pre-commit hook\n\nIf the container is invoked with `--staged`, it will only run on files\nthat are staged for commit. This implies `--check` because it needs to\noperate on temporary copies of the affected files since the working tree\nmight contain further changes not staged for commit. This is a faster\nversion suitable for running from a pre-commit hook.\n\n## Options\n\n### Environment variables\n\nEach language has a matching environment variable, which should be the **relative** path to source\nfiles. Only linters with the corresponding environment variable defined will run.\n\n_Note_: the linters will be executed in the `/app`` working directory, unless `--staged`` is used.\nIn this case, the files are copied to a temporary directory before linting (this implies `--check`).\n\nExample:\n```\nLINT_FILE_DOCKER=Dockerfile\nLINT_FOLDER_PYTHON=src\nLINT_FOLDER_SCSS=private/sass/**/*.scss\nLINT_FOLDER_JS=static/js/**/*.js\n```\n\n### Script options\n\nThe following options are available for the `/bin/lint` script:\n\n* `-c / --check`: only check compliance, do not automatically fix errors\n* `--staged`: only run against files staged for commit, useful for pre-commit hooks. Note that it\n  implies `--check`.\n* `--run`: only run a subset of linters. `--run=all` is equivalent to `--run=python,docker`.\n\n## Ruff configuration\n\nLinting Python files is done with [ruff](https://beta.ruff.rs/docs/).\nTo use the existing Divio preset, add the following to your `pyproject.toml`:\n\n```toml\n[tool.ruff]\n    extend = \"/presets/ruff.toml\"\n```\n\nYou can modify the rules selected and ignored using the `extend-*` properties (see documentation).\n\nNote that the `isort` presets will be overridden if you provide your own `tool.ruff.isort` section.\nHere is an example of a valid isort configuration you could use:\n\n```toml\n[tool.ruff]\n   # ...\n\n    [tool.ruff.lint.isort]\n        # keep thos defaults\n        lines-after-imports = 2\n        lines-between-types = 0\n        # order of imports, you can addd sections are required\n        section-order = [\"future\", \"standard-library\", \"django\", \"drf\", \"third-party\", \"first-party\", \"project\", \"local-folder\"]\n\n    # define the sections used in the section-order\n    [tool.ruff.lint.isort.sections]\n        django = [\"django\"]\n        drf=[\"rest_framework\"]\n        project=[\"my_project\", \"accounts\"]\n```\n\n\n## Development\n\n### Build the docker image\n\nThis image needs to support both AMD and ARM.\n\n**development**\n\nDuring development, use (tip - use `make -n` to see the command without running it):\n```bash\n# Build for amd64\nmake build\n# Build for arm64\nmake build TARGET=arm64\n```\n\nDon't forget to test both platforms (`docker run ...`)!\n\nOnce you know it works for both platforms, you can build a multi-arch image using\nbuildkit.\n\nFirst, create a builder if you haven't done so already (check with `docker buildx ls`):\n```bash\n# create a builder. Run this only once!\ndocker buildx create --name builder\n\n# use the builder\ndocker buildx use builder\n```\n\nOnce you have the builder selected, you can run the following:\n```bash\n# Test the build\nmake build_multiarch\n```\n\nIf all seems fine, it is time to release and push to DockerHub.\nCreate a new tag with the version (e.g. `0.8`) and push (`git push --tags`).\nThe GitLab pipeline will do the rest (see `.gitlab-ci.yml` for more info).\n\nYou can now go back to the \"default\" builder by running: `docker buildx use default`.\n\n\n(**NOTE**: you can also manually push to DockerHub, but this is **NOT** recommended:\n`make push_multiarch VERSION=0.7`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivio%2Flint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivio%2Flint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivio%2Flint/lists"}