@@ -32,43 +32,6 @@ import (
3232// The `output` result is the contextual information that will be inserted into the check's message template.
3333type Type func () (result checkresult.Type , output string )
3434
35- // validProjectPathBaseName checks whether the provided library folder or sketch filename contains prohibited characters.
36- func validProjectPathBaseName (name string ) bool {
37- baseNameRegexp := regexp .MustCompile ("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" )
38- return baseNameRegexp .MatchString (name )
39- }
40-
41- func containsMisspelledPathBaseName (pathList paths.PathList , correctBaseName string , misspellingQuery string ) (* paths.Path , bool ) {
42- misspellingRegexp := regexp .MustCompile (misspellingQuery )
43- for _ , path := range pathList {
44- if path .Base () == correctBaseName {
45- return nil , false
46- }
47-
48- if misspellingRegexp .MatchString (path .Base ()) {
49- return path , true
50- }
51- }
52-
53- return nil , false
54- }
55-
56- func containsIncorrectPathBaseCase (pathList paths.PathList , correctBaseName string ) (* paths.Path , bool ) {
57- for _ , path := range pathList {
58- if path .Base () == correctBaseName {
59- // There was a case-sensitive match (paths package's Exist() is not always case-sensitive, so can't be used here).
60- return nil , false
61- }
62-
63- if strings .EqualFold (path .Base (), correctBaseName ) {
64- // There was a case-insensitive match.
65- return path , true
66- }
67- }
68-
69- return nil , false
70- }
71-
7235// MissingReadme checks if the project has a readme that will be recognized by GitHub.
7336func MissingReadme () (result checkresult.Type , output string ) {
7437 if checkdata .ProjectType () != checkdata .SuperProjectType () {
@@ -138,6 +101,43 @@ func IncorrectArduinoDotHFileNameCase() (result checkresult.Type, output string)
138101 return checkresult .Pass , ""
139102}
140103
104+ // validProjectPathBaseName checks whether the provided library folder or sketch filename contains prohibited characters.
105+ func validProjectPathBaseName (name string ) bool {
106+ baseNameRegexp := regexp .MustCompile ("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" )
107+ return baseNameRegexp .MatchString (name )
108+ }
109+
110+ func containsMisspelledPathBaseName (pathList paths.PathList , correctBaseName string , misspellingQuery string ) (* paths.Path , bool ) {
111+ misspellingRegexp := regexp .MustCompile (misspellingQuery )
112+ for _ , path := range pathList {
113+ if path .Base () == correctBaseName {
114+ return nil , false
115+ }
116+
117+ if misspellingRegexp .MatchString (path .Base ()) {
118+ return path , true
119+ }
120+ }
121+
122+ return nil , false
123+ }
124+
125+ func containsIncorrectPathBaseCase (pathList paths.PathList , correctBaseName string ) (* paths.Path , bool ) {
126+ for _ , path := range pathList {
127+ if path .Base () == correctBaseName {
128+ // There was a case-sensitive match (paths package's Exist() is not always case-sensitive, so can't be used here).
129+ return nil , false
130+ }
131+
132+ if strings .EqualFold (path .Base (), correctBaseName ) {
133+ // There was a case-insensitive match.
134+ return path , true
135+ }
136+ }
137+
138+ return nil , false
139+ }
140+
141141// pathContainsRegexpMatch checks if the provided path contains a file name matching the given regular expression.
142142func pathContainsRegexpMatch (path * paths.Path , pathRegexp * regexp.Regexp ) bool {
143143 listing , err := path .ReadDir ()
0 commit comments