Skip to content

Commit 1626dc3

Browse files
committed
Now really added the function docs
1 parent 49f1aa0 commit 1626dc3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

utils.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var didPrintGitFolderMsg bool = false
2525
var didPrintBowerComponentsMsg bool = false
2626
var didPrintVideoMsg bool = false
2727

28+
// check for the `node_modules` folder
2829
func IsNodeModules(path string) bool {
2930
if strings.Contains(path, string(os.PathSeparator)+"node_modules") {
3031
if !didPrintNodeModulesMsg {
@@ -38,6 +39,7 @@ func IsNodeModules(path string) bool {
3839
return false
3940
}
4041

42+
// check for the `bower_components` folder
4143
func IsBowerComponents(path string) bool {
4244
if strings.Contains(path, string(os.PathSeparator)+"bower_components") {
4345
if !didPrintBowerComponentsMsg {
@@ -51,6 +53,7 @@ func IsBowerComponents(path string) bool {
5153
return false
5254
}
5355

56+
// check if it is a `test` path (i.e., a file that e.g. contains unit tests)
5457
func IsInTestFolder(path string, testsPath string) bool {
5558
// Test folders are treated as follows:
5659
// - if `-tests` is provided, then only the provided path will be treated as a test directory (and thus, excluded)
@@ -88,6 +91,7 @@ func IsCommonTestFolder(path string) bool {
8891
return false
8992
}
9093

94+
// check for common test files (like .spec.js)
9195
func IsTestFile(path string) bool {
9296
testExtensions := [3]string{".spec.ts", ".test.tsx", ".spec.js"}
9397

@@ -105,6 +109,7 @@ func IsTestFile(path string) bool {
105109
return false
106110
}
107111

112+
// check for style sheets (like .css and .scss)
108113
func IsStyleSheet(path string) bool {
109114
if strings.HasSuffix(path, ".css") || strings.HasSuffix(path, ".scss") {
110115
if !didPrintStylesheetsMsg {
@@ -118,6 +123,7 @@ func IsStyleSheet(path string) bool {
118123
return false
119124
}
120125

126+
// check for images (like .jpg, .png, .jpeg)
121127
func IsImage(path string) bool {
122128
imageExtensions := [8]string{".jpg", ".png", ".jpeg", ".gif", ".svg", ".bmp", ".ico", ".icns"}
123129

@@ -135,6 +141,7 @@ func IsImage(path string) bool {
135141
return false
136142
}
137143

144+
// check for documents (like .pdf, .md)
138145
func IsDocument(path string) bool {
139146
// inspired by https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions (and additionally `.md`)
140147
documentExtensions := [38]string{
@@ -162,6 +169,7 @@ func IsDocument(path string) bool {
162169
return false
163170
}
164171

172+
// check for video files
165173
func IsVideo(path string) bool {
166174
// inspired by this list: https://en.wikipedia.org/wiki/Video_file_format
167175
videoExtensions := [18]string{
@@ -183,6 +191,7 @@ func IsVideo(path string) bool {
183191
return false
184192
}
185193

194+
// check for fonts (like .woff)
186195
func IsFont(path string) bool {
187196
fontExtensions := [4]string{".ttf", ".otf", ".woff", ".woff2"}
188197

@@ -200,6 +209,7 @@ func IsFont(path string) bool {
200209
return false
201210
}
202211

212+
// check for the `.git` folder
203213
func IsGitFolder(path string) bool {
204214
if strings.HasSuffix(path, string(os.PathSeparator)+".git") {
205215
if !didPrintGitFolderMsg {
@@ -213,6 +223,7 @@ func IsGitFolder(path string) bool {
213223
return false
214224
}
215225

226+
// check for the dbs (like .db, .sqlite3)
216227
func IsDb(path string) bool {
217228
documentExtensions := [6]string{".db", ".db3", ".sdb", ".sqlite", ".sqlite2", ".sqlite3"}
218229

@@ -230,6 +241,7 @@ func IsDb(path string) bool {
230241
return false
231242
}
232243

244+
// check for the `build` folder
233245
func IsBuildFolder(path string) bool {
234246
if strings.Contains(path, string(os.PathSeparator)+"build") {
235247
if !didPrintBuildMsg {
@@ -243,6 +255,7 @@ func IsBuildFolder(path string) bool {
243255
return false
244256
}
245257

258+
// check for the `dist` folder
246259
func IsDistFolder(path string) bool {
247260
if strings.Contains(path, string(os.PathSeparator)+"dist") {
248261
if !didPrintDistMsg {
@@ -256,6 +269,7 @@ func IsDistFolder(path string) bool {
256269
return false
257270
}
258271

272+
// check for the `public` folder
259273
func IsPublicFolder(path string) bool {
260274
if strings.Contains(path, string(os.PathSeparator)+"public") {
261275
if !didPrintPublicMsg {
@@ -269,6 +283,7 @@ func IsPublicFolder(path string) bool {
269283
return false
270284
}
271285

286+
// check for IDE folder (like .code, .idea)
272287
func IsIdeFolder(path string) bool {
273288
idePaths := [2]string{".vscode", ".idea"}
274289

@@ -286,6 +301,7 @@ func IsIdeFolder(path string) bool {
286301
return false
287302
}
288303

304+
// check for the "misc" not required stuff
289305
func IsMiscNotRequiredFile(path string) bool {
290306
notRequiredSuffices := [3]string{".DS_Store", "__MACOSX", ".gitignore"}
291307

0 commit comments

Comments
 (0)