Skip to content

Ability to supply "Severity" levels for rules #174

@amthorn

Description

@amthorn

Running in CI pipelines typically uses the exit code to determine if a step has failed. In some cases, some rules from dockerfilelint may be permissable by some projects. Thus, dockerfilelint should expose in it's RC file the ability to specify a severity level (Similar to eslint perhaps) instead of just a boolean "on/off". This way, variations of rules can be configured for individual use cases.

Perhaps something like:

rules:
  uppercase_commands: "ERROR"
  expose_port_valid: "WARNING"
  label_format: "INFO"
  base_image_tag: on

If issues are found of severity level INFO/WARNING, then this should keep the exit code at 0. However, if at least one issue is found that has a severity level of error, the exit code should be > 0.

The default severity level, if not provided or using the old "on/off" syntax, should be ERROR to maintain backward compatibility.

I've solved this issue in my fork here: https://github.com/amthorn/dockerfilelint/tree/specify_severity

I'll submit a PR as soon as #172 is reviewed/merged as there is a dependency on that PR. Here's the diff: amthorn/dockerfilelint@add_custom_rulesets...amthorn:specify_severity

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