We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test data: https://github.com/delivery-club/delivery-club-rules/pull/10/files#diff-bf9f37c58b689ce834e8781b80ae7847ced4dc609d23d447f8bd8c45897fef28R27
rule: https://github.com/delivery-club/delivery-club-rules/pull/10/files#diff-906e4911c776d38b1d51a714ad179489432725792e05faff1efb36298e374321R411
Go version: 1.17.3
as i see there must be warning with current rules set
The text was updated successfully, but these errors were encountered:
test data:
var globalVar *os.File func negative2() { globalVar, _ = ioutil.TempFile("", "") // global var kk := globalVar.Name() print(kk) }
rule:
func unclosedResource(m dsl.Matcher) { varEscapeFunction := func(x dsl.Var) bool { return x.Contains(`$_($*_, $res, $*_)`) || x.Contains(`$_{$*_, $res, $*_}`) || x.Contains(`$_{$*_, $_: $res, $*_}`) || x.Contains(`$_ <- $res`) || x.Contains(`return $*_, $res, $*_`) || x.Contains(`$_[$_] = $res`) || x.Contains(`$_[$res] = $_`) } m.Match(`$res, $err := $open($*_); $*body`, `$res, $err = $open($*_); $*body`, `var $res, $err = $open($*_); $*body`, ). Where(m["res"].Type.Implements(`io.Closer`) && m["err"].Type.Implements(`error`) && (!m["body"].Contains(`$res.Close()`) && !varEscapeFunction(m["body"]))). Report(`$res.Close() should be deferred right after the $open error check`). At(m["res"]) }
debug-group output:
rejected by m["err"].Type.Implements(`error`)
so as i see if we nulify second var in = assignment , it doesn't have error type in current implemntation
=
Sorry, something went wrong.
No branches or pull requests
test data: https://github.com/delivery-club/delivery-club-rules/pull/10/files#diff-bf9f37c58b689ce834e8781b80ae7847ced4dc609d23d447f8bd8c45897fef28R27
rule: https://github.com/delivery-club/delivery-club-rules/pull/10/files#diff-906e4911c776d38b1d51a714ad179489432725792e05faff1efb36298e374321R411
Go version: 1.17.3
as i see there must be warning with current rules set
The text was updated successfully, but these errors were encountered: