Skip to content

Commit dfeb139

Browse files
romtsnclaude
andcommitted
fix(code-mappings): Address PR feedback on help text and unwrap usage
Add descriptive help text explaining what code mappings are and how they work. Replace unwrap with expect for the required path argument. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9f73bc0 commit dfeb139

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/commands/code_mappings/upload.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct CodeMapping {
1313

1414
pub fn make_command(command: Command) -> Command {
1515
command
16-
.about("Upload code mappings for a project from a JSON file.")
16+
.about("Upload code mappings for a project from a JSON file. Each mapping pairs a stack trace root (e.g. com/example/module) with the corresponding source path in your repository (e.g. modules/module/src/main/java/com/example/module).")
1717
.arg(
1818
Arg::new("path")
1919
.value_name("PATH")
@@ -36,8 +36,9 @@ pub fn make_command(command: Command) -> Command {
3636
}
3737

3838
pub fn execute(matches: &ArgMatches) -> Result<()> {
39-
#[expect(clippy::unwrap_used, reason = "path is a required argument")]
40-
let path = matches.get_one::<String>("path").unwrap();
39+
let path = matches
40+
.get_one::<String>("path")
41+
.expect("path is a required argument");
4142
let data = fs::read(path).with_context(|| format!("Failed to read mappings file '{path}'"))?;
4243

4344
let mappings: Vec<CodeMapping> =

tests/integration/_cases/code_mappings/code-mappings-help.trycmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ repository, enabling source context and code linking in Sentry.
77
Usage: sentry-cli[EXE] code-mappings [OPTIONS] <COMMAND>
88

99
Commands:
10-
upload Upload code mappings for a project from a JSON file.
10+
upload Upload code mappings for a project from a JSON file. Each mapping pairs a stack trace root
11+
(e.g. com/example/module) with the corresponding source path in your repository (e.g.
12+
modules/module/src/main/java/com/example/module).
1113
help Print this message or the help of the given subcommand(s)
1214

1315
Options:

tests/integration/_cases/code_mappings/code-mappings-no-subcommand.trycmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ repository, enabling source context and code linking in Sentry.
77
Usage: sentry-cli[EXE] code-mappings [OPTIONS] <COMMAND>
88

99
Commands:
10-
upload Upload code mappings for a project from a JSON file.
10+
upload Upload code mappings for a project from a JSON file. Each mapping pairs a stack trace root
11+
(e.g. com/example/module) with the corresponding source path in your repository (e.g.
12+
modules/module/src/main/java/com/example/module).
1113
help Print this message or the help of the given subcommand(s)
1214

1315
Options:

tests/integration/_cases/code_mappings/code-mappings-upload-help.trycmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
```
22
$ sentry-cli code-mappings upload --help
33
? success
4-
Upload code mappings for a project from a JSON file.
4+
Upload code mappings for a project from a JSON file. Each mapping pairs a stack trace root (e.g.
5+
com/example/module) with the corresponding source path in your repository (e.g.
6+
modules/module/src/main/java/com/example/module).
57

68
Usage: sentry-cli[EXE] code-mappings upload [OPTIONS] <PATH>
79

0 commit comments

Comments
 (0)