Restore normalization of library metadata #34
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the code was switched to using Arduino Lint for release validation (#18), the
metadata.Validate()
function was removed.At a closer look, it turns out that this function did normalization in addition to validation of the metadata:
Make
version
semver-compliantArduino Lint's rule
LP021
encourages semver compliance. However, violation of this rule in the mode used by the engine only results in a warning, so normalization is still needed.Arduino Lint's rule
LP020
enforces compliance with "relaxed semver", so it's only the normalization aspect that need be restored.Populate
maintainer
field withauthor
value if emptyArduino Lint's rule
LP026
requires themaintainer
field to be defined and non-empty, and will cause any library release in violation of this rule to be rejected by the engine, so there is no need to restore the normalization code for this field.Change invalid
category
value to "uncategorized"Arduino Lint's rule
LP038
encourages the use of valid categories. However, violation of this rule in the mode used by the engine only results in a warning, so normalization is still needed.Rather than using bespoke code for normalization as was done before, I have utilized the same code as in Arduino CLI:
go.bug.st/relaxed-semver
packagegithub.com/arduino/arduino-cli/arduino/libraries
packageThis introduces some new dependencies to the tool.