diff --git a/module_analysis/README.rst b/module_analysis/README.rst index 7c4986615..db23145d6 100644 --- a/module_analysis/README.rst +++ b/module_analysis/README.rst @@ -54,10 +54,9 @@ Each installed modules have extra data in the 'Technical Data' tab : Installation ============ -To use this module, you have to install the application ``cloc`` - -``sudo apt-get install cloc`` +To use this module, you have to install the ``pygount`` python librairy. +``pip install pygount`` Configuration ============= @@ -88,18 +87,54 @@ to update the data, you have to : This will update analysis of your installed modules. + +Adding Extra data +~~~~~~~~~~~~~~~~~ + +If you want to analyse other data, (for exemple, having the number of HTML +files), create a custom modules and overload the module model : + +.. code-block:: python + + from odoo import api, fields, models + + class IrModuleModule(models.Model): + _inherit = 'ir.module.module' + + xml_documentation_qty = fields.Integer( + string='Quantity of Comments in XML Files') + + @api.model + def _get_analyse_settings(self): + res = super(IrModuleModule, self)._get_analyse_settings() + if not '.html' in res: + res['.html'] = {} + res['.html']['documentation'] 'xml_documentation_qty' + return res + +Exclude files and directories +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Two parameters are availaible in 'Settings' / 'Technical' / 'Parameters' +'System Parameters' : + + .. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/config_parameters.png + +The list of folders and filename will be exclude from the analysis. +You can change the default settings. + Usage ===== * Go to 'Apps' / 'Module Analysis' / 'Installed module by Types' -Open the stats to analyze the detail of the code installed +Open the stats to analyse the detail of the code installed .. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/analysis_pivot.png - .. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/analysis_pie.png + Bug Tracker =========== diff --git a/module_analysis/models/base_module_update.py b/module_analysis/models/base_module_update.py index b56d0e93f..9a884de13 100644 --- a/module_analysis/models/base_module_update.py +++ b/module_analysis/models/base_module_update.py @@ -8,11 +8,11 @@ from odoo import api, fields, models class BaseModuleUpdate(models.TransientModel): _inherit = 'base.module.update' - analyze_installed_modules = fields.Boolean( - string='Analyze Installed Modules', default=True) + analyse_installed_modules = fields.Boolean( + string='Analyse Installed Modules', default=True) @api.multi def update_module(self): return super(BaseModuleUpdate, self.with_context( - analyze_installed_modules=self.analyze_installed_modules) + analyse_installed_modules=self.analyse_installed_modules) ).update_module() diff --git a/module_analysis/models/ir_module_module.py b/module_analysis/models/ir_module_module.py index 779162411..b0418fcc4 100644 --- a/module_analysis/models/ir_module_module.py +++ b/module_analysis/models/ir_module_module.py @@ -84,15 +84,15 @@ class IrModuleModule(models.Model): @api.model def update_list(self): res = super(IrModuleModule, self).update_list() - if self.env.context.get('analyze_installed_modules', False): - self.search([('state', '=', 'installed')]).button_analyze_code() + if self.env.context.get('analyse_installed_modules', False): + self.search([('state', '=', 'installed')]).button_analyse_code() return res @api.multi def write(self, vals): res = super(IrModuleModule, self).write(vals) if vals.get('state', False) == 'installed': - self.button_analyze_code() + self.button_analyse_code() elif vals.get('state', False) == 'uninstalled'\ and 'module_analysis' not in [x.name for x in self]: self.write(self._get_clean_analyse_values()) @@ -100,7 +100,7 @@ class IrModuleModule(models.Model): # Public Section @api.multi - def button_analyze_code(self): + def button_analyse_code(self): IrModuleAuthor = self.env['ir.module.author'] IrModuleTypeRule = self.env['ir.module.type.rule'] rules = IrModuleTypeRule.search([]) @@ -112,7 +112,7 @@ class IrModuleModule(models.Model): exclude_files = [x.strip() for x in val.split(',') if x.strip()] for module in self: - _logger.info("Analyzing Code for module %s ..." % (module.name)) + _logger.info("Analysing Code for module %s ..." % (module.name)) # Update Authors, based on manifest key authors = [] diff --git a/module_analysis/post_init_hook.py b/module_analysis/post_init_hook.py index 3b1ba4697..5f9a882e8 100644 --- a/module_analysis/post_init_hook.py +++ b/module_analysis/post_init_hook.py @@ -10,4 +10,4 @@ def analyse_installed_modules(cr, registry): env = api.Environment(cr, SUPERUSER_ID, {}) installed_modules = env['ir.module.module'].search( [('state', '=', 'installed')]) - installed_modules.button_analyze_code() + installed_modules.button_analyse_code() diff --git a/module_analysis/readme/CONFIGURE.rst b/module_analysis/readme/CONFIGURE.rst index 1cebd460c..8fd3c9f44 100644 --- a/module_analysis/readme/CONFIGURE.rst +++ b/module_analysis/readme/CONFIGURE.rst @@ -28,7 +28,7 @@ This will update analysis of your installed modules. Adding Extra data ~~~~~~~~~~~~~~~~~ -If you want to analyze other data, (for exemple, having the number of HTML +If you want to analyse other data, (for exemple, having the number of HTML files), create a custom modules and overload the module model : .. code-block:: python @@ -48,3 +48,14 @@ files), create a custom modules and overload the module model : res['.html'] = {} res['.html']['documentation'] 'xml_documentation_qty' return res + +Exclude files and directories +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Two parameters are availaible in 'Settings' / 'Technical' / 'Parameters' +'System Parameters' : + + .. image:: ../static/description/config_parameters.png + +The list of folders and filename will be exclude from the analysis. +You can change the default settings. diff --git a/module_analysis/readme/USAGE.rst b/module_analysis/readme/USAGE.rst index a88d6fcfc..2676bb76c 100644 --- a/module_analysis/readme/USAGE.rst +++ b/module_analysis/readme/USAGE.rst @@ -1,6 +1,6 @@ * Go to 'Apps' / 'Module Analysis' / 'Installed module by Types' -Open the stats to analyze the detail of the code installed +Open the stats to analyse the detail of the code installed .. image:: ../static/description/analysis_pivot.png diff --git a/module_analysis/static/description/config_parameters.png b/module_analysis/static/description/config_parameters.png new file mode 100644 index 000000000..b11538a8a Binary files /dev/null and b/module_analysis/static/description/config_parameters.png differ diff --git a/module_analysis/views/view_base_module_update.xml b/module_analysis/views/view_base_module_update.xml index 7e284343f..68182a227 100644 --- a/module_analysis/views/view_base_module_update.xml +++ b/module_analysis/views/view_base_module_update.xml @@ -12,7 +12,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - + diff --git a/module_analysis/views/view_ir_module_module.xml b/module_analysis/views/view_ir_module_module.xml index cadb26a00..29baf1d01 100644 --- a/module_analysis/views/view_ir_module_module.xml +++ b/module_analysis/views/view_ir_module_module.xml @@ -12,7 +12,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -