kororo/conff

View on GitHub

Showing 38 of 38 total issues

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

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

      class ConffTestCase(TestCase):
          def setUp(self):
              super(ConffTestCase, self).setUp()
              # set path
              current_path = os.path.dirname(os.path.abspath(__file__))
      Severity: Minor
      Found in conff/test_parser.py - About 2 hrs to fix

        Function test_complex_load_yml has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def test_complex_load_yml(self):
                p = conff.Parser()
                fs_path = self.get_test_data_path('test_config_02.yml')
                p.generate_crypto_key()
                data = p.load(fs_path=fs_path)
        Severity: Minor
        Found in conff/test_parser.py - About 1 hr to fix

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

          def update_recursive(d, u):
              """
              Update dictionary recursively. It traverse any object implements
              "collections.Mapping", anything else, it overwrites the original value.
              :param d: Original dictionary to be updated
          Severity: Minor
          Found in conff/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 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 (111 > 79 characters)
          Open

          # TODO: for now, let user use these function, eventually, before version 1.0, we should mark this as deprecated
          Severity: Minor
          Found in conff/ee.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

                  # test: template as file (borrowing F.inc capabilities), if test_tpl_01.tpl is {{1 + 2}}
          Severity: Minor
          Found in conff/test_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 (96 > 79 characters)
          Open

                  self.assertListEqual(data.get('test_9', {}).get('test_9_1'), [True, False, True, False])
          Severity: Minor
          Found in conff/test_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 (88 > 79 characters)
          Open

                  data_test_14 = {'test_13_1': 11, 'test_13_2': 2, 'test_13_3': 3, 'test_13_5': 5,
          Severity: Minor
          Found in conff/test_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 (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 (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.

          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 (89 > 79 characters)
          Open

                  data = p.parse('{"a": "a", "b": "1/0", "c": F.add(1, 2), "d": F.test.add(2, 2)}')
          Severity: Minor
          Found in conff/test_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 (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 (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.
          Severity
          Category
          Status
          Source
          Language