Skip to content

Commit f850494

Browse files
committed
Rename checkdata package to projectdata
The purpose of this package is collecting the data on a project, so "projectdata" is a more appropriate name.
1 parent 2fe6726 commit f850494

File tree

25 files changed

+224
-224
lines changed

25 files changed

+224
-224
lines changed

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
# Test files
88
/internal/check/schema/testdata/input/invalid-schema.json
9-
/internal/project/checkdata/testdata/packageindexes/invalid-JSON/package_foo_index.json
9+
/internal/project/projectdata/testdata/packageindexes/invalid-JSON/package_foo_index.json
1010
/internal/check/checkfunctions/testdata/packageindexes/invalid-JSON/package_foo_index.json
1111
/internal/check/checkfunctions/testdata/sketches/InvalidJSONMetadataFile/sketch.json

internal/check/check.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/arduino/arduino-lint/internal/configuration"
2525
"github.com/arduino/arduino-lint/internal/configuration/checkmode"
2626
"github.com/arduino/arduino-lint/internal/project"
27-
"github.com/arduino/arduino-lint/internal/project/checkdata"
27+
"github.com/arduino/arduino-lint/internal/project/projectdata"
2828
"github.com/arduino/arduino-lint/internal/result"
2929
"github.com/arduino/arduino-lint/internal/result/feedback"
3030
"github.com/sirupsen/logrus"
@@ -34,7 +34,7 @@ import (
3434
func RunChecks(project project.Type) {
3535
feedback.Printf("\nChecking %s in %s\n", project.ProjectType, project.Path)
3636

37-
checkdata.Initialize(project)
37+
projectdata.Initialize(project)
3838

3939
for _, checkConfiguration := range checkconfigurations.Configurations() {
4040
runCheck, err := shouldRun(checkConfiguration, project)

internal/check/checkfunctions/checkfunctions.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"strings"
2424

2525
"github.com/arduino/arduino-lint/internal/check/checkresult"
26-
"github.com/arduino/arduino-lint/internal/project/checkdata"
26+
"github.com/arduino/arduino-lint/internal/project/projectdata"
2727
"github.com/arduino/arduino-lint/internal/project/sketch"
2828
"github.com/arduino/go-paths-helper"
2929
)
@@ -34,17 +34,17 @@ type Type func() (result checkresult.Type, output string)
3434

3535
// MissingReadme checks if the project has a readme that will be recognized by GitHub.
3636
func MissingReadme() (result checkresult.Type, output string) {
37-
if checkdata.ProjectType() != checkdata.SuperProjectType() {
37+
if projectdata.ProjectType() != projectdata.SuperProjectType() {
3838
return checkresult.Skip, "Readme not required for subprojects"
3939
}
4040

4141
// https://github.com/github/markup/blob/master/README.md
4242
readmeRegexp := regexp.MustCompile(`(?i)^readme\.(markdown)|(mdown)|(mkdn)|(md)|(textile)|(rdoc)|(org)|(creole)|(mediawiki)|(wiki)|(rst)|(asciidoc)|(adoc)|(asc)|(pod)|(txt)$`)
4343

4444
// https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-readmes#about-readmes
45-
if pathContainsRegexpMatch(checkdata.ProjectPath(), readmeRegexp) ||
46-
(checkdata.ProjectPath().Join("docs").Exist() && pathContainsRegexpMatch(checkdata.ProjectPath().Join("docs"), readmeRegexp)) ||
47-
(checkdata.ProjectPath().Join(".github").Exist() && pathContainsRegexpMatch(checkdata.ProjectPath().Join(".github"), readmeRegexp)) {
45+
if pathContainsRegexpMatch(projectdata.ProjectPath(), readmeRegexp) ||
46+
(projectdata.ProjectPath().Join("docs").Exist() && pathContainsRegexpMatch(projectdata.ProjectPath().Join("docs"), readmeRegexp)) ||
47+
(projectdata.ProjectPath().Join(".github").Exist() && pathContainsRegexpMatch(projectdata.ProjectPath().Join(".github"), readmeRegexp)) {
4848
return checkresult.Pass, ""
4949
}
5050

@@ -53,7 +53,7 @@ func MissingReadme() (result checkresult.Type, output string) {
5353

5454
// MissingLicenseFile checks if the project has a license file that will be recognized by GitHub.
5555
func MissingLicenseFile() (result checkresult.Type, output string) {
56-
if checkdata.ProjectType() != checkdata.SuperProjectType() {
56+
if projectdata.ProjectType() != projectdata.SuperProjectType() {
5757
return checkresult.Skip, "License file not required for subprojects"
5858
}
5959

@@ -64,7 +64,7 @@ func MissingLicenseFile() (result checkresult.Type, output string) {
6464
licenseRegexp := regexp.MustCompile(`(?i)^(((un)?licen[sc]e)|(copy(ing|right))|(ofl)|(patents))(\.((md)|(markdown)|(txt)|(html)))?$`)
6565

6666
// License file must be in root of repo
67-
if pathContainsRegexpMatch(checkdata.ProjectPath(), licenseRegexp) {
67+
if pathContainsRegexpMatch(projectdata.ProjectPath(), licenseRegexp) {
6868
return checkresult.Pass, ""
6969
}
7070

@@ -75,7 +75,7 @@ func MissingLicenseFile() (result checkresult.Type, output string) {
7575
func IncorrectArduinoDotHFileNameCase() (result checkresult.Type, output string) {
7676
incorrectCaseRegexp := regexp.MustCompile(`^\s*#\s*include\s*["<](a((?i)rduino)|(ARDUINO))\.[hH][">]`)
7777

78-
directoryListing, err := checkdata.ProjectPath().ReadDirRecursive()
78+
directoryListing, err := projectdata.ProjectPath().ReadDirRecursive()
7979
if err != nil {
8080
panic(err)
8181
}

internal/check/checkfunctions/checkfunctions_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
"github.com/arduino/arduino-lint/internal/check/checkresult"
2424
"github.com/arduino/arduino-lint/internal/project"
25-
"github.com/arduino/arduino-lint/internal/project/checkdata"
25+
"github.com/arduino/arduino-lint/internal/project/projectdata"
2626
"github.com/arduino/arduino-lint/internal/project/projecttype"
2727
"github.com/arduino/go-paths-helper"
2828
"github.com/stretchr/testify/assert"
@@ -54,7 +54,7 @@ func checkCheckFunction(checkFunction Type, testTables []checkFunctionTestTable,
5454
SuperprojectType: testTable.superProjectType,
5555
}
5656

57-
checkdata.Initialize(testProject)
57+
projectdata.Initialize(testProject)
5858

5959
result, output := checkFunction()
6060
assert.Equal(t, testTable.expectedCheckResult, result, testTable.testName)

0 commit comments

Comments
 (0)