digitalmars.D - Code size without documentation comments and unittests
- Andrei Alexandrescu (3/3) Feb 25 2017 What would be a simple way to count the "effective" lines in a module,
- Timothee Cour via Digitalmars-d (9/9) Feb 25 2017 Try dscanner --sloc although IMO --tokenCount should be the most relevan...
- Andrei Alexandrescu (34/37) Feb 25 2017 Thanks, got that working with ease. The operation of dub has gotten
- Seb (28/47) Feb 25 2017 I think that the DUB issue list [0]
- Andrei Alexandrescu (2/5) Feb 26 2017 Cool, that does it for me. Thanks! -- Andrei
- hmm (5/18) Feb 26 2017 Are you sure?
- Andrei Alexandrescu (2/17) Feb 26 2017 Apparently I was wrong. Thanks for the correction! -- Andrei
- Andrei Alexandrescu (3/24) Feb 26 2017 Ergh, I did the undignified: removed all doc comments and unittessts
- Jack Stouffer (4/5) Feb 25 2017 I installed dscanner from my package manager (homebrew), so I
- Jacob Carlborg (5/40) Feb 26 2017 Dub is not intended for end user installation of programs/tools. The
- Guest (4/15) Feb 26 2017 The SLOC count is incorrect in Dscanner, for example for
- Jack Stouffer (4/7) Feb 25 2017 Fun fact I found out using this thread: 57.4% of the lines in
- Andrei Alexandrescu (3/9) Feb 26 2017 That's kinda where it could reasonably be, and also it's a good
What would be a simple way to count the "effective" lines in a module, i.e. excluding ddoc comments and unittests? Having a tool for that in tools/ would be neat. -- Andrei
Feb 25 2017
Try dscanner --sloc although IMO --tokenCount should be the most relevant metric (only caveat is mixin strings with which one could cheat to make token count smaller). TokenCount formatting invariant On Feb 25, 2017 11:36 AM, "Andrei Alexandrescu via Digitalmars-d" < digitalmars-d puremagic.com> wrote: What would be a simple way to count the "effective" lines in a module, i.e. excluding ddoc comments and unittests? Having a tool for that in tools/ would be neat. -- Andrei
Feb 25 2017
On 2/25/17 2:55 PM, Timothee Cour via Digitalmars-d wrote:Try dscanner --sloc although IMO --tokenCount should be the most relevant metric (only caveat is mixin strings with which one could cheat to make token count smaller).Thanks, got that working with ease. The operation of dub has gotten quite a bit smoother, props to Sönke! One thing that I found surprising is the chatter that seems impossible to mute. Here's a session: $ dub run dscanner -- --sloc ../phobos/std/traits.d Building package dscanner in /Users/andrei/.dub/packages/dscanner-0.4.0/ Target libdparse 0.7.0 is up to date. Use --force to rebuild. Target emsi_containers 0.5.3 is up to date. Use --force to rebuild. Target dsymbol 0.2.0 is up to date. Use --force to rebuild. Target inifiled 0.0.6 is up to date. Use --force to rebuild. Target dscanner 0.4.0 is up to date. Use --force to rebuild. Running ../../.dub/packages/dscanner-0.4.0/dscanner --sloc ../phobos/std/traits.d ../phobos/std/traits.d: 3747 total: 3747 I might be missing something, so bear with me. My current understanding is: * The usual way to run stuff gotten via dub is with "dub run", so that people don't need to deal with version directories and complex paths such as ~/.dub/packages/dscanner-0.4.0/dscanner. * There is no easy way to get rid of the chatteroo prefacing the actual output from the application. One possibility I imagine is a rather gnarly sed script that prints nothing until it detects '^Running ', and then starts printing everything. * There is even no --quiet option (https://code.dlang.org/docs/commandline#run) with run that instructs dub to not inform about things being up to date. Are these correct? In that case, dub runs afoul of the Rule of Silence: the command "dub run xyz" should only output whatever xyz outputs if dub takes no actual additional build steps. By the RoS, there might be a --verbose flag with dmd run that prints the above. What am I missing? Thanks, Andrei
Feb 25 2017
On Sunday, 26 February 2017 at 05:50:32 UTC, Andrei Alexandrescu wrote:I might be missing something, so bear with me. My current understanding is: * The usual way to run stuff gotten via dub is with "dub run", so that people don't need to deal with version directories and complex paths such as ~/.dub/packages/dscanner-0.4.0/dscanner. * There is no easy way to get rid of the chatteroo prefacing the actual output from the application. One possibility I imagine is a rather gnarly sed script that prints nothing until it detects '^Running ', and then starts printing everything. * There is even no --quiet option (https://code.dlang.org/docs/commandline#run) with run that instructs dub to not inform about things being up to date. Are these correct? In that case, dub runs afoul of the Rule of Silence: the command "dub run xyz" should only output whatever xyz outputs if dub takes no actual additional build steps. By the RoS, there might be a --verbose flag with dmd run that prints the above. What am I missing?I think that the DUB issue list [0] has grown immensely over the last two years as it's nearly only Sönke maintaining - it's not like he doesn't maintain ddox [1], Vibe.d [2], eventcore [3] (an abstraction for event loop libraries that hopefully one day finds its way to Phobos), std.data.json [4] (an kickass Json library), diet-ng [5] (the template system used by Vibe.d), tagged-algebraic [6], the DUB registry [7] and so on. Moreover, Dub's issue list [0] is filled with real bugs and important feature requests (git support, C/C++ integration like Rust, ...). That been said DUB is a build tool and it's good to be in verbose in case of errors and there's `-q` which you can use as expected, e.g:dub run dscanner -q -- --sloc .It's documented in the beginning of the document you linked under "general options". dub) it's quiet by default. [0] https://github.com/dlang/dub/issues [1] https://github.com/rejectedsoftware/ddox [2] https://github.com/rejectedsoftware/vibe.d [3] https://github.com/vibe-d/eventcore [4] https://github.com/s-ludwig/std_data_json [5] https://github.com/rejectedsoftware/diet-ng [6] https://github.com/s-ludwig/taggedalgebraic [7] https://github.com/dlang/dub-registry
Feb 25 2017
On 02/26/2017 01:37 AM, Seb wrote:That been said DUB is a build tool and it's good to be in verbose in case of errors and there's `-q` which you can use as expected, e.g:Cool, that does it for me. Thanks! -- Andreidub run dscanner -q -- --sloc .
Feb 26 2017
On Sunday, 26 February 2017 at 21:25:52 UTC, Andrei Alexandrescu wrote:On 02/26/2017 01:37 AM, Seb wrote:Are you sure?That been said DUB is a build tool and it's good to be in verbose in case of errors and there's `-q` which you can use as expected, e.g:Cool, that does it for me. Thanks! -- Andreidub run dscanner -q -- --sloc .The "--sloc" or "-l" option prints the number of lines of code in the file. Instead of simply printing the number of line breaks, this counts the number of semicolon, while, if, do, else, switch, for, foreach, foreach_reverse, default, and case tokens in the file.https://github.com/Hackerpilot/Dscanner Which means it includes code in unittests.
Feb 26 2017
On 2/26/17 4:53 PM, hmm wrote:On Sunday, 26 February 2017 at 21:25:52 UTC, Andrei Alexandrescu wrote:Apparently I was wrong. Thanks for the correction! -- AndreiOn 02/26/2017 01:37 AM, Seb wrote:Are you sure?That been said DUB is a build tool and it's good to be in verbose in case of errors and there's `-q` which you can use as expected, e.g:Cool, that does it for me. Thanks! -- Andreidub run dscanner -q -- --sloc .The "--sloc" or "-l" option prints the number of lines of code in the file. Instead of simply printing the number of line breaks, this counts the number of semicolon, while, if, do, else, switch, for, foreach, foreach_reverse, default, and case tokens in the file.https://github.com/Hackerpilot/Dscanner Which means it includes code in unittests.
Feb 26 2017
On 2/26/17 7:59 PM, Andrei Alexandrescu wrote:On 2/26/17 4:53 PM, hmm wrote:Ergh, I did the undignified: removed all doc comments and unittessts from std.experimental.checkedint. Got 1111 lines. -- AndreiOn Sunday, 26 February 2017 at 21:25:52 UTC, Andrei Alexandrescu wrote:Apparently I was wrong. Thanks for the correction! -- AndreiOn 02/26/2017 01:37 AM, Seb wrote:Are you sure?That been said DUB is a build tool and it's good to be in verbose in case of errors and there's `-q` which you can use as expected, e.g:Cool, that does it for me. Thanks! -- Andreidub run dscanner -q -- --sloc .The "--sloc" or "-l" option prints the number of lines of code in the file. Instead of simply printing the number of line breaks, this counts the number of semicolon, while, if, do, else, switch, for, foreach, foreach_reverse, default, and case tokens in the file.https://github.com/Hackerpilot/Dscanner Which means it includes code in unittests.
Feb 26 2017
On Sunday, 26 February 2017 at 05:50:32 UTC, Andrei Alexandrescu wrote:What am I missing?I installed dscanner from my package manager (homebrew), so I don't get any of the extra dub noise at all.
Feb 25 2017
On 2017-02-26 06:50, Andrei Alexandrescu wrote:On 2/25/17 2:55 PM, Timothee Cour via Digitalmars-d wrote:Dub is not intended for end user installation of programs/tools. The system package manager should be used for that. -- /Jacob CarlborgTry dscanner --sloc although IMO --tokenCount should be the most relevant metric (only caveat is mixin strings with which one could cheat to make token count smaller).Thanks, got that working with ease. The operation of dub has gotten quite a bit smoother, props to Sönke! One thing that I found surprising is the chatter that seems impossible to mute. Here's a session: $ dub run dscanner -- --sloc ../phobos/std/traits.d Building package dscanner in /Users/andrei/.dub/packages/dscanner-0.4.0/ Target libdparse 0.7.0 is up to date. Use --force to rebuild. Target emsi_containers 0.5.3 is up to date. Use --force to rebuild. Target dsymbol 0.2.0 is up to date. Use --force to rebuild. Target inifiled 0.0.6 is up to date. Use --force to rebuild. Target dscanner 0.4.0 is up to date. Use --force to rebuild. Running ../../.dub/packages/dscanner-0.4.0/dscanner --sloc ../phobos/std/traits.d ../phobos/std/traits.d: 3747 total: 3747 I might be missing something, so bear with me. My current understanding is: * The usual way to run stuff gotten via dub is with "dub run", so that people don't need to deal with version directories and complex paths such as ~/.dub/packages/dscanner-0.4.0/dscanner. * There is no easy way to get rid of the chatteroo prefacing the actual output from the application. One possibility I imagine is a rather gnarly sed script that prints nothing until it detects '^Running ', and then starts printing everything. * There is even no --quiet option (https://code.dlang.org/docs/commandline#run) with run that instructs dub to not inform about things being up to date. Are these correct? In that case, dub runs afoul of the Rule of Silence: the command "dub run xyz" should only output whatever xyz outputs if dub takes no actual additional build steps. By the RoS, there might be a --verbose flag with dmd run that prints the above. What am I missing?
Feb 26 2017
On Saturday, 25 February 2017 at 19:55:04 UTC, Timothee Cour wrote:Try dscanner --sloc although IMO --tokenCount should be the most relevant metric (only caveat is mixin strings with which one could cheat to make token count smaller). TokenCount formatting invariant On Feb 25, 2017 11:36 AM, "Andrei Alexandrescu via Digitalmars-d" < digitalmars-d puremagic.com> wrote: What would be a simple way to count the "effective" lines in a module, i.e. excluding ddoc comments and unittests? Having a tool for that in tools/ would be neat. -- AndreiThe SLOC count is incorrect in Dscanner, for example for https://github.com/Hackerpilot/Dscanner/blob/master/src/highlighter.d it indicates 38...
Feb 26 2017
On Saturday, 25 February 2017 at 19:31:06 UTC, Andrei Alexandrescu wrote:What would be a simple way to count the "effective" lines in a module, i.e. excluding ddoc comments and unittests? Having a tool for that in tools/ would be neat. -- AndreiFun fact I found out using this thread: 57.4% of the lines in Phobos are non-code lines.
Feb 25 2017
On 02/26/2017 02:31 AM, Jack Stouffer wrote:On Saturday, 25 February 2017 at 19:31:06 UTC, Andrei Alexandrescu wrote:That's kinda where it could reasonably be, and also it's a good testament of the docs-in-code approach. Thanks for the insight! -- AndreiWhat would be a simple way to count the "effective" lines in a module, i.e. excluding ddoc comments and unittests? Having a tool for that in tools/ would be neat. -- AndreiFun fact I found out using this thread: 57.4% of the lines in Phobos are non-code lines.
Feb 26 2017