voncount
v0.0.2
Published
Time to count your lines
Downloads
5
Readme
VonCount
I vant to count your lines
Usage
$ npm install -g voncount
$ voncount COMMAND
running command...
$ voncount (--version)
voncount/0.0.1 darwin-x64 node-v14.15.4
$ voncount --help [COMMAND]
USAGE
$ voncount COMMAND
...
Commands
voncount help [COMMAND]
Display help for voncount.
USAGE
$ voncount help [COMMAND] [-n]
ARGUMENTS
COMMAND Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for voncount.
See code: @oclif/plugin-help
voncount run PATH
run a count of a codebase
USAGE
$ voncount run [PATH] [-c <value>]
ARGUMENTS
PATH location of codebase
FLAGS
-c, --config=<value>
DESCRIPTION
run a count of a codebase
See code: dist/commands/run/index.ts
Config
Configuration for voncount
is totally optional, and can either live in a count.json
file in the root of your code directory be explicitly provided with the -c
or --config
flag.
What Goes in Config?
include
An array of glob patterns to include, defaults to ['*']
.
Examples
Typescript would be:
{
"include": ["**/*.ts", "**/*.tsx"]
}
Go would be:
{
"include": ["**/*.go"]
}
exclude
An array of glob patterns to exclude, defaults to []
.
Examples
For node you would probably want
{
"exclude": ["node_modules"]
}
groups
A group
is a specific criteria to search for in the code. It will then be presented back as number of lines that qualify for the group, and as a percentage what that group represents in the code. This is useful for comment, documentation blocks or specific class/function detection (detecting reuse). A block is defined in terms of a regex that matches the start of that block, and another regex that matches the end of that block (with lines counted between those blocks)
Examples
For something like comment/documentation blocks where the code looks like:
/**
* A button.
*
* @param label: Text to show on the button
*
* @example
*
* <Button
* label="Hello World"
* />
*
* @returns JSX.Element
*
* @alpha
*/
You would want to match everything between /**
and */
:
{
"groups": [
{
"name": "documentation",
"between": {
"start": "^\\/\\*\\*",
"end": "^ \\*/$"
}
}
]
}
Be careful to correctly escape your regexs