kworkflow / kworkflow/patch-hub

Handle possible unnecessary panics by removing `unwrap()` calls

Open
#2 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code-improv
Dominant language
Rust
Stars
36
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Context:

FWIU, the use of the unwrap() call is discouraged, as it basically panics if the unwrapping operation fails. IMHO, it is great for quickly development and drafts, but it presents weak points in the application, which can crash at unexpected points. Below, is the output of git grep -c 'unwrap()':

src/lore_api_client.rs:1
src/lore_session.rs:6
src/main.rs:3
src/patch.rs:6
Proposal:

Handle as much as these unnecessary panics as possible. We should at least panic with a custom message... (at very very very least, use expect() to convey a custom panic message)

Setup:
  • Project branch: master
  • Project commit hash: f81088369878104795ecbd835c145f36de547fa7
  • rustc version: 1.79.0
  • cargo version: 1.79.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported git grep command and inspect the unwrap() calls in src/lore_api_client.rs, src/lore_session.rs, src/main.rs, and src/patch.rs. Determine which failures can be handled safely and replace unnecessary panic points; done means the relevant unwrap() calls are addressed, with custom messages where panics remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, devtools
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.