alexbahnisch/pyplus

View on GitHub

Showing 23 of 28 total issues

Function member2markdown has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def member2markdown(name, value, title_format):
    """
    Creates the markdown for a member of the modules.
    @param name: {str} name of member
    @param value: {any} value of member
Severity: Minor
Found in scripts/pydoc2markdown.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 spliter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def spliter(method):
    @_wraps(method)
    def wrapped(string, **kwargs):
        if string is None:
            return []
Severity: Minor
Found in src/main/pyplus/decorators.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 __lazy_parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def __lazy_parse(string, errors=False):
    if "string" in string:
        if errors:
            raise ValueError("could not parse string: '%s'" % string)
        else:
Severity: Minor
Found in src/main/pyplus/parse.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 parser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def parser(method):
    """
    Decorator for a parser function.
    Raises 'TypeError' if the first and only positional arg is not a string.
    Also guarantees if return is a string, it is the same string as the input arg, i.e. byte or unicode.
Severity: Minor
Found in src/main/pyplus/decorators.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 __eq__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __eq__(self, other):
        if isinstance(other, dict) and self.keys() == other.keys():
            for key, value in other.items():
                if self[key] != value:
                    return False
Severity: Minor
Found in src/main/pyplus/json.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 __from_mappable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __from_mappable(arg, kwargs):
        for index, item in enumerate(arg):
            if _common.ispair(item):
                if str(item[0]) not in kwargs:
                    kwargs[str(item[0])] = item[1]
Severity: Minor
Found in src/main/pyplus/json.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 new_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def new_file(cls, path=None, dir=None, prefix=None, suffix=None, text=True):
Severity: Minor
Found in src/main/pyplus/path.py - About 35 mins to fix

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

        def read(self, mode="r", buffering=-1, encoding=None, errors=None, newline=None):
    Severity: Minor
    Found in src/main/pyplus/path.py - About 35 mins to fix

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

          def write(self, mode="w", buffering=-1, encoding=None, errors=None, newline=None):
      Severity: Minor
      Found in src/main/pyplus/path.py - About 35 mins to fix

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

            def open(self, mode="r", buffering=-1, encoding=None, errors=None, newline=None):
        Severity: Minor
        Found in src/main/pyplus/path.py - About 35 mins to fix

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

              def delete(self, recursive=False):
                  if self.is_file():
                      if isinstance(self._os_level, int):
                          _close(self._os_level)
                      _remove(str(self))
          Severity: Minor
          Found in src/main/pyplus/path.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 assign has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def assign(self, *others):
                  if all(isinstance(other, dict) for other in others):
                      for other in others:
                          for key, value in other.items():
                              self[key] = value
          Severity: Minor
          Found in src/main/pyplus/json.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 __eq__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __eq__(self, other):
                  if isinstance(other, list) and len(self) == len(other):
                      for index, item in enumerate(self):
                          if item != other[index]:
                              return False
          Severity: Minor
          Found in src/main/pyplus/json.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 __setitem__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __setitem__(self, index, value):
                  if _common.isintlike(index):
                      if 0 <= int(index) < self.length():
                          super(Array, self).__setitem__(int(index), value)
                      if int(index) == self.length():
          Severity: Minor
          Found in src/main/pyplus/json.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 assign has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def assign(self, *others):
                  if all(isinstance(other, list) for other in others):
                      for other in others:
                          for index, item in enumerate(other):
                              self[index] = item
          Severity: Minor
          Found in src/main/pyplus/json.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 merge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def merge(self, *others):
                  if all(isinstance(other, list) for other in others):
                      for other in others:
                          for index, item in enumerate(other):
                              self._merge(index, item)
          Severity: Minor
          Found in src/main/pyplus/json.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 _table2list_with_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def _table2list_with_headers(csv_reader, parser):
              array, keys = Array(), []
          
              for row_index, row in enumerate(csv_reader):
          
          
          Severity: Minor
          Found in src/main/pyplus/table.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 merge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def merge(self, *others):
                  if all(isinstance(other, dict) for other in others):
                      for other in others:
                          for key, value in other.items():
                              self._merge(key, value)
          Severity: Minor
          Found in src/main/pyplus/json.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 _list2table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def _list2table(list_):
              keys, rows = [], []
          
              for item in list_:
                  for key in item:
          Severity: Minor
          Found in src/main/pyplus/table.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_bool has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def __parse_bool(string, errors=False):
              lower_string = str(string).lower()
          
              if lower_string == "true":
                  return True
          Severity: Minor
          Found in src/main/pyplus/parse.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