Introduction to cloc, a front-end code statistics tool

Table of contents

1. Installation

2. Use the command cloc + path:


The cloc tool can be used to calculate the amount of front-end code very well. It is really great after personal practice.

1. Installation

Installation command

pnpm add cloc -g

2. Use the command cloc + path:

cloc ./

If an error is reported: perl is not a problem with internal or external commands, you need to install perl  http://strawberryperl.com

clocis written in perl, and the binaries exposed by the package are cloc perl scripts. You must have perl installed on your computer for this binary to work properly.

After the installation is successful, execute cloc ./ again

If it is a front-end project, remember to ignore the node_modules folder: 

cloc --exclude-dir=node_modules .

Results of the:

 

Since most of the front-end code is under the src directory, you can also execute cloc ./ under the src directory.

Guess you like

Origin blog.csdn.net/sinat_36728518/article/details/132981610