From 02246d787718e3a0750fde1ba822c33e9b1d2219 Mon Sep 17 00:00:00 2001 From: Richardas Kuchinskas Date: Mon, 5 Aug 2024 14:13:40 +0300 Subject: [PATCH] removed checker for url --- go.sum | 2 ++ src/linter/cache.go | 1 - src/rules/parser.go | 11 +---------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/go.sum b/go.sum index fe673e309..ccaf2cea4 100644 --- a/go.sum +++ b/go.sum @@ -9,9 +9,11 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.4.0 h1:uCmaf4vVbWAOZz36k1hrQD7ijGRzLwaME8Am/7a4jZI= github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE= github.com/quasilyte/regex/syntax v0.0.0-20200419152657-af9db7f4a3ab h1:rjBjlam2Bbr6Dwp0T8HY2paibXTjMsNQU7vUH8hB+C4= github.com/quasilyte/regex/syntax v0.0.0-20200419152657-af9db7f4a3ab/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/yookoala/realpath v1.0.0 h1:7OA9pj4FZd+oZDsyvXWQvjn5oBdcHRTV44PpdMSuImQ= github.com/yookoala/realpath v1.0.0/go.mod h1:gJJMA9wuX7AcqLy1+ffPatSCySA1FQ2S8Ya9AIoYBpE= go.lsp.dev/uri v0.3.0 h1:KcZJmh6nFIBeJzTugn5JTU6OOyG0lDOo3R9KwTxTYbo= go.lsp.dev/uri v0.3.0/go.mod h1:P5sbO1IQR+qySTWOCnhnK7phBx+W3zbLqSMDJNTw88I= diff --git a/src/linter/cache.go b/src/linter/cache.go index 5c5d08d4c..79d499e64 100644 --- a/src/linter/cache.go +++ b/src/linter/cache.go @@ -51,7 +51,6 @@ import ( // 52 - renamed all PhpDoc and Phpdoc with PHPDoc // 53 - added DeprecationInfo for functions and methods and support for some attributes // 54 - forced cache version invalidation due to the #1165 -// 55 - added @link tag -> new field in Rule const cacheVersion = 54 var ( diff --git a/src/rules/parser.go b/src/rules/parser.go index bf3a39c4f..f68516637 100644 --- a/src/rules/parser.go +++ b/src/rules/parser.go @@ -181,11 +181,7 @@ func (p *parser) parseRuleInfo(st ir.Node, labelStmt ir.Node, proto *Rule) (Rule if len(part.Params) != 1 { return rule, p.errorf(st, "@link expects exactly 1 param, got %d", len(part.Params)) } - var link = part.Params[0] - if !isURL(link) { - return rule, p.errorf(st, "@link argument is not link") - } - rule.Link = link + rule.Link = part.Params[0] case "location": if len(part.Params) != 1 { @@ -348,11 +344,6 @@ func (p *parser) parseRuleInfo(st ir.Node, labelStmt ir.Node, proto *Rule) (Rule return rule, nil } -func isURL(str string) bool { - re := regexp.MustCompile(`^((https?|ftp)://)?[^\s/$.?#].\S*$`) - return re.MatchString(str) -} - func (p *parser) parseRules(stmts []ir.Node, proto *Rule) error { for len(stmts) > 0 { stmt := stmts[0]