chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions
+21 -7
View File
@@ -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)];
}