From 79b216c956e8b8da34bf8b708cda1854e400ea2c Mon Sep 17 00:00:00 2001 From: laurentsimon <64505099+laurentsimon@users.noreply.github.com> Date: Wed, 2 Feb 2022 08:31:42 -0800 Subject: [PATCH] checks/security_policy_test.go: updated unit tests (#1590) checks/raw/security_policy.go: add support for .adoc policies --- checks/raw/security_policy.go | 10 ++++++++-- checks/security_policy_test.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/checks/raw/security_policy.go b/checks/raw/security_policy.go index fbcdf9ecdaeb..2a171d522b32 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, diff --git a/checks/security_policy_test.go b/checks/security_policy_test.go index 6729ad3f2287..e4d12dc521df 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