Skip to content

Conversation

quixoticmonk
Copy link
Contributor

@quixoticmonk quixoticmonk commented Sep 7, 2025

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

This PR fixes a regex compilation error in the Terraform module finder when using character classes in --skip-path patterns. The issue occurred when users provided regex patterns with character classes (like [a-z0-9-]+) in the excluded_paths parameter, causing the module finder to crash with a regex compilation error.

The fix changes the regex handling approach from compiling all patterns into a single regex to compiling each pattern individually and handling invalid regex patterns by skipping them.

Fixes #7290

Should the test structure be changed to use a terraform configuration from a directory than inline?

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

@bo156
Copy link
Contributor

bo156 commented Sep 10, 2025

Thanks for the contribution @quixoticmonk!
Could you rebase your branch so the tests will run? I could do it for you just didn't want to cause conflicts in your side :)

@bo156
Copy link
Contributor

bo156 commented Sep 17, 2025

@quixoticmonk I see that the unit tests failed here, could you push a fix? 🧪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skip-path regex parsing broken

2 participants