osbzr/gooderp_addons

View on GitHub
warehouse/report/report_base.py

Summary

Maintainability
C
1 day
Test Coverage

Function read_group has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def read_group(self, domain, fields, groupby, offset=0, limit=80, orderby=False, lazy=True):

        def dict_plus(collect, values):
            for key, value in values.iteritems():
                if isinstance(value, (long, int, float)):
Severity: Minor
Found in warehouse/report/report_base.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

ReportBase has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class ReportBase(models.Model):
    _name = 'report.base'
    _description = u'使用search_read来直接生成数据的基本类,其他类可以直接异名继承当前类来重用搜索、过滤、分组等函数'

    _expired_time = 60
Severity: Minor
Found in warehouse/report/report_base.py - About 2 hrs to fix

    Function _compute_domain_util has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_domain_util(self, result, domains):
            index = 0
            while index < len(domains):
                domain = domains[index]
                index += 1
    Severity: Minor
    Found in warehouse/report/report_base.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 read_group has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def read_group(self, domain, fields, groupby, offset=0, limit=80, orderby=False, lazy=True):
    Severity: Major
    Found in warehouse/report/report_base.py - About 50 mins to fix

      Function search_read has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def search_read(self, domain=None, fields=None, offset=0, limit=80, order=None):
      Severity: Minor
      Found in warehouse/report/report_base.py - About 35 mins to fix

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

            def _process_domain(self, result, domain):
                if domain and len(domain) == 3:
                    field, opto, value = domain
        
                    compute_operator = {
        Severity: Minor
        Found in warehouse/report/report_base.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 update_result_none_to_false has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_result_none_to_false(self, result):
                for val in result:
                    for key, value in val.iteritems():
                        if value is None:
                            val[key] = False
        Severity: Minor
        Found in warehouse/report/report_base.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

        Line too long (86 > 79 characters)
        Open

                        'not like': lambda field, value: unicode(value) not in unicode(field),
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (97 > 79 characters)
        Open

                        or not self._cache_record or self._cache_time + self._expired_time < time.time():
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (84 > 79 characters)
        Open

            def search_read(self, domain=None, fields=None, offset=0, limit=80, order=None):
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (95 > 79 characters)
        Open

                        'ilike': lambda field, value: unicode(value).lower() in unicode(field).lower(),
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (84 > 79 characters)
        Open

                    for group, itervalue in itertools.groupby(sorted(values, key=key), key):
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (98 > 79 characters)
        Open

                self.env.cr.execute((self.select_sql(sql_type) + self.from_sql(sql_type) + self.where_sql(
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (81 > 79 characters)
        Open

                return filter(lambda res: self._compute_domain_util(res, domain), result)
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (103 > 79 characters)
        Open

                        'not ilike': lambda field, value: unicode(value).lower() not in unicode(field).lower(),
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (91 > 79 characters)
        Open

                            (groupby[0], '=', group)], groupby[0]: group, groupby[0] + '_count': 0}
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (159 > 79 characters)
        Open

                        if not self._compute_domain_util(result, domains[index:left_index]) and not self._compute_domain_util(result, domains[left_index:right_index]):
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (96 > 79 characters)
        Open

            def read_group(self, domain, fields, groupby, offset=0, limit=80, orderby=False, lazy=True):
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (90 > 79 characters)
        Open

                    domain=domain, fields=fields, offset=offset, limit=limit or 80, order=orderby)
        Severity: Minor
        Found in warehouse/report/report_base.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        There are no issues that match your filters.

        Category
        Status