Skip to content

Commit

Permalink
rewrote link url checker logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidanio committed Jul 28, 2024
1 parent 38a94b1 commit 1384b93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rules/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions src/tests/rules/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ($_);
`
Expand All @@ -354,7 +354,7 @@ function f() {
`)

test.Expect = []string{
` | More about this rule: https://goodrule.com`,
` | More about this rule: goodrule.com`,
}
test.RunRulesTest()
}
Expand Down

0 comments on commit 1384b93

Please sign in to comment.