Skip to content

Commit 1df051b

Browse files
committed
Show value in message of name's disallowed characters check
This will make it more clear to the user which think the error message is referring to.
1 parent 30802ee commit 1df051b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

check/checkconfigurations/checkconfigurations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ var configurations = []Type{
198198
ID: "LP003",
199199
Brief: "disallowed characters",
200200
Description: "",
201-
MessageTemplate: "disallowed characters in library.properties name field. See: https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format",
201+
MessageTemplate: "disallowed characters in library.properties name value: {{.}}. See: https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format",
202202
DisableModes: nil,
203203
EnableModes: []checkmode.Type{checkmode.Default},
204204
InfoModes: nil,

check/checkfunctions/library.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ func LibraryPropertiesNameFieldDisallowedCharacters() (result checkresult.Type,
175175
return checkresult.NotRun, ""
176176
}
177177

178+
name, ok := checkdata.LibraryProperties().GetOk("name")
179+
if !ok {
180+
return checkresult.NotRun, "name not defined"
181+
}
182+
178183
if schema.PropertyPatternMismatch("name", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
179-
return checkresult.Fail, ""
184+
return checkresult.Fail, name
180185
}
181186

182187
return checkresult.Pass, ""

0 commit comments

Comments
 (0)