Thread overview |
---|
February 13, 2020 Dscanner: is it possible to switch off style checks case-by-case? | ||||
---|---|---|---|---|
| ||||
I'm starting out with GtkD and have this function: void main(string[] args) { Main.init(args); auto game = new GameWindow(); Main.run(); } and this method: void quit(Widget widget) { Main.quit(); } When I run dscanner --styleCheck it reports: ./src/app.d(10:10)[warn]: Variable game is never used. ./src/app.d(22:22)[warn]: Parameter widget is never used. These are correct. However, is it possible to switch them off individually? (In Python you can switch off lint checks using a special text in a comment at the end of the line.) |
February 15, 2020 Re: Dscanner: is it possible to switch off style checks case-by-case? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mark | On Thursday, 13 February 2020 at 17:15:50 UTC, mark wrote: > I'm starting out with GtkD and have this function: > > void main(string[] args) { > Main.init(args); > auto game = new GameWindow(); > Main.run(); > } > > and this method: > > void quit(Widget widget) { > Main.quit(); > } > > When I run dscanner --styleCheck it reports: > > ./src/app.d(10:10)[warn]: Variable game is never used. > ./src/app.d(22:22)[warn]: Parameter widget is never used. > > These are correct. However, is it possible to switch them off individually? Yes you can but in the present case the analysis is right because you can write void main(string[] args) { Main.init(args); new GameWindow(); Main.run(); } and for the other void quit(Widget) { Main.quit(); } or even void quit() { Main.quit(); } Otherwise here is an example of how you can tune the different checks: https://raw.githubusercontent.com/dlang/phobos/master/.dscanner.ini See also the last section of https://raw.githubusercontent.com/dlang-community/D-Scanner/master/README.md |
February 15, 2020 Re: Dscanner: is it possible to switch off style checks case-by-case? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Saturday, 15 February 2020 at 07:23:02 UTC, Basile B. wrote: > On Thursday, 13 February 2020 at 17:15:50 UTC, mark wrote: >> I'm starting out with GtkD and have this function: >> [snip] > Otherwise here is an example of how you can tune the different checks: > > https://raw.githubusercontent.com/dlang/phobos/master/.dscanner.ini > > See also the last section of > > https://raw.githubusercontent.com/dlang-community/D-Scanner/master/README.md Thank you, I made the code changes and am reading the docs you linked to. |
February 15, 2020 Re: Dscanner: is it possible to switch off style checks case-by-case? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mark | On Thursday, 13 February 2020 at 17:15:50 UTC, mark wrote: > I'm starting out with GtkD and have this function: > > void main(string[] args) { > Main.init(args); > auto game = new GameWindow(); > Main.run(); > } > > and this method: > > void quit(Widget widget) { > Main.quit(); > } > > When I run dscanner --styleCheck it reports: > > ./src/app.d(10:10)[warn]: Variable game is never used. > ./src/app.d(22:22)[warn]: Parameter widget is never used. > > These are correct. However, is it possible to switch them off individually? > > (In Python you can switch off lint checks using a special text in a comment at the end of the line.) With DLS, you can use @suppress in comment: void quit(Widget widget) // @suppress(dscanner.suspicious.unused_parameter) { Main.quit(); } more info: https://code.dlang.org/packages/dls Simply install the extension to your editor. |
Copyright © 1999-2021 by the D Language Foundation