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 function reported as "Unused assignment" #42

Open
hauserx opened this issue Jun 28, 2024 · 3 comments
Open

Unused function reported as "Unused assignment" #42

hauserx opened this issue Jun 28, 2024 · 3 comments

Comments

@hauserx
Copy link

hauserx commented Jun 28, 2024

Possibly that's issue with implementation in starlark-rust, but filling for now here before investigating further:

image

Example message in python checker:
local variable 'x' is assigned to but never used

@cameron-martin
Copy link
Owner

Yeah it looks like starlark-rust treats defs as assignments. I suppose they kind of are, but it doesn't make for a very good error message.

@hauserx
Copy link
Author

hauserx commented Jun 28, 2024

For variables also unused assignment may not be the best message:

image

I think it should be "Unused variable" for vars - https://github.com/bazelbuild/starlark/blob/master/spec.md#assignments

For functions it could be "Unused variable" (as Following spec https://github.com/bazelbuild/starlark/blob/master/spec.md#function-definitions ), but probably "Unused function" should be acceptable as def always declare a function.

@hauserx
Copy link
Author

hauserx commented Jul 4, 2024

Adding yet another message that possibly can be improved (Used ignored variable).
In this case variable _a is not defined at all, so message that using some ignore value is confusing.

image

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

No branches or pull requests

2 participants