Skip to content
New issue

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

unused var, but it is used. #493

Closed
KrunchMuffin opened this issue Dec 18, 2017 · 7 comments
Closed

unused var, but it is used. #493

KrunchMuffin opened this issue Dec 18, 2017 · 7 comments

Comments

@KrunchMuffin
Copy link

so it seems if I do something like this

var foo = "";
transaction {
    foo = 1; 
    ...other stuff...
}

I get a cflint error saying foo is unused. If I put it inside the transaction error goes away.
I don't know if this is a bug or actually a real case scenario. Never heard that variables made outside a transaction are not available inside a transaction, but maybe it is the case.
Anyone know for sure?

@ryaneberly
Copy link
Contributor

cflint is not making a statement about the nature of transactions and variables. I think this is a CFLint false positive bug.

@ryaneberly ryaneberly added this to the 1.3.0 milestone Dec 18, 2017
@ryaneberly ryaneberly added the bug label Dec 18, 2017
@KamasamaK
Copy link
Collaborator

KamasamaK commented Dec 18, 2017

As I understand the rule, assignment does not constitute usage, so I would expect it to also report within the transaction as presented. I'm not sure I would call the issue a false positive without seeing the case where it reports.

@KrunchMuffin
Copy link
Author

here u go

image

@KamasamaK
Copy link
Collaborator

So because it is returned, it should definitely be seen as used.

Regardless, I am still confused. You said when it's put inside the transaction error goes away, but you are also saying that it is reporting it here where it is in a transaction. What exactly makes the error go away?

@KrunchMuffin
Copy link
Author

KrunchMuffin commented Dec 19, 2017

No, if I set the var inside the transaction it goes away, didn't make that very clear, in original post, sorry.
image

@KamasamaK
Copy link
Collaborator

I see. When it's declared in the transaction block then it's fine. Thanks for clarifying.

ryaneberly added a commit that referenced this issue Dec 21, 2017
@ryaneberly
Copy link
Contributor

hmm, first while blocks, and now transaction blocks. Both were being skipped by cflint. I believe any others should be resolved in a generic fashion now.

This is fixed in dev branch, will be available in 1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants