processing / processing/processing4

Error Dialog for Invalid Filenames is Incomplete

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

Nobody has claimed this yet.

Dominant language
Java
Stars
494
Forks
183
Avg merge
4h 39m
Merged PRs (30d)
3

Description

In GitLab by @chipbuster on Jul 24, 2023, 18:46

Description

When an invalid sketch name is detected, the resulting error dialog does not include all requirements for filenames. This can result in a filename which appears to follow all the rules being rejected.

Possibly related to #741, but skimming that issue, it looked like that was intended to be about compiler errors, while this is more related to IDE errors.

Expected Behavior

If the filename does not follow all the rules, the error dialog should specify what to change.

Current Behavior

The error dialog says:

<filename> is not a valid name for sketch code.
Better to stick to ASCII, no spaces, and make sure
it doesn't start with a number.

However, this does not address the following cases:

  1. When a non-alphanumeric ASCII character is included in the filename.
  2. When the stem of the filename is longer than 63 characters.

Steps to Reproduce

Create a file named hello-world.pde or a file whose name consists of the letter 'a' 64 times followed by .pde.

Your Environment

  • Processing version: 4.2
  • Operating System and OS version: Arch Linux
  • Other information: I am (mostly) not manually creating filenames which violate these rules. Rather, it's happening because my learning management system (Canvas) likes to rename files on its own whim, and it tends to add these sorts of things.

Possible Causes / Solutions

One solution would be to explicitly name all the requirements for a filename, e.g. the message reads something like

<filename> is not a valid name for a sketch. Your files must:

1. Use only ASCII letters and numbers.
2. Start with a letter.
3. Be shorter than 63 characters.

but this is not complete either (e.g. right now you are allowed to have underscores in the name).

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 in app/src/processing/app/Sketch.java around the filename checks at lines 1870 and 1886, then trace where the invalid-name dialog text is assembled. Compare the dialog with the validation rules, including non-alphanumeric characters, maximum stem length, and allowed underscores. Done means the dialog explains every rule that can reject the filename.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.