diff --git a/src/rules/parser.go b/src/rules/parser.go index f18870ba..6fa88e53 100644 --- a/src/rules/parser.go +++ b/src/rules/parser.go @@ -349,7 +349,7 @@ func (p *parser) parseRuleInfo(st ir.Node, labelStmt ir.Node, proto *Rule) (Rule } func isURL(str string) bool { - re := regexp.MustCompile(`^(https?|ftp)://[^\s/$.?#].\S*$`) + re := regexp.MustCompile(`^((https?|ftp)://)?[^\s/$.?#].[^\s]*$`) return re.MatchString(str) } diff --git a/src/tests/rules/rules_test.go b/src/tests/rules/rules_test.go index 02a2df5f..eea8f280 100644 --- a/src/tests/rules/rules_test.go +++ b/src/tests/rules/rules_test.go @@ -338,7 +338,7 @@ func TestLinkTag(t *testing.T) { * @name emptyIf * @warning suspicious empty body of the if statement * @scope local - * @link https://goodrule.com + * @link goodrule.com */ if ($_); ` @@ -354,7 +354,7 @@ function f() { `) test.Expect = []string{ - ` | More about this rule: https://goodrule.com`, + ` | More about this rule: goodrule.com`, } test.RunRulesTest() }