Replies: 5 comments
|
Hi @ckappgit — thanks for the kind words, and for raising this. It's a great question worth a clear answer. A small clarification first: OCR's rule matching isn't tied to file extensions. Patterns are matched against the full repo-root-relative path using doublestar glob syntax ( The full glob reference and the rule-resolution priority chain are in our docs: https://open-codereview.ai/docs/review-rules One practical detail: Recipe 1 — distinct rules by directorySay Qt files live under {
"include": ["**/*.ui"],
"rules": [
{ "path": "**/{qt,forms}/**/*.ui", "rule": "Qt Designer: check widget object names, signal/slot connections, layout margins, .ui version." },
{ "path": "**/ui/**/*.ui", "rule": "GTK GtkBuilder: check object IDs, signal handlers, accessible roles, translatable strings." }
]
}Recipe 2 — distinct rules by filename conventionIf the files share a directory but follow a naming pattern: {
"include": ["**/*.ui"],
"rules": [
{ "path": "**/*_qt.ui", "rule": "Qt UI rules…" },
{ "path": "**/*_gtk.ui", "rule": "GTK UI rules…" }
]
}Recipe 3 — review only one type, drop the other
{
"include": ["**/qt/**/*.ui"],
"exclude": ["**/gtk/**/*.ui"]
}Verify which rule winsocr rules check path/to/MainWindow.uiThis prints the layer + pattern that matched, which is the fastest way to confirm your ordering is right. The one case this can't cover: Qt and GTK |
|
Hi , |
|
Hi @ckappgit — really appreciate you following up, and even more that you kept digging into the general question after your own case was already solved. That's exactly the kind of thinking that makes a feature request genuinely useful. For what it's worth, your instinct that a Lua scripting engine is over-engineered is spot-on, and the We do want to pick this up, but we want to do it properly rather than bolt it on. A few things we'd want to settle in a design pass before committing to a shape:
That's not a soft "no" — it's a "we want it to be general and robust, so we'll discuss and design before shipping." We'll keep this discussion as the home for that conversation, and I'll circle back when there's a concrete proposal to react to. For now, the pragmatic recommendation is still the one above: organize files so directory/filename globs can tell them apart. Glad to hear a single Thanks again for the well-reasoned write-up — it genuinely helps us prioritize. |
|
What about some files without extensions, like Dockerfile, CODEOWNERS, id_rsa (actually no these are secrets), but how can we setup review rules that don't have one extension? Can I skip the extension entirely and match rules with globs, but they are not allowed actually. |
|
I checked the current filtering implementation because this question is closely related to the extension collision I encountered while adding HDL support in #1050. Both review paths reject unsupported files only when the detected extension is non-empty:
For files such as Rules can therefore target the complete filename directly: {
"rules": [
{
"path": "**/Dockerfile",
"rule": "Review Docker build correctness, caching, image size, and security."
},
{
"path": "**/CODEOWNERS",
"rule": "Review ownership patterns, ordering, and unintended coverage gaps."
},
{
"path": "**/Makefile",
"rule": "Review target dependencies, portability, quoting, and error handling."
}
]
}One caveat is that a rule only selects the review guidance; it does not admit a file that filtering would otherwise reject. This works without
Repositories that may contain sensitive files should also consider explicit exclusions such as Content matching would still be valuable for genuinely ambiguous extensions. I encountered the same limitation with |
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
First of all, thank you for building and maintaining open-code-review — it's been really helpful in my workflow. I'm writing as a user who has run into a limitation, and I'd love to hear whether there's a good way to solve it.
From what I understand, review rules are currently matched purely by file name or extension — for example, a rule like *.py applies to all Python files. This works well in most cases, since most file extensions map one-to-one to a file type. However, I've hit a case where this breaks down: the .ui extension is used by both Qt and GTK . Since both match *.ui, there's no way for me to write a rule that applies to Qt UI files but not GTK ones.
I completely understand if this is out of scope or low priority — I just wanted to raise it in case others have run into the same thing. Any thoughts or pointers would be greatly appreciated. Thank you for your time and for all the work on this project!
Best regards,
ckappgit
All reactions