OCA/server-tools

View on GitHub
module_prototyper/models/module_prototyper.py

Summary

Maintainability
C
1 day
Test Coverage

File module_prototyper.py has 457 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- encoding: utf-8 -*-
# #############################################################################
#
#    OpenERP, Open Source Management Solution
#    This module copyright (C) 2010 - 2014 Savoir-faire Linux
Severity: Minor
Found in module_prototyper/models/module_prototyper.py - About 7 hrs to fix

    Function fixup_arch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def fixup_arch(cls, archstr):
            doc = lxml.etree.fromstring(archstr)
            for elem in doc.xpath("//*[@name]"):
                elem.attrib["name"] = cls.unprefix(elem.attrib["name"])
    
    
    Severity: Minor
    Found in module_prototyper/models/module_prototyper.py - About 2 hrs 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_menus_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_menus_details(self):
            """Wrapper to generate the menus files."""
            relations = {}
            for menu in self.menu_ids:
                if menu.action and menu.action.res_model:
    Severity: Minor
    Found in module_prototyper/models/module_prototyper.py - About 25 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

    There are no issues that match your filters.

    Category
    Status