CollageLabs/candyshop

View on GitHub

Showing 15 of 15 total issues

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

    def get_notmet_record_ids_report(self):
        """
        Public method that reports missing dependencies in XML files.

        :return: (string) a report of human readable output for the
Severity: Major
Found in candyshop/environment.py and 1 other location - About 1 day to fix
candyshop/environment.py on lines 299..324

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 134.

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 get_notmet_dependencies_report(self):
        """
        Public method that reports missing dependencies in modules.

        :return: (string) a report of human readable output for the
Severity: Major
Found in candyshop/environment.py and 1 other location - About 1 day to fix
candyshop/environment.py on lines 326..350

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 134.

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

File environment.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Please refer to AUTHORS.rst for a complete list of Copyright holders.
# Copyright (C) 2016-2022, Candyshop Developers.

Severity: Minor
Found in candyshop/environment.py - About 2 hrs to fix

    Function find_files has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def find_files(path=None, pattern='*'):
        """
        Search for files.
    
        Locate all the files matching the supplied filename pattern in and below
    Severity: Minor
    Found in candyshop/utils.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_notmet_record_ids has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_notmet_record_ids(self):
            """
            Public method that informs about missing dependencies in XML files.
    
            :return: (generator) a generator that produces an iterable of
    Severity: Minor
    Found in candyshop/environment.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_record_ids_fromfile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_record_ids_fromfile(self, xmlfile, module=None):
            """
            Get ids from `record` tags of an Odoo XML file.
    
            :param xmlfile: (string) a path pointing to the XML file.
    Severity: Minor
    Found in candyshop/bundle.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_modules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __get_modules(self):
            """
            Private method to find and instance all valid modules inside a bundle.
    
            .. versionadded:: 0.1.0
    Severity: Minor
    Found in candyshop/bundle.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 get_notmet_record_ids_report has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_notmet_record_ids_report(self):
            """
            Public method that reports missing dependencies in XML files.
    
            :return: (string) a report of human readable output for the
    Severity: Minor
    Found in candyshop/environment.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 get_notmet_dependencies_report has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_notmet_dependencies_report(self):
            """
            Public method that reports missing dependencies in modules.
    
            :return: (string) a report of human readable output for the
    Severity: Minor
    Found in candyshop/environment.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 addbundles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def addbundles(self, locations=None, exclude_tests=True):
            """
            Public method that inserts bundles inside the environment.
    
            This method register a list of bundles and builds the dependency tree
    Severity: Minor
    Found in candyshop/environment.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

    Function __clone_deptree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __clone_deptree(self):
            """
            Private method that clones the dependency tree of existing bundles.
    
            It reads the oca_dependencies attribute of each bundle, clones each one
    Severity: Minor
    Found in candyshop/environment.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

    Function __initialize_odoo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __initialize_odoo(self, url=DEFAULT_URL, branch=DEFAULT_BRANCH,
                              init_from=None):
            """
            Private method to clone an Odoo codebase inside the Environment path.
    
    
    Severity: Minor
    Found in candyshop/environment.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

    Function get_record_ids_module_references has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_record_ids_module_references(self):
            """
            Get all modules referenced in Odoo XML files.
    
            :return: a generator that returns an iterable of dictionaries
    Severity: Minor
    Found in candyshop/bundle.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

    Function __parse_oca_dependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __parse_oca_dependencies(self):
            """
            Private method to parse (if any) the oca_dependencies.txt file.
    
            .. versionadded:: 0.1.0
    Severity: Minor
    Found in candyshop/bundle.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

    Function get_notmet_dependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_notmet_dependencies(self):
            """
            Public method that informs about missing dependencies in modules.
    
            :return: (generator) a generator that produces an iterable of
    Severity: Minor
    Found in candyshop/environment.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

    Severity
    Category
    Status
    Source
    Language