OCA / server-tools

Tools for Odoo Administrators to improve some technical features on Odoo.
https://odoo-community.org/psc-teams/tools-30
GNU Affero General Public License v3.0
705 stars 1.5k forks source link

module_analysis does not count code lines from odoo core when installed from the debian package #3042

Open fcayre opened 1 month ago

fcayre commented 1 month ago

Module

module_analysis

Describe the bug

To Reproduce

Affected versions: all

Steps to reproduce the behavior:

  1. Prerequisites: Odoo is installed using the debian package; module_analysis is installed
  2. Go to the account_cancel module page (in Applications app) in debug mode
  3. Press the "Refresh Code Analysis" button in the "Technical data" tab

Expected behavior The Python Code Quantity field's value is 0 also it should not, as there are non-empty python files in the module (models/account_bank_statement.py).

Additional context Debugging shows that this line is a true condition when odoo is installed by a debian package (root = /usr/lib/python3/dist-packages/odoo/addons/account_cancel), because exclude_directories value is ['lib', 'demo', 'test', 'tests', 'doc', 'description'], so the test returns {'lib'}

The exclude_directories comes from ir.config_parameter module_analysis.exclude_directories which interpretation is questionable. As a user of the module I expect its value to list folders relative to the module's folder, while in the code if any of the listed folder is found in the module's root path the entire module will be ignored.

I'm working on a PR to fix this.

fcayre commented 1 month ago

@legalsylvain any thoughts on the module_analysis.exclude_directories parameter interpretation? Am I right and can I go on with the PR?

legalsylvain commented 1 month ago

Hi @fcayre. Thanks for the investigation, regarding your problem. Well, why that default values ? It is about what you want to measure.

In my thought, I wanted to measure the "amount of algorithmic complexity to be maintained".

For that reasons :

you can see the original PR, with some thought about what should contains or not the "excude_directories" values : https://github.com/OCA/server-tools/pull/1618#issuecomment-509770796

my opinion : people want to measure differents things, and all values is legit. Finally, it is just a default value. So, I propose to not change the default values, but add a text in the configure.rst file, to explain how to configure the module in case you install odoo core via debian, with a link to thisi current issue. If agree could you make the PR in the last recent version of the module, so the text will be conserved when migrating the module. https://github.com/OCA/server-tools/tree/17.0/module_analysis

fcayre commented 1 month ago

@legalsylvain I don't want to change the default value (which looks good to me) but the code, which does not interpret that value as it should in my opinion. See my PR for a better understanding of my objection.