From 9b26e7129501f8ce60bdb112f72425a59f76481b Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 8 Mar 2021 22:54:58 -0800 Subject: [PATCH] Correct readme filename regular expression Missing parentheses resulted in the regular expression matching files that are not recognized as a readme by GitHub. --- internal/rule/rulefunction/rulefunction.go | 2 +- .../testdata/general/no-readme/{.gitkeep => notreadme.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename internal/rule/rulefunction/testdata/general/no-readme/{.gitkeep => notreadme.md} (100%) diff --git a/internal/rule/rulefunction/rulefunction.go b/internal/rule/rulefunction/rulefunction.go index 7c158a4b7..5c338581b 100644 --- a/internal/rule/rulefunction/rulefunction.go +++ b/internal/rule/rulefunction/rulefunction.go @@ -35,7 +35,7 @@ type Type func() (result ruleresult.Type, output string) // MissingReadme checks if the project has a readme that will be recognized by GitHub. func MissingReadme() (result ruleresult.Type, output string) { // https://github.com/github/markup/blob/master/README.md - readmeRegexp := regexp.MustCompile(`(?i)^readme\.(markdown)|(mdown)|(mkdn)|(md)|(textile)|(rdoc)|(org)|(creole)|(mediawiki)|(wiki)|(rst)|(asciidoc)|(adoc)|(asc)|(pod)|(txt)$`) + readmeRegexp := regexp.MustCompile(`(?i)^readme\.((markdown)|(mdown)|(mkdn)|(md)|(textile)|(rdoc)|(org)|(creole)|(mediawiki)|(wiki)|(rst)|(asciidoc)|(adoc)|(asc)|(pod)|(txt))$`) // https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-readmes#about-readmes if pathContainsRegexpMatch(projectdata.ProjectPath(), readmeRegexp) || diff --git a/internal/rule/rulefunction/testdata/general/no-readme/.gitkeep b/internal/rule/rulefunction/testdata/general/no-readme/notreadme.md similarity index 100% rename from internal/rule/rulefunction/testdata/general/no-readme/.gitkeep rename to internal/rule/rulefunction/testdata/general/no-readme/notreadme.md