kororo/conff

View on GitHub
conff/parser.py

Summary

Maintainability
C
1 day
Test Coverage

Function _process has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def _process(self, root):
        """
        The main parsing function
        """
        root_type = type(root)
Severity: Minor
Found in conff/parser.py - About 4 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

Parser has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class Parser:
    # default params
    default_params = {
        'etype': 'fernet',
        # list of simpleeval library parameters
Severity: Minor
Found in conff/parser.py - About 3 hrs to fix

    File parser.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import logging
    import os
    import collections
    import copy
    Severity: Minor
    Found in conff/parser.py - About 3 hrs to fix

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

          def load(self, fs_path: str, fs_root: str = '', fs_include: list = None):
              """
              Parse configuration file on disk.
      
              :param fs_path: The path to the file on disk. If fs_root is specified,
      Severity: Minor
      Found in conff/parser.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 fn_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def fn_update(self, update, parent):
              def walk(u, p):
                  tu, tp = type(u), type(p)
                  if tu in [dict, odict, Munch2] and tp in [dict, odict, Munch2]:
                      for k, v in u.items():
      Severity: Minor
      Found in conff/parser.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 (80 > 79 characters)
      Open

              cls_fns = {fn[3:]: getattr(self, fn) for fn in dir(self) if 'fn_' in fn}
      Severity: Minor
      Found in conff/parser.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 (115 > 79 characters)
      Open

                      warnings.warn('argument type is in dict, please use collections.OrderedDict for guaranteed order.')
      Severity: Minor
      Found in conff/parser.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

                  # print("Raised simpleeval exception {} for expression {}".format(type(ex), v))
      Severity: Minor
      Found in conff/parser.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

                  # print("Raised simpleeval exception {} for expression {}".format(type(ex), v))
      Severity: Minor
      Found in conff/parser.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 (85 > 79 characters)
      Open

      from conff.utils import Munch2, update_recursive, yaml_safe_load, filter_value, odict
      Severity: Minor
      Found in conff/parser.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 (83 > 79 characters)
      Open

              # TODO: feature T4: include this part of the classes so user could override
      Severity: Minor
      Found in conff/parser.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

                  # print("Raised simpleeval exception {} for expression {}".format(type(ex), v))
      Severity: Minor
      Found in conff/parser.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 (86 > 79 characters)
      Open

              elif type_val in [dict, odict, Munch2] and type_val2 in [dict, odict, Munch2]:
      Severity: Minor
      Found in conff/parser.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