OCA/server-tools

View on GitHub
base_module_doc_rst/wizard/tech_rst_guide.py

Summary

Maintainability
F
3 days
Test Coverage

File tech_rst_guide.py has 445 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
Severity: Minor
Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 6 hrs to fix

    Function _write_objects has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _write_objects(self):
            def write_field(field_def):
                if not isinstance(field_def, tuple):
                    logger = netsvc.Logger()
                    msg = "Error on Object %s: field_def: %s [type: %s]" % (
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _generate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _generate(self, cr, uid, context):
            module_model = self.pool.get('ir.module.module')
            module_ids = context['active_ids']
    
            module_index = []
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _get_download_links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_download_links(self):
            def _is_connection_status_good(link):
                server = "openerp.com"
                status_good = False
                try:
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _get_views has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_views(self, cr, uid, module_id, context=None):
            module_module_obj = self.pool.get('ir.module.module')
            model_data_obj = self.pool.get('ir.model.data')
            view_obj = self.pool.get('ir.ui.view')
            report_obj = self.pool.get('ir.actions.report.xml')
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _write_menus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _write_menus(self):
            sl = ["",
                  "Menus",
                  "-------",
                  ""]
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _write_reports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _write_reports(self):
            sl = ["",
                  "Reports",
                  "-------"]
            reports = self.dico['report_list']
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _write_views has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _write_views(self):
            sl = ["",
                  "Views",
                  "-----",
                  ""]
    Severity: Minor
    Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def _write_menus(self):
            sl = ["",
                  "Menus",
                  "-------",
                  ""]
    Severity: Major
    Found in base_module_doc_rst/wizard/tech_rst_guide.py and 1 other location - About 5 hrs to fix
    base_module_doc_rst/wizard/tech_rst_guide.py on lines 194..208

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 90.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def _write_views(self):
            sl = ["",
                  "Views",
                  "-----",
                  ""]
    Severity: Major
    Found in base_module_doc_rst/wizard/tech_rst_guide.py and 1 other location - About 5 hrs to fix
    base_module_doc_rst/wizard/tech_rst_guide.py on lines 178..192

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 90.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    elif key == 'ir.actions.report.xml':
                        res[mnames[data_id.module]]['reports_by_module'].append(
                            report_obj.browse(cr, uid, data_id.res_id).name
    Severity: Major
    Found in base_module_doc_rst/wizard/tech_rst_guide.py and 1 other location - About 1 hr to fix
    base_module_doc_rst/wizard/tech_rst_guide.py on lines 455..457

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    elif key == 'ir.ui.menu':
                        res[mnames[data_id.module]]['menus_by_module'].append(
                            menu_obj.browse(cr, uid, data_id.res_id).complete_name
    Severity: Major
    Found in base_module_doc_rst/wizard/tech_rst_guide.py and 1 other location - About 1 hr to fix
    base_module_doc_rst/wizard/tech_rst_guide.py on lines 451..453

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status