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

count-down-loop diagnostic misses cases #1365

Closed
carsakiller opened this issue Jul 21, 2022 · 1 comment
Closed

count-down-loop diagnostic misses cases #1365

carsakiller opened this issue Jul 21, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@carsakiller
Copy link
Collaborator

carsakiller commented Jul 21, 2022

The problem

The count-down-loop diagnostic does not warn all the time when the loop end cannot be reached due to it being less than the loop start.

-- warns
for i=10, 1 do end

-- does not warn
for i=100, 10, 1 do end

There is also no count-down-loop equivalent for loops that count up but never reach the end of the loop:

-- does not warn
for i=1, -10 do end

--does not warn
for i=-10, 100, -1 do end

The solution

I think the count-down-loop diagnostic should be renamed to loop-never-ends. It can then be used for all of the cases above.

Originally posted by @carsakiller in #1362 (reply in thread)

@sumneko sumneko added the bug Something isn't working label Jul 22, 2022
@sumneko
Copy link
Collaborator

sumneko commented Jul 25, 2022

It should be loop-only-once instead of loop-never-ends.

However this check is used for preventing missing the step. If the user remembers to write the step, he will not write it wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants