Skip to content

Allow text in ignore comments #1028

Closed
@avazhnov-twilio

Description

@avazhnov-twilio
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Currently such syntax is supporting by hadolint for Inline ignores:

# hadolint ignore=DL3003,SC1035

When I use Shellcheck, I prefer expanding a comment with text description, which is more human-readable:

# shellcheck disable=SC1091  # File not included in mock

Can we have similar logic for hadolint: to ignore whitespaces and custom text (for example, starting with #) in the same line after ignore=ID1,ID2?

Expected behavior

Line

# hadolint ignore=SC1091  # File not included in mock

makes hadolint ignore SC1091 in the next line.

Actual behavior

Code

# hadolint ignore=SC1091  # File not included in mock
RUN python3 -m venv .venv && . .venv/bin/activate && pip3 install --no-cache-dir -r requirements.txt

gives a message like: "Dockerfile:7 SC1091 info: Not following: File not included in mock."

Steps to reproduce the behavior

Create a Dockerfile like

FROM python:3

RUN groupadd -r myapp && useradd --no-log-init --system --gid myapp --create-home myapp
USER myapp

# hadolint ignore=SC1091  # File not included in mock
RUN python3 -m venv .venv && . .venv/bin/activate && pip3 install --no-cache-dir -r poetry

Check it with hadolint, it will give you a message: "Dockerfile:7 SC1091 info: Not following: File not included in mock."

Output of hadolint --version:

Haskell Dockerfile Linter 2.12.0

Dockerfile (if relevant)

# hadolint ignore=SC1091  # File not included in mock
RUN python3 -m venv .venv && . .venv/bin/activate && pip3 install --no-cache-dir -r requirements.txt

Additional environment details (OS, stack version, etc.)

Probably my request may also close #997.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions