Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude per filename/path regex option #2031

Closed
juju4 opened this issue Feb 11, 2023 · 0 comments
Closed

Exclude per filename/path regex option #2031

juju4 opened this issue Feb 11, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@juju4
Copy link

juju4 commented Feb 11, 2023

Is your feature request related to a problem? Please describe.

There should be an option to exclude by filename/path pattern (wildcard or regex), not just by rule

For example, processing Azure-Sentinel repo and want to exclude invalid test files
Else, get irrelevant warnings/errors ("Error: Failed to deserialize the file")

Example: https://github.com/juju4/Azure-Sentinel/actions/runs/4152879216/jobs/7184135632#step:3:40398

Describe the solution you'd like

Something like pre-commit setting
https://pre-commit.com/#regular-expressions

    -   id: my-hook
        exclude: |
            (?x)^(
                path/to/file1.py|
                path/to/file2.py|
                path/to/file3.py
            )$

from https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#ruleexclude

# YAML: Using the rule/exclude property
rule:
  exclude:
  - Rule3
  - Rule4

# Bash: Using environment variable
export PSRULE_RULE_EXCLUDE='Rule3;Rule4'

# GitHub Actions: Using environment variable
env:
  PSRULE_RULE_EXCLUDE: 'Rule3;Rule4'

# Azure Pipelines: Using environment variable
variables:
- name: PSRULE_RULE_EXCLUDE
  value: 'Rule3;Rule4'

we could have

# YAML: Using the rule/exclude property
file:
  exclude:
  - invalidjson.json
  - *tmp*
  - *.md
  - *.png

# Bash: Using environment variable
export PSRULE_FILE_EXCLUDE='invalidjson.json;*tmp*'

# GitHub Actions: Using environment variable
env:
  PSRULE_FILE_EXCLUDE: 'invalidjson.json;*tmp*'

# Azure Pipelines: Using environment variable
variables:
- name: PSRULE_FILE_EXCLUDE
  value: 'invalidjson.json;*tmp*'

Describe alternatives you've considered

Use rule exclusion but not relevant for known invalid json (error on deserialization)

@juju4 juju4 added the enhancement New feature or request label Feb 11, 2023
@Azure Azure locked and limited conversation to collaborators Feb 12, 2023
@BernieWhite BernieWhite converted this issue into discussion #2033 Feb 12, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant