google / google/go-jsonnet

Unused variable incorrectly reported by `jsonnet-lint`

Open
#778 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

Looks like the circumstance is very specific -- when the var is being used in an assert statement as part of an object.

**Expectation**: jsonnet-lint does not report any error in this source file.
**Actual**: jsonnet-lint reports unused variable error
**Details**:
```
% cat assert_lint.jsonnet
local myvar = 'xxxxx';

{
assert std.length(myvar) == 5 : 'yyyyy',
some_field: 'zzzzz',
}

% jsonnet-lint --version
Jsonnet linter v0.20.0

% jsonnet-lint assert_lint.jsonnet
assert_lint.jsonnet:1:7-22 Unused variable: myvar

local myvar = 'xxxxx';

Problems found!
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.