Skip to content

Commit 30802ee

Browse files
committed
Don't run the readme check for subprojects
The superproject should have a readme, but it's not necessarily essential for the subproject to have one as well.
1 parent 75672fe commit 30802ee

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

check/checkfunctions/checkfunctions.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ func containsIncorrectPathBaseCase(pathList paths.PathList, correctBaseName stri
6969

7070
// MissingReadme checks if the project has a readme that will be recognized by GitHub.
7171
func MissingReadme() (result checkresult.Type, output string) {
72+
if checkdata.ProjectType() != checkdata.SuperProjectType() {
73+
return checkresult.NotRun, "Readme not required for subprojects"
74+
}
75+
7276
// https://github.com/github/markup/blob/master/README.md
7377
readmeRegexp := regexp.MustCompile(`(?i)^readme\.(markdown)|(mdown)|(mkdn)|(md)|(textile)|(rdoc)|(org)|(creole)|(mediawiki)|(wiki)|(rst)|(asciidoc)|(adoc)|(asc)|(pod)|(txt)`)
7478

check/checkfunctions/library_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,4 +400,15 @@ func TestMissingReadme(t *testing.T) {
400400
}
401401

402402
checkLibraryCheckFunction(MissingReadme, testTables, t)
403+
404+
testProject := project.Type{
405+
Path: testDataPath.Join("NoReadme"),
406+
ProjectType: projecttype.Library,
407+
SuperprojectType: projecttype.Platform,
408+
}
409+
410+
checkdata.Initialize(testProject, schemasPath)
411+
412+
result, _ := MissingReadme()
413+
assert.Equal(t, checkresult.NotRun, result, "Don't run for subprojects")
403414
}

0 commit comments

Comments
 (0)