dlang-community / D-Scanner

Swiss-army knife for D source code
Boost Software License 1.0
240 stars 80 forks source link

Interactive fix is not working for me #916

Closed gizmomogwai closed 1 year ago

gizmomogwai commented 1 year ago

When I run dscanner in version 4c759b072cafa9df5a947b87667a74bf2e387e2a against my code, I get for example:

 dscanner fix
[1 / 5] ./source/tui/package.d(448:5): Warning: Auto function without return statement, prefer replacing auto with void (auto_function_check)
    auto setInputHandler(InputHandler inputHandler)
    ^^^^
0) Skip
1) Replace `auto` with `void`
 > 1
core.exception.ArrayIndexError@src/dscanner/analysis/run.d(463): index [1] is out of bounds for array of length 1
----------------
??:? object.Throwable.TraceInfo core.runtime.defaultTraceHandler(void*) [0x10246bad3]
/Users/christian.koestlin/Sync/projects/_d/external/D-Scanner/src/dscanner/main.d:302 _Dmain [0x1020f5f03]

Seems like an off by one in the interactive handling...

WebFreak001 commented 1 year ago

ah, did some rewrites there and didn't add a test for that, good catch. Gonna add a test for this.

If you have any ideas for how to improve the CLI as well, feel free to open more issues for those.

Also feel free to open issues for autofix suggestions for existing or new checks.

gizmomogwai commented 1 year ago

Thanks for the quick fix ... works for me now. I think I need to install VSCode with your plugin now :) When will the fix suggestion fix land in d-plug?

WebFreak001 commented 1 year ago

will be in the next nightly build in ~4 hours

gizmomogwai commented 1 year ago

awesome ... works nicely!