mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -26,11 +26,17 @@ function isOptionalToolAllowed(params: {
|
||||
pluginId: string;
|
||||
allowlist: Set<string>;
|
||||
}): boolean {
|
||||
if (params.allowlist.size === 0) return false;
|
||||
if (params.allowlist.size === 0) {
|
||||
return false;
|
||||
}
|
||||
const toolName = normalizeToolName(params.toolName);
|
||||
if (params.allowlist.has(toolName)) return true;
|
||||
if (params.allowlist.has(toolName)) {
|
||||
return true;
|
||||
}
|
||||
const pluginKey = normalizeToolName(params.pluginId);
|
||||
if (params.allowlist.has(pluginKey)) return true;
|
||||
if (params.allowlist.has(pluginKey)) {
|
||||
return true;
|
||||
}
|
||||
return params.allowlist.has("group:plugins");
|
||||
}
|
||||
|
||||
@@ -57,7 +63,9 @@ export function resolvePluginTools(params: {
|
||||
const blockedPlugins = new Set<string>();
|
||||
|
||||
for (const entry of registry.tools) {
|
||||
if (blockedPlugins.has(entry.pluginId)) continue;
|
||||
if (blockedPlugins.has(entry.pluginId)) {
|
||||
continue;
|
||||
}
|
||||
const pluginIdKey = normalizeToolName(entry.pluginId);
|
||||
if (existingNormalized.has(pluginIdKey)) {
|
||||
const message = `plugin id conflicts with core tool name (${entry.pluginId})`;
|
||||
@@ -78,7 +86,9 @@ export function resolvePluginTools(params: {
|
||||
log.error(`plugin tool failed (${entry.pluginId}): ${String(err)}`);
|
||||
continue;
|
||||
}
|
||||
if (!resolved) continue;
|
||||
if (!resolved) {
|
||||
continue;
|
||||
}
|
||||
const listRaw = Array.isArray(resolved) ? resolved : [resolved];
|
||||
const list = entry.optional
|
||||
? listRaw.filter((tool) =>
|
||||
@@ -89,7 +99,9 @@ export function resolvePluginTools(params: {
|
||||
}),
|
||||
)
|
||||
: listRaw;
|
||||
if (list.length === 0) continue;
|
||||
if (list.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const nameSet = new Set<string>();
|
||||
for (const tool of list) {
|
||||
if (nameSet.has(tool.name) || existing.has(tool.name)) {
|
||||
|
||||
Reference in New Issue
Block a user