Exclude per filename/path regex option #2033
-
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 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
from https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#ruleexclude
we could have
Describe alternatives you've considered Use rule exclusion but not relevant for known invalid json (error on deserialization) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@juju4 Thanks for raising an issue. I think we can answer this one as a question so I've move it here so that it might help others in the community. I believe the option you are looking for is Input.PathIgnore. This option uses the same format as a git path spec, which is not strictly a regular expression but should meet most requirements. For example: input:
pathIgnore:
- invalidjson.json
- *tmp*
- *.md
- *.png Which also means you can do this: input:
pathIgnore:
# Remove all files
- '*'
# Add back files that are interesting
- '!**/deploy.bicep' Another example is here: https://azure.github.io/PSRule.Rules.Azure/using-bicep/#using-parameter-files Is this what you are after? |
Beta Was this translation helpful? Give feedback.
@juju4 Thanks for raising an issue. I think we can answer this one as a question so I've move it here so that it might help others in the community.
I believe the option you are looking for is Input.PathIgnore.
This option uses the same format as a git path spec, which is not strictly a regular expression but should meet most requirements.
For example:
Which also means you can do this:
Another example is here: https://azure.github.io/PSRule.Rules.Azure/using-bicep/#using-parameter-files
Is this what you are…