Skip to content

Commit 4bfe9db

Browse files
cvclaude
andcommitted
chore: ratchet complexity to 20, suppress existing violations
Suppress 6 functions that exceed the threshold with eslint-disable comments so we can start enforcing at 20 instead of 95: - setupNim (95), setupPolicies (41), setupInference (22) in onboard.js - deploy (22), main IIFE (27) in nemoclaw.js - applyPreset (24) in policies.js Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent b8dc697 commit 4bfe9db

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎bin/lib/onboard.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,7 @@ async function createSandbox(gpu, model, provider, preferredInferenceApi = null)
15151515

15161516
// ── Step 4: NIM ──────────────────────────────────────────────────
15171517

1518+
// eslint-disable-next-line complexity
15181519
async function setupNim(gpu) {
15191520
step(2, 7, "Configuring inference (NIM)");
15201521

@@ -1915,6 +1916,7 @@ async function setupNim(gpu) {
19151916

19161917
// ── Step 5: Inference provider ───────────────────────────────────
19171918

1919+
// eslint-disable-next-line complexity
19181920
async function setupInference(sandboxName, model, provider, endpointUrl = null, credentialEnv = null) {
19191921
step(4, 7, "Setting up inference provider");
19201922
runOpenshell(["gateway", "select", GATEWAY_NAME], { ignoreError: true });
@@ -1998,6 +2000,7 @@ async function setupOpenclaw(sandboxName, model, provider) {
19982000

19992001
// ── Step 7: Policy presets ───────────────────────────────────────
20002002

2003+
// eslint-disable-next-line complexity
20012004
async function setupPolicies(sandboxName) {
20022005
step(7, 7, "Policy presets");
20032006

‎bin/lib/policies.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function buildPolicyGetCommand(sandboxName) {
9393
return `${getOpenshellCommand()} policy get --full ${shellQuote(sandboxName)} 2>/dev/null`;
9494
}
9595

96+
// eslint-disable-next-line complexity
9697
function applyPreset(sandboxName, presetName) {
9798
// Guard against truncated sandbox names — WSL can truncate hyphenated
9899
// names during argument parsing, e.g. "my-assistant" → "m"

‎bin/nemoclaw.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ async function setupSpark() {
100100
run(`sudo bash "${SCRIPTS}/setup-spark.sh"`);
101101
}
102102

103+
// eslint-disable-next-line complexity
103104
async function deploy(instanceName) {
104105
if (!instanceName) {
105106
console.error(" Usage: nemoclaw deploy <instance-name>");
@@ -445,6 +446,7 @@ function help() {
445446

446447
const [cmd, ...args] = process.argv.slice(2);
447448

449+
// eslint-disable-next-line complexity
448450
(async () => {
449451
// No command → help
450452
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {

‎eslint.config.mjs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ export default [
3939
rules: {
4040
...js.configs.recommended.rules,
4141
"no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" }],
42-
// Cyclomatic complexity — ratchet down as we refactor:
43-
// 95 (current) → 40 → 25 → 15
44-
"complexity": ["error", { max: 95 }],
42+
// Cyclomatic complexity — ratchet down to 15 as we refactor suppressed functions
43+
"complexity": ["error", { max: 20 }],
4544
},
4645
},
4746

0 commit comments

Comments
 (0)