📜  loc (1)

📅  最后修改于: 2023-12-03 14:44:01.705000             🧑  作者: Mango

Introduction to Loc

Loc stands for Lines of Code. It is a simple tool that helps you count the number of lines of code in your codebase.

Installation

You can install Loc using pip:

pip install loc
Usage

To use Loc, simply navigate to your project directory and run the following command:

loc

Loc will then recursively search for files in your project directory and count the number of lines of code.

Output

The output of Loc will be a table displaying the number of lines of code per file, as well as a total count for the entire project. Here's an example: | Language | Files | Lines | | --- | --- | --- | | Python | 10 | 1000 | | HTML | 5 | 500 | | JavaScript | 3 | 300 | | Total | 18 | 1800 |

Configuration

You can configure Loc to exclude certain files or directories from the count. To do this, create a .loccfg file in your project directory and specify the files/directories to exclude using regular expressions.

Here's an example .loccfg file:

exclude = migrations, __mocks__, tests
Conclusion

Loc is a great tool for tracking the size of your codebase and identifying areas for improvement. Give it a try in your next project!