Skip to content

Support ignore file tests if provided files (rather than directories) to test #1318

Description

@ohookins

If I do something like this:

conftest test --combine --parser hcl2 --ignore '.*/provider.tf' deployments/**/*.tf

I would expect that the ignore regex is evaluated for all of the files that are evaluated. Instead, only directories that conftest walks itself are evaluated for ignore via the regex: https://github.com/open-policy-agent/conftest/blob/master/runner/test.go#L133-L143

This affects usage whether the regex is provided on the command line or in the configuration file. The fix would just be to evaluate the regex match before adding the file to the files slice (currently on line 141 above).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions