-
-
Notifications
You must be signed in to change notification settings - Fork 522
Warn when an app description exceeds the recommended length #2869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Briefcase now warns when an app's `description` is longer than 80 characters, as overly long descriptions can be truncated by some packaging formats (such as Windows MSI shortcut icons). |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,12 @@ | |||||||||
| "and cannot end with '-' or '_')." | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| # The `description` is a short, single-line summary of the app. Longer values | ||||||||||
| # belong in `long_description`. Some packaging formats embed the description in | ||||||||||
| # length-limited fields (e.g. Windows MSI shortcuts truncate at 256 characters, | ||||||||||
| # corrupting the icon path), so Briefcase warns when it exceeds this length. | ||||||||||
| MAX_DESCRIPTION_LENGTH = 80 | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def is_valid_pep508_name(app_name): | ||||||||||
| """Determine if the name is valid by PEP508 rules.""" | ||||||||||
|
|
@@ -1463,6 +1469,20 @@ def parse_config(config_file: Path, platform, output_format, console): | |||||||||
| # Normalize license fields to PEP 639 representation. | ||||||||||
| normalize_license_config(config, app_name, base_path, console) | ||||||||||
|
|
||||||||||
| # The description should be a short, single-line summary. Warn (but don't | ||||||||||
| # fail) if it's too long, as some packaging formats embed it in | ||||||||||
| # length-limited fields; for example, an over-long description corrupts | ||||||||||
| # the shortcut icon path in Windows MSI installers. | ||||||||||
|
Comment on lines
+1472
to
+1475
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need excessively long comments explaining code, especially when the warning message explains the underlying problem.
Suggested change
|
||||||||||
| description = config.get("description") | ||||||||||
| if isinstance(description, str) and len(description) > MAX_DESCRIPTION_LENGTH: | ||||||||||
| console.warning( | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a warning is long, we can now use the |
||||||||||
| f"The description for {app_name!r} is {len(description)} characters " | ||||||||||
| f"long. Briefcase recommends a description of no more than " | ||||||||||
| f"{MAX_DESCRIPTION_LENGTH} characters; longer descriptions may be " | ||||||||||
| f"truncated when packaging for some platforms. Move any detailed " | ||||||||||
| f"text into the `long_description` field." | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| # Construct a configuration object, and add it to the list | ||||||||||
| # of configurations that are being handled. | ||||||||||
| app_configs[app_name] = config | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be factored out like this. It's used in exactly one place.