mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 19:01:47 +03:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
+21
-7
@@ -62,9 +62,13 @@ function isApplyPatchAllowedForModel(params: {
|
||||
allowModels?: string[];
|
||||
}) {
|
||||
const allowModels = Array.isArray(params.allowModels) ? params.allowModels : [];
|
||||
if (allowModels.length === 0) return true;
|
||||
if (allowModels.length === 0) {
|
||||
return true;
|
||||
}
|
||||
const modelId = params.modelId?.trim();
|
||||
if (!modelId) return false;
|
||||
if (!modelId) {
|
||||
return false;
|
||||
}
|
||||
const normalizedModelId = modelId.toLowerCase();
|
||||
const provider = params.modelProvider?.trim().toLowerCase();
|
||||
const normalizedFull =
|
||||
@@ -73,7 +77,9 @@ function isApplyPatchAllowedForModel(params: {
|
||||
: normalizedModelId;
|
||||
return allowModels.some((entry) => {
|
||||
const normalized = entry.trim().toLowerCase();
|
||||
if (!normalized) return false;
|
||||
if (!normalized) {
|
||||
return false;
|
||||
}
|
||||
return normalized === normalizedModelId || normalized === normalizedFull;
|
||||
});
|
||||
}
|
||||
@@ -187,7 +193,9 @@ export function createOpenClawCodingTools(options?: {
|
||||
const providerProfilePolicy = resolveToolProfilePolicy(providerProfile);
|
||||
|
||||
const mergeAlsoAllow = (policy: typeof profilePolicy, alsoAllow?: string[]) => {
|
||||
if (!policy?.allow || !Array.isArray(alsoAllow) || alsoAllow.length === 0) return policy;
|
||||
if (!policy?.allow || !Array.isArray(alsoAllow) || alsoAllow.length === 0) {
|
||||
return policy;
|
||||
}
|
||||
return { ...policy, allow: Array.from(new Set([...policy.allow, ...alsoAllow])) };
|
||||
};
|
||||
|
||||
@@ -234,16 +242,22 @@ export function createOpenClawCodingTools(options?: {
|
||||
const freshReadTool = createReadTool(workspaceRoot);
|
||||
return [createOpenClawReadTool(freshReadTool)];
|
||||
}
|
||||
if (tool.name === "bash" || tool.name === execToolName) return [];
|
||||
if (tool.name === "bash" || tool.name === execToolName) {
|
||||
return [];
|
||||
}
|
||||
if (tool.name === "write") {
|
||||
if (sandboxRoot) return [];
|
||||
if (sandboxRoot) {
|
||||
return [];
|
||||
}
|
||||
// Wrap with param normalization for Claude Code compatibility
|
||||
return [
|
||||
wrapToolParamNormalization(createWriteTool(workspaceRoot), CLAUDE_PARAM_GROUPS.write),
|
||||
];
|
||||
}
|
||||
if (tool.name === "edit") {
|
||||
if (sandboxRoot) return [];
|
||||
if (sandboxRoot) {
|
||||
return [];
|
||||
}
|
||||
// Wrap with param normalization for Claude Code compatibility
|
||||
return [wrapToolParamNormalization(createEditTool(workspaceRoot), CLAUDE_PARAM_GROUPS.edit)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user