feat: allow multiple rule ids and/or filenames - #246
Conversation
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
theseion
left a comment
There was a problem hiding this comment.
Does pre-commit store files in a separate directory (seems weird to me)? If so, ignore my comments about not needing the file path, of course.
Co-authored-by: Max Leske <250711+theseion@users.noreply.github.com>
Address review feedback from theseion: - Remove isPath helper (unnecessary complexity) - Simplify extractBasename to always use filepath.Clean + filepath.Base - Remove filePath from parsedRuleValues struct; compute from assembly dir at call sites instead of supporting arbitrary directories - Remove relative path check block from parseAndValidateArgument - Extract parseChainOffset helper to deduplicate offset parsing logic used in parseRuleIdValidation, parseRuleIdToStruct, and performUpdateAll - Update Long description to drop mention of relative path support - Update test error assertion to match new error message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@copilot resolve the merge conflicts in this pull request |
Integrate multi-rule support (multiple RULE_IDs/filenames) with the new package structure introduced in origin/main. Key changes: - Adapt cmd/regex/update/update.go to use New(cmdContext) factory while keeping multi-rule support (parsedRuleValues, extractBasename, parseAndValidateArgument, parseChainOffset, parseRuleIdToStruct, performUpdateAll, performUpdateMultiple) - Use regexInternal.RunAssemble from the new internal package - Return errors from processRule/updateRegex instead of logger.Fatal - Adapt update_test.go to new package structure (s.cmd.SetArgs instead of rootCmd.SetArgs, s.rootDir instead of s.tempDir) - Take main's version of cmd/regex/compare/compare.go unchanged Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>
Resolved in ce4e5a9. The branch had conflicts with origin/main which refactored the code into new sub-packages (cmd/regex/update/, cmd/regex/compare/, etc.). I've merged the multi-rule support into the new package structure, adapting the tests to use the new package-level test approach (s.cmd.SetArgs instead of rootCmd.SetArgs).
No, pre-commit doesn't store files in a separate directory. It passes the full paths of modified files as arguments. The Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
what
why
references