From c17209e103ce5caddd90e9e5ef0e9f7aee9e38dc Mon Sep 17 00:00:00 2001 From: laurentsimon Date: Wed, 2 Feb 2022 15:45:53 +0000 Subject: [PATCH 1/2] checks/security_policy_test.go: updated unit tests checks/raw/security_policy.go: add support for .adoc policies --- checks/raw/security_policy.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/checks/raw/security_policy.go b/checks/raw/security_policy.go index fbcdf9ecdae..2a171d522b3 100644 --- a/checks/raw/security_policy.go +++ b/checks/raw/security_policy.go @@ -39,7 +39,10 @@ func SecurityPolicy(c *checker.CheckRequest) (checker.SecurityPolicyData, error) } if strings.EqualFold(name, "security.md") || strings.EqualFold(name, ".github/security.md") || - strings.EqualFold(name, "docs/security.md") { + strings.EqualFold(name, "docs/security.md") || + strings.EqualFold(name, "security.adoc") || + strings.EqualFold(name, ".github/security.adoc") || + strings.EqualFold(name, "docs/security.adoc") { *pfiles = append(*pfiles, checker.File{ Path: name, Type: checker.FileTypeSource, @@ -89,7 +92,10 @@ func SecurityPolicy(c *checker.CheckRequest) (checker.SecurityPolicyData, error) } if strings.EqualFold(name, "security.md") || strings.EqualFold(name, ".github/security.md") || - strings.EqualFold(name, "docs/security.md") { + strings.EqualFold(name, "docs/security.md") || + strings.EqualFold(name, "security.adoc") || + strings.EqualFold(name, ".github/security.adoc") || + strings.EqualFold(name, "docs/security.adoc") { *pfiles = append(*pfiles, checker.File{ Path: name, Type: checker.FileTypeURL, From 69a6c50ed35eaf1723782af5a0bebdc3a45a9737 Mon Sep 17 00:00:00 2001 From: laurentsimon Date: Wed, 2 Feb 2022 15:48:00 +0000 Subject: [PATCH 2/2] unit tests --- checks/security_policy_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/checks/security_policy_test.go b/checks/security_policy_test.go index 6729ad3f228..e4d12dc521d 100644 --- a/checks/security_policy_test.go +++ b/checks/security_policy_test.go @@ -83,6 +83,36 @@ func TestSecurityPolicy(t *testing.T) { NumberOfInfo: 1, }, }, + { + name: "security.adoc", + files: []string{ + "security.adoc", + }, + want: scut.TestReturn{ + Score: 10, + NumberOfInfo: 1, + }, + }, + { + name: ".github/security.adoc", + files: []string{ + ".github/security.adoc", + }, + want: scut.TestReturn{ + Score: 10, + NumberOfInfo: 1, + }, + }, + { + name: "docs/security.adoc", + files: []string{ + "docs/security.adoc", + }, + want: scut.TestReturn{ + Score: 10, + NumberOfInfo: 1, + }, + }, } for _, tt := range tests { tt := tt