Skip to content

Commit 8acfdbe

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 072fa6b commit 8acfdbe

5 files changed

Lines changed: 18 additions & 9 deletions

File tree

src/commands/code_mappings/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn make_command(mut command: Command) -> Command {
2121
}
2222

2323
command = command
24-
.about("Manage code mappings for Sentry.")
24+
.about("Manage code mappings for Sentry. Code mappings link stack trace paths to source code paths in your repository, enabling source context and code linking in Sentry.")
2525
.subcommand_required(true)
2626
.arg_required_else_help(true)
2727
.org_arg()

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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
```
22
$ sentry-cli code-mappings --help
33
? success
4-
Manage code mappings for Sentry.
4+
Manage code mappings for Sentry. Code mappings link stack trace paths to source code paths in your
5+
repository, enabling source context and code linking in Sentry.
56

67
Usage: sentry-cli[EXE] code-mappings [OPTIONS] <COMMAND>
78

89
Commands:
9-
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).
1013
help Print this message or the help of the given subcommand(s)
1114

1215
Options:

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
```
22
$ sentry-cli code-mappings
33
? failed
4-
Manage code mappings for Sentry.
4+
Manage code mappings for Sentry. Code mappings link stack trace paths to source code paths in your
5+
repository, enabling source context and code linking in Sentry.
56

67
Usage: sentry-cli[EXE] code-mappings [OPTIONS] <COMMAND>
78

89
Commands:
9-
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).
1013
help Print this message or the help of the given subcommand(s)
1114

1215
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)