Summary
10 SonarCloud issues (S7721) across 6 files where functions are defined inside other functions but do not close over any local variables, so they can be safely moved to module scope.
Why
Defining a function inside another function recreates it on every call, adding unnecessary overhead. When the inner function doesn't use any variables from the enclosing scope, there's no reason for it to be nested. Moving it out also reduces the cognitive complexity of the outer function, potentially fixing S3776 violations as a side effect.
Scope
~10 occurrences across:
src/cli/index.ts
src/core/
src/api/
src/connectors/
tests/
- and others
Fix
For each flagged inner function, verify it captures no outer-scope variables, then move it to module scope (or to a shared utilities file if used in multiple places).
Estimated effort
~50 min total (~5 min/issue)
SonarCloud
View issues
Summary
10 SonarCloud issues (S7721) across 6 files where functions are defined inside other functions but do not close over any local variables, so they can be safely moved to module scope.
Why
Defining a function inside another function recreates it on every call, adding unnecessary overhead. When the inner function doesn't use any variables from the enclosing scope, there's no reason for it to be nested. Moving it out also reduces the cognitive complexity of the outer function, potentially fixing S3776 violations as a side effect.
Scope
~10 occurrences across:
src/cli/index.tssrc/core/src/api/src/connectors/tests/Fix
For each flagged inner function, verify it captures no outer-scope variables, then move it to module scope (or to a shared utilities file if used in multiple places).
Estimated effort
~50 min total (~5 min/issue)
SonarCloud
View issues