Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1792 มุมมอง

I’m looking to understand the purpose of the cloc command in Odoo. Does it support all versions of Odoo, and how do I access this feature in different Odoo versions? If there are any exclusions , I’d like to know more about that too.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

The cloc (Count Lines of Code) command in Odoo is a tool used to count the number of lines of code (LoC) in your Odoo modules. It categorizes the lines as code, comments, and blank lines across Python, XML, and JavaScript files. This helps developers analyze the size and complexity of the Odoo codebase.

Usage of cloc in Odoo versions:

Odoo 13+: The cloc command is built into odoo-bin and can be used directly to count lines of code across the entire Odoo project.    

 Odoo 10-12: In older Odoo versions, odoo-bin cloc is not available. Instead, you can use the standalone cloc tool to count lines of code in your Odoo modules.

Install cloc (if not installed):


Exclusions in the cloc count:

The cloc command automatically excludes the following lines from its count:

    Generated code (e.g., .pyc, .pyo files)

    Third-party libraries (not part of your custom Odoo module)

    Empty or comment-only files

This ensures that the count reflects only relevant lines of code and not temporary or external code.

This tool is helpful for developers who want to track the growth and complexity of their Odoo codebase, offering a clear view of the code’s structure.


Regards,

Jishna

Accurates


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

The cloc command is available in Odoo 13.0 and higher.

Review the documentation for Odoo 16.0 at  at https://www.odoo.com/documentation/16.0/developer/reference/cli.html#cloc

See also https://www.odoo.com/forum/help-1/how-can-i-see-the-loc-lines-of-code-of-a-custom-developed-module-odoo-sh-184461

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 25
2409
1
ก.ค. 25
909
1
ส.ค. 25
1151
0
พ.ค. 25
1344
2
เม.ย. 25
3567