From e4bfce3e32bf12c48fb4535d3d4a4574b4d138bc Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 26 Nov 2020 13:04:05 -0800 Subject: [PATCH] Fix typos in comments and messages --- check/check.go | 2 +- check/check_test.go | 2 +- .../checkconfigurations.go | 20 +++++++++---------- check/checkdata/library.go | 2 +- .../checkdata/schema/parsevalidationresult.go | 4 ++-- check/checkdata/schema/schema.go | 2 +- check/checkfunctions/library.go | 8 ++++---- command/command.go | 2 +- configuration/configuration.go | 2 +- configuration/defaults.go | 4 ++-- project/library/library.go | 2 +- project/platform/platform.go | 2 +- project/project.go | 4 ++-- project/projecttype/projecttype.go | 2 +- result/outputformat/outputformat.go | 2 +- result/result.go | 2 +- 16 files changed, 31 insertions(+), 31 deletions(-) diff --git a/check/check.go b/check/check.go index 636d1a37e..604fbb792 100644 --- a/check/check.go +++ b/check/check.go @@ -48,7 +48,7 @@ func RunChecks(project project.Type) { continue } - // Output will be printed after all checks are finished when configured for "json" output format + // Output will be printed after all checks are finished when configured for "json" output format. feedback.Printf("Running check %s: ", checkConfiguration.ID) checkResult, checkOutput := checkConfiguration.CheckFunction() diff --git a/check/check_test.go b/check/check_test.go index ca3713f98..9802dc4f7 100644 --- a/check/check_test.go +++ b/check/check_test.go @@ -45,7 +45,7 @@ func Test_shouldRun(t *testing.T) { {"Disable mode default", projecttype.Library, projecttype.Library, []checkmode.Type{checkmode.Default}, []checkmode.Type{checkmode.LibraryManagerSubmission}, "update", "specification", assert.False, assert.NoError}, {"Disable mode default override", projecttype.Library, projecttype.Library, []checkmode.Type{checkmode.Default}, []checkmode.Type{checkmode.LibraryManagerSubmission}, "submit", "specification", assert.True, assert.NoError}, {"Enable mode default", projecttype.Library, projecttype.Library, []checkmode.Type{checkmode.LibraryManagerSubmission}, []checkmode.Type{checkmode.Default}, "update", "specification", assert.True, assert.NoError}, - {"Disable mode default override", projecttype.Library, projecttype.Library, []checkmode.Type{checkmode.LibraryManagerSubmission}, []checkmode.Type{checkmode.Default}, "submit", "specification", assert.False, assert.NoError}, + {"Enable mode default override", projecttype.Library, projecttype.Library, []checkmode.Type{checkmode.LibraryManagerSubmission}, []checkmode.Type{checkmode.Default}, "submit", "specification", assert.False, assert.NoError}, {"Unable to resolve", projecttype.Library, projecttype.Library, []checkmode.Type{checkmode.LibraryManagerSubmission}, []checkmode.Type{checkmode.LibraryManagerIndexed}, "false", "specification", assert.False, assert.Error}, } diff --git a/check/checkconfigurations/checkconfigurations.go b/check/checkconfigurations/checkconfigurations.go index 1da9915d6..812e813ca 100644 --- a/check/checkconfigurations/checkconfigurations.go +++ b/check/checkconfigurations/checkconfigurations.go @@ -153,7 +153,7 @@ var configurations = []Type{ ID: "", Brief: "name < min length", Description: "", - MessageTemplate: "library.properties name value is less than minimum length", + MessageTemplate: "library.properties name value is less than minimum length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -168,7 +168,7 @@ var configurations = []Type{ ID: "", Brief: "name > max length", Description: "", - MessageTemplate: "library.properties name value {{.}} is longer than maximum length", + MessageTemplate: "library.properties name value {{.}} is longer than maximum length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -183,7 +183,7 @@ var configurations = []Type{ ID: "", Brief: "name > recommended length", Description: "", - MessageTemplate: "library.properties name value {{.}} is longer than recommended max length", + MessageTemplate: "library.properties name value {{.}} is longer than recommended max length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -227,7 +227,7 @@ var configurations = []Type{ Subcategory: "name field", ID: "", Brief: `starts with "Arduino"`, - Description: `Case insensitive. 3rd party libraries added to Library Manager index prior to the enactment of this rule are "grandfathered"`, + Description: `Case insensitive. 3rd party libraries added to Library Manager index prior to the enactment of this rule are "grandfathered".`, MessageTemplate: `Library name {{.}} starts with "Arduino". These names are reserved for official libraries.`, DisableModes: []checkmode.Type{checkmode.Official}, EnableModes: []checkmode.Type{checkmode.Default}, @@ -393,7 +393,7 @@ var configurations = []Type{ ID: "", Brief: "author < min length", Description: "", - MessageTemplate: "library.properties author value is less than minimum length", + MessageTemplate: "library.properties author value is less than minimum length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -423,7 +423,7 @@ var configurations = []Type{ ID: "", Brief: "maintainer < min length", Description: "", - MessageTemplate: "library.properties maintainer value is less than minimum length", + MessageTemplate: "library.properties maintainer value is less than minimum length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -468,7 +468,7 @@ var configurations = []Type{ ID: "", Brief: "email < min length", Description: "", - MessageTemplate: "library.properties email value is less than minimum length", + MessageTemplate: "library.properties email value is less than minimum length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -513,7 +513,7 @@ var configurations = []Type{ ID: "", Brief: "sentence < min length", Description: "", - MessageTemplate: "library.properties sentence value is less than minimum length", + MessageTemplate: "library.properties sentence value is less than minimum length.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, @@ -1052,8 +1052,8 @@ var configurations = []Type{ Subcategory: "", ID: "SS001", Brief: ".pde extension", - Description: "The .pde extension is used by both Processing sketches and Arduino sketches. Processing sketches should either be in the \"data\" subfolder of the sketch or in the \"extras\" folder of the library. Arduino sketches should use the modern .ino extension", - MessageTemplate: "{{.}} uses deprecated .pde file extension. Use .ino for Arduino sketches", + Description: "The .pde extension is used by both Processing sketches and Arduino sketches. Processing sketches should either be in the \"data\" subfolder of the sketch or in the \"extras\" folder of the library. Arduino sketches should use the modern .ino extension.", + MessageTemplate: "{{.}} uses deprecated .pde file extension. Use .ino for Arduino sketches.", DisableModes: nil, EnableModes: []checkmode.Type{checkmode.All}, InfoModes: nil, diff --git a/check/checkdata/library.go b/check/checkdata/library.go index 73a6213f4..9abf9b6c3 100644 --- a/check/checkdata/library.go +++ b/check/checkdata/library.go @@ -58,7 +58,7 @@ func InitializeForLibrary(project project.Type, schemasPath *paths.Path) { } } - if libraryManagerIndex == nil { // Only download the Library Manager index once + if libraryManagerIndex == nil { // Only download the Library Manager index once. url := "http://downloads.arduino.cc/libraries/library_index.json" httpResponse, err := http.Get(url) if err != nil { diff --git a/check/checkdata/schema/parsevalidationresult.go b/check/checkdata/schema/parsevalidationresult.go index 7963efcd7..f358ef543 100644 --- a/check/checkdata/schema/parsevalidationresult.go +++ b/check/checkdata/schema/parsevalidationresult.go @@ -66,7 +66,7 @@ func ValidationErrorMatch( schemasPath *paths.Path, ) bool { if validationResult == nil { - // No error, so nothing to match + // No error, so nothing to match. logrus.Trace("Schema validation passed. No match is possible.") return false } @@ -140,7 +140,7 @@ func validationErrorSchemaPointerMatch( } // The schema validator does not provide full pointer past logic inversion keywords to the lowest level keywords related to the validation error cause. - // Therefore the sub-keywords must be checked for matches in order to be able to interpret the exact cause of the failure. + // Therefore, the sub-keywords must be checked for matches in order to be able to interpret the exact cause of the failure. if regexp.MustCompile("(/not)|(/oneOf)$").MatchString(validationError.SchemaPtr) { return validationErrorSchemaSubPointerMatch(schemaPointerRegexp, validationError.SchemaPtr, validationErrorSchemaPointerValue(validationError, schemasPath)) } diff --git a/check/checkdata/schema/schema.go b/check/checkdata/schema/schema.go index ab2cc8bee..b61e9a660 100644 --- a/check/checkdata/schema/schema.go +++ b/check/checkdata/schema/schema.go @@ -148,7 +148,7 @@ func pathURI(path *paths.Path) string { return pathURI.String() } -// logValidationError logs the schema validation error data +// logValidationError logs the schema validation error data. func logValidationError(validationError *jsonschema.ValidationError, schemasPath *paths.Path) { logrus.Trace("--------Schema validation failure cause--------") logrus.Tracef("Error message: %s", validationError.Error()) diff --git a/check/checkfunctions/library.go b/check/checkfunctions/library.go index a5179d232..4d04b4be1 100644 --- a/check/checkfunctions/library.go +++ b/check/checkfunctions/library.go @@ -459,7 +459,7 @@ func LibraryPropertiesEmailFieldAsMaintainerAlias() (result checkresult.Type, ou return checkresult.Pass, "" } -// LibraryPropertiesNameFieldLTMinLength checks if the library.properties "email" value is less than the minimum length. +// LibraryPropertiesEmailFieldLTMinLength checks if the library.properties "email" value is less than the minimum length. func LibraryPropertiesEmailFieldLTMinLength() (result checkresult.Type, output string) { if checkdata.LibraryPropertiesLoadError() != nil { return checkresult.NotRun, "" @@ -476,7 +476,7 @@ func LibraryPropertiesEmailFieldLTMinLength() (result checkresult.Type, output s return checkresult.Pass, "" } -// LibraryPropertiesMaintainerFieldStartsWithArduino checks if the library.properties "email" value starts with "Arduino". +// LibraryPropertiesEmailFieldStartsWithArduino checks if the library.properties "email" value starts with "Arduino". func LibraryPropertiesEmailFieldStartsWithArduino() (result checkresult.Type, output string) { if checkdata.LibraryPropertiesLoadError() != nil { return checkresult.NotRun, "" @@ -682,7 +682,7 @@ func LibraryPropertiesArchitecturesFieldMissing() (result checkresult.Type, outp return checkresult.Pass, "" } -// LibraryPropertiesNameFieldLTMinLength checks if the library.properties "architectures" value is less than the minimum length. +// LibraryPropertiesArchitecturesFieldLTMinLength checks if the library.properties "architectures" value is less than the minimum length. func LibraryPropertiesArchitecturesFieldLTMinLength() (result checkresult.Type, output string) { if checkdata.LibraryPropertiesLoadError() != nil { return checkresult.NotRun, "" @@ -782,7 +782,7 @@ func LibraryPropertiesDotALinkageFieldTrueWithFlatLayout() (result checkresult.T return checkresult.Pass, "" } -// LibraryPropertiesNameFieldLTMinLength checks if the library.properties "includes" value is less than the minimum length. +// LibraryPropertiesIncludesFieldLTMinLength checks if the library.properties "includes" value is less than the minimum length. func LibraryPropertiesIncludesFieldLTMinLength() (result checkresult.Type, output string) { if checkdata.LibraryPropertiesLoadError() != nil { return checkresult.NotRun, "" diff --git a/command/command.go b/command/command.go index 75c74d3c7..cb6826b9d 100644 --- a/command/command.go +++ b/command/command.go @@ -30,7 +30,7 @@ import ( "github.com/spf13/cobra" ) -// arduinoCheck is the root command function. +// ArduinoCheck is the root command function. func ArduinoCheck(rootCommand *cobra.Command, cliArguments []string) { if err := configuration.Initialize(rootCommand.Flags(), cliArguments); err != nil { feedback.Errorf("Configuration error: %v", err) diff --git a/configuration/configuration.go b/configuration/configuration.go index d538cec0c..d9574643b 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -150,7 +150,7 @@ func CheckModes(superprojectType projecttype.Type) map[checkmode.Type]bool { var superprojectTypeFilter projecttype.Type -// SuperprojectType returns the superproject type filter configuration. +// SuperprojectTypeFilter returns the superproject type filter configuration. func SuperprojectTypeFilter() projecttype.Type { return superprojectTypeFilter } diff --git a/configuration/defaults.go b/configuration/defaults.go index f5949ec75..3ee4c082a 100644 --- a/configuration/defaults.go +++ b/configuration/defaults.go @@ -22,8 +22,8 @@ import ( "github.com/arduino/arduino-check/project/projecttype" ) -// Default check modes for each superproject type -// Subprojects use the same check modes as the superproject +// Default check modes for each superproject type. +// Subprojects use the same check modes as the superproject. var defaultCheckModes = map[projecttype.Type]map[checkmode.Type]bool{ projecttype.Sketch: { checkmode.Permissive: false, diff --git a/project/library/library.go b/project/library/library.go index c03daae35..37f13e984 100644 --- a/project/library/library.go +++ b/project/library/library.go @@ -61,7 +61,7 @@ var examplesFolderSupportedNames = map[string]struct{}{ "example": empty, } -// ExamplesFolderNames returns a slice of supported examples folder names +// ExamplesFolderSupportedNames returns a slice of supported examples folder names func ExamplesFolderSupportedNames() []string { folderNames := make([]string, 0, len(examplesFolderSupportedNames)) for folderName := range examplesFolderSupportedNames { diff --git a/project/platform/platform.go b/project/platform/platform.go index 4b43ac516..8df64c291 100644 --- a/project/platform/platform.go +++ b/project/platform/platform.go @@ -14,7 +14,7 @@ // To purchase a commercial license, send an email to license@arduino.cc. /* -Package packageindex provides functions specific to checking Arduino boards platforms. +Package platform provides functions specific to checking Arduino boards platforms. See: https://arduino.github.io/arduino-cli/latest/platform-specification/ */ package platform diff --git a/project/project.go b/project/project.go index 95c0dcbaf..a1dae42f1 100644 --- a/project/project.go +++ b/project/project.go @@ -144,7 +144,7 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [ panic(fmt.Sprintf("Subproject discovery not configured for project type: %s", superproject.ProjectType)) } - // Search the subproject paths for projects + // Search the subproject paths for projects. var immediateSubprojects []Type for _, subprojectFolderName := range subprojectFolderNames { subprojectPath := superproject.Path.Join(subprojectFolderName) @@ -186,7 +186,7 @@ func isProject(potentialProjectPath *paths.Path, projectTypeFilter projecttype.T return true, projectType } -// isProject determines if a file is the indicator file for an Arduino project, and if so which type. +// isProjectIndicatorFile determines if a file is the indicator file for an Arduino project, and if so which type. func isProjectIndicatorFile(potentialProjectFilePath *paths.Path, projectTypeFilter projecttype.Type) (bool, projecttype.Type) { logrus.Tracef("Checking if %s is %s indicator file", potentialProjectFilePath, projectTypeFilter) diff --git a/project/projecttype/projecttype.go b/project/projecttype/projecttype.go index b86191838..4a2a8f9f8 100644 --- a/project/projecttype/projecttype.go +++ b/project/projecttype/projecttype.go @@ -50,7 +50,7 @@ func FromString(projectTypeString string) (Type, error) { return Not, fmt.Errorf("No matching project type for string %s", projectTypeString) } -// Matches returns whether the receiver project type matches the argument project type +// Matches returns whether the receiver project type matches the argument project type. func (projectTypeA Type) Matches(projectTypeB Type) bool { if projectTypeA == Not && projectTypeB == Not { return true diff --git a/result/outputformat/outputformat.go b/result/outputformat/outputformat.go index f55a1f0ca..d02955de0 100644 --- a/result/outputformat/outputformat.go +++ b/result/outputformat/outputformat.go @@ -13,7 +13,7 @@ // Arduino software without disclosing the source code of your own applications. // To purchase a commercial license, send an email to license@arduino.cc. -// Package projecttype defines the output formats +// Package outputformat defines the output formats package outputformat import ( diff --git a/result/result.go b/result/result.go index 99f218773..93cfd0614 100644 --- a/result/result.go +++ b/result/result.go @@ -138,7 +138,7 @@ func (results *Type) Record(checkedProject project.Type, checkConfiguration chec }, ) } else { - // There's already a report for this project, just add the checks report to it + // There's already a report for this project; just add the checks report to it. results.Projects[projectReportIndex].Checks = append(results.Projects[projectReportIndex].Checks, checkReport) }