-
-
Notifications
You must be signed in to change notification settings - Fork 398
Allow leading underscore in sketch filenames #2105
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
Allow leading underscore in sketch filenames #2105
Conversation
The Arduino Sketch Specification defines the allowed format of sketch folder names and sketch code filenames. The origin of the specification is the text of the error message shown in Arduino IDE when the user attempts to save to a name that contains disallowed characters: https://github.com/arduino/Arduino/blob/89539b1131f8cde9f7a83225f21c811071af53a8/app/src/processing/app/SketchController.java#L847-L853 However, the implementation of the restriction in the IDE codebase has a bug that allows a leading underscore (because the code uses _ as the replacement character). After the restriction was implemented correctly in Arduino IDE 2.x, it was discovered that the loss of compatibility with these non-compliant names was impactful. One of the primary purposes for the specification and restrictions is to ensure sketches can be used in any tool. Since the tools support this name format and there is no technical reason to disallow it, the best thing to do is change the sketch specification to follow the historic tool behavior (even if that behavior was the result of a benign bug). Leading underscores in sketch folder names and sketch code filenames are hereby permitted by the Arduino Sketch Specification and `arduino-cli sketch new`.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2105 +/- ##
==========================================
+ Coverage 36.51% 36.54% +0.03%
==========================================
Files 229 229
Lines 19624 19624
==========================================
+ Hits 7166 7172 +6
+ Misses 11612 11608 -4
+ Partials 846 844 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
The Arduino Sketch Specification defines the allowed format of sketch folder names and sketch code filenames. The origin of the specification is the text of the error message shown in Arduino IDE when the user attempts to save to a name that contains disallowed characters: https://github.com/arduino/Arduino/blob/89539b1131f8cde9f7a83225f21c811071af53a8/app/src/processing/app/SketchController.java#L847-L853 However, the implementation of the restriction in the IDE codebase has a bug that allows a leading underscore (because the code uses _ as the replacement character). After the restriction was implemented correctly in Arduino IDE 2.x, it was discovered that the loss of compatibility with these non-compliant names was impactful. One of the primary purposes for the specification and restrictions is to ensure sketches can be used in any tool. Since the tools support this name format and there is no technical reason to disallow it, the best thing to do is change the sketch specification to follow the historic tool behavior (even if that behavior was the result of a benign bug). Leading underscores in sketch folder names and sketch code filenames are hereby permitted by the Arduino Sketch Specification and `arduino-cli sketch new`.
Please check if the PR fulfills these requirements
See how to contribute
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)configuration.schema.json
updated if new parameters are added.What kind of change does this PR introduce?
Enhancement
What is the current behavior?
The Arduino Sketch Specification defines the allowed format of sketch folder names and sketch code filenames.
The origin of the specification is the text of the error message shown in Arduino IDE when the user attempts to save to a name that contains disallowed characters:
https://github.com/arduino/Arduino/blob/89539b1131f8cde9f7a83225f21c811071af53a8/app/src/processing/app/SketchController.java#L847-L853
However, the implementation of the restriction in the IDE codebase has a bug that allows a leading underscore (because the code uses _ as the replacement character).
After the restriction was implemented correctly in Arduino IDE 2.x, it was discovered that the loss of compatibility with these non-compliant names was impactful:
https://forum.arduino.cc/t/invalid-sketch-filename-dialog-when-opening-sketch-in-2-0-4/1096040
One of the primary purposes for the specification and restrictions is to ensure sketches can be used in any tool. Since the tools support this name format and there is no technical reason to disallow it, the best thing to do is change the sketch specification to follow the historic tool behavior (even if that behavior was unintended).
What is the new behavior?
Leading underscores in sketch folder names and sketch code filenames are permitted by the Arduino Sketch Specification and
arduino-cli sketch new
.Does this PR introduce a breaking change, and is titled accordingly?
No breaking change (validation is made more permissive).