Skip to content

Remove clippy too_many_lines lint and decompose long functions#7064

Merged
codefromthecrypt merged 2 commits intomainfrom
baxen/long-funcs
Feb 7, 2026
Merged

Remove clippy too_many_lines lint and decompose long functions#7064
codefromthecrypt merged 2 commits intomainfrom
baxen/long-funcs

Conversation

@baxen
Copy link
Collaborator

@baxen baxen commented Feb 7, 2026

Summary

Remove the custom clippy-lint.sh / clippy-baseline.sh infrastructure for the too_many_lines clippy lint, and replace it with standard cargo clippy. Then decompose the longest offending function (build_session) into focused helpers.

Why

  • Reduced complexity: The custom baseline scripts added maintenance burden and complexity that wasn't paying for itself.
  • LLM-friendliness: The too_many_lines lint produced very long output that made it hard for LLMs (which work on this codebase) to check their work — the signal-to-noise ratio was poor.
  • Standard tooling: We now just use cargo clippy directly, which is simpler and well-understood.

The second commit refactors build_session (the longest function flagged by the old lint) into smaller, focused helper functions as a concrete improvement.

Closes #6271

Copilot AI review requested due to automatic review settings February 7, 2026 01:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the custom clippy baseline tooling (previously used to gate clippy::too_many_lines) in favor of standard cargo clippy, and refactors goose-cli’s session builder to reduce function length/complexity.

Changes:

  • Remove scripts/clippy-lint.sh / scripts/clippy-baseline.sh and the too_many_lines baseline file.
  • Update CI/Just/docs to run cargo clippy --all-targets -- -D warnings and run the banned TLS crate check explicitly.
  • Decompose crates/goose-cli/src/session/builder.rs::build_session into smaller helper functions and add clippy.toml.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/clippy-lint.sh Removed combined clippy + baseline runner script.
scripts/clippy-baseline.sh Removed baseline-only “fail on new violations” infrastructure.
crates/goose-cli/src/session/builder.rs Refactors build_session into helpers and adjusts extension-loading flow.
clippy.toml Adds clippy configuration (too-many-lines threshold).
clippy-baselines/too_many_lines.txt Removes stored baseline violations list.
Justfile Replaces script invocation with direct cargo clippy + TLS-crate check.
HOWTOAI.md Updates contributor guidance to use direct cargo clippy.
CONTRIBUTING.md Updates “run the linter” instructions to direct cargo clippy.
AGENTS.md Updates workflow/lint instructions to reflect removal of the script.
.github/workflows/goose-issue-solver.yml Updates checklist to use direct cargo clippy.
.github/workflows/ci.yml Updates CI to run direct cargo clippy and adds separate TLS-crate check step.
.github/copilot-instructions.md Updates CI/lint references from the removed script to cargo clippy.

@block block deleted a comment from Copilot AI Feb 7, 2026
baxen added 2 commits February 6, 2026 18:52
Remove the custom clippy-lint.sh script, clippy-baseline.sh, and the
clippy-baselines/ directory. Replace all references with standard
cargo clippy --all-targets -- -D warnings.

Add clippy.toml with too-many-lines-threshold = 200 to raise the
default threshold from 100. The check-no-native-tls.sh script is
preserved as a separate step in CI and the Justfile.

Updates across: CI workflows, Justfile, AGENTS.md, CONTRIBUTING.md,
HOWTOAI.md, and copilot-instructions.md.
Extract 5 helper functions from the 255-line build_session function
to bring it under the 200-line clippy threshold (now 127 lines):

- resolve_provider_and_model: provider/model resolution with fallback chain
- resolve_session_id: session ID determination (no_session/resume/new)
- handle_resumed_session_workdir: working directory reconciliation
- resolve_and_load_extensions: extension gathering and loading
- configure_session_prompts: system prompt setup and extension persistence
Copy link
Collaborator

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@codefromthecrypt codefromthecrypt added this pull request to the merge queue Feb 7, 2026
Merged via the queue into main with commit b18120b Feb 7, 2026
18 checks passed
@codefromthecrypt codefromthecrypt deleted the baxen/long-funcs branch February 7, 2026 04:15
kuccello pushed a commit to kuccello/goose that referenced this pull request Feb 7, 2026
tlongwell-block added a commit that referenced this pull request Feb 9, 2026
* origin/main: (55 commits)
  test(mcp): add image tool test and consolidate MCP test fixtures (#7019)
  fix: remove Option from model listing return types, propagate errors (#7074)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  refactor: move disable_session_naming into AgentConfig (#7062)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  ...

# Conflicts:
#	scripts/test_subrecipes.sh
lifeizhou-ap added a commit that referenced this pull request Feb 9, 2026
* main: (101 commits)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  refactor: move disable_session_naming into AgentConfig (#7062)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051)
  Remove build-dependencies section from Cargo.toml (#6946)
  add /rp-why skill blog post (#6997)
  fix: fix snake_case function names in code_execution instructions (#7035)
  Document max_turns settings for recipes and subagents (#7044)
  feat: update Groq declarative data with Preview Models (#7023)
  ...
jh-block added a commit that referenced this pull request Feb 9, 2026
* origin/main: (54 commits)
  chore: strip posthog for sessions/models/daily only (#7079)
  tidy: clean up old benchmark and add gym (#7081)
  fix: use command.process_group(0) for CLI providers, not just MCP (#7083)
  added build notify (#6891)
  test(mcp): add image tool test and consolidate MCP test fixtures (#7019)
  fix: remove Option from model listing return types, propagate errors (#7074)
  fix: lazy provider creation for goose acp (#7026) (#7066)
  Smoke tests: split compaction test and use debug build (#6984)
  fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061)
  feat: expose AGENT_SESSION_ID env var to extension child processes (#7072)
  fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882)
  Remove clippy too_many_lines lint and decompose long functions (#7064)
  refactor: move disable_session_naming into AgentConfig (#7062)
  Add global config switch to disable automatic session naming (#7052)
  docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059)
  fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047)
  Show recommended model on failture (#7040)
  feat(ui): add session content search via API (#7050)
  docs: fix img url (#7053)
  Desktop UI for deleting custom providers (#7042)
  ...
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deprecate clippy-lint.sh

2 participants

Comments