options: disable ignore pragma#748
Conversation
- Add new configuration option allowing to disable inline ignore pragmas - Add new rule DL1001 to allow warning on use of an inline ignore pragma Inline ignore pragmas `# hadolint ignore=DLxxxx` can cause trouble in organizations when it is not desirable that individual developers circumvent centralized CI checks. This configuration options allows (e.g. in such a CI pipeline) to just ignore the pragma and apply all rules as usual. The option can be enabled via command line `--disable-ignore-pragma`, environment variable `HADOLINT_DISABLE_IGNORE_PRAGMA=1`, or config file ```yaml disable-ignore-pragma=true ``` Just to prevent any confusion about the ignored pragma, the rule DL1001 can be used to fail the linting process regardless of how the dockerfile fares, if desired. By default DL1001 is ignored but can be enabled by setting its severity to the desired level (e.g. via command line option `--warning=DL1001`). Changes in the test suite: - Add tests for `disable-ignore-pragma` options - Add tests for rule DL1001 - Remove pointless configuration test for content of default configuration - Change configuration tests to a more compact syntax relying on the default instance By changing the manual construction of configuration values to utilize the default instance, future changes to the configuration do not necessitate many error prone changes to the test suite. This imporves reliability and ease of use of the configuration test suite. fixes: hadolint#747
|
This sounds like good idea, however I think we should not have it as default as it would change current behaviour and I think it can lead to confusion for many users. What about having |
|
Hi @zemanlx , The default behavior for Hadolint has not changed at all. But you can have Hadolint inform you about encountered ignore pragmas, you can also have Hadolint ignore these pragmas, or both. Each configuration with an optional setting. |
|
@m-ildefons Oh, I see. I was reading it on my mobile phone and the wrong way (like disable ignoring of pragmas, not disable the ignore type of pragmas). This looks good to me. Sorry for the confusion. |
|
@m-ildefons looks great! |

Inline ignore pragmas
# hadolint ignore=DLxxxxcan cause trouble inorganizations when it is not desirable that individual developers
circumvent centralized CI checks. This configuration options allows
(e.g. in such a CI pipeline) to just ignore the pragma and apply all
rules as usual. The option can be enabled via command line
--disable-ignore-pragma, environment variableHADOLINT_DISABLE_IGNORE_PRAGMA=1, or config filedisable-ignore-pragma=trueJust to prevent any confusion about the ignored pragma, the rule DL1001
can be used to fail the linting process regardless of how the dockerfile
fares, if desired. By default DL1001 is ignored but can be enabled by
setting its severity to the desired level (e.g. via command line option
--warning=DL1001).Changes in the test suite:
disable-ignore-pragmaoptionsconfiguration
default instance
By changing the manual construction of configuration values to utilize
the default instance, future changes to the configuration do not
necessitate many error prone changes to the test suite. This imporves
reliability and ease of use of the configuration test suite.
fixes: #747