refactor: enable oxlint complexity rule (max 20) and refactor offenders - #2016
Merged
Conversation
Enables the oxlint complexity rule with a maximum of 20 in .oxlintrc.json and refactors the 24 functions that exceeded the threshold so the whole codebase passes with --max-warnings 0. All refactors are pure, behavior-preserving extractions: cohesive blocks were pulled into well-named module-level helpers (or private methods), structurally-similar branch ladders were replaced with lookup tables, and guard clauses were hoisted to flatten nesting. No public signatures, return values, ordering, warning/error messages, or side effects changed; existing unit and e2e tests pass unchanged. Closes #2007 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
@dyoshikawa Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables the oxlint
complexityrule with a maximum of 20 in.oxlintrc.jsonand refactors the 24 functions that exceeded the threshold so the whole codebase passes with--max-warnings 0.This guards against future complexity creep (CI fails on any function over 20).
Approach
All refactors are pure, behavior-preserving extractions:
No public signatures, return values, entry ordering, warning/error messages, or side effects changed.
Refactored functions (complexity → ≤20)
config/config-resolver.tsresolve(52)mcp/tools.tsexecute(44)cli/commands/generate.tsgenerateCommand(35)features/hooks/tool-hooks-converter.tscanonicalToToolHooks(43),toolHooksToCanonical(35)features/hooks/{qwencode,geminicli,copilotcli,kiro,vibe}-hooks.ts,opencode-style-generator.tslib/gh/gh-install.tsinstallGh(37),installSource(37)lib/sources.tsfetchSource(30),resolveAndFetchSources(23)lib/apm/apm-install.tsinstallDependency(25),installApm(24)lib/update.tsperformBinaryUpdate(23)features/mcp/{goose,kilo}-mcp.tsconvertToGooseFormat(27), kilo map callback (21)features/skills/vibe-skill.tsfromRulesyncSkill(28)features/permissions/{codexcli,cline}-permissions.tsconvertRulesyncToCodexProfile(23),fromRulesyncPermissions(21)features/rules/rules-processor.tsconvertRulesyncFilesToToolFiles(23)Verification
npx oxlint . --max-warnings 0— clean (0 complexity violations).pnpm cicheck— green (6790 unit tests, typecheck, format, content checks all pass).Closes #2007
🤖 Generated with Claude Code