christoph2/objutils

View on GitHub

Showing 5 of 69 total issues

Function read has a Cognitive Complexity of 60 (exceeds 50 allowed). Consider refactoring.
Open

    def read(self, fp):
        sections = []
        matched = False
        self.valid = True
        meta_data = defaultdict(list)
Severity: Minor
Found in objutils/hexfile.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

Avoid deeply nested control flow statements.
Open

                        if reader is None:
                            print("*EF", enc, form, start, attr, abbr)
                        start = image.tell()
Severity: Major
Found in objutils/dwarf/__init__.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if "chunk" in dict_:
                                if self.parseData(container, format_type):
                                    chunk = bytearray.fromhex(dict_["chunk"])
                                else:
                                    # don't convert/parse stuff like symbols.
    Severity: Major
    Found in objutils/hexfile.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              for key, value in dict_.items():
                                  if key not in ("chunk", "junk"):
                                      setattr(container, key, atoi(value))
                                  elif key == "junk":
                                      setattr(container, key, value)
      Severity: Major
      Found in objutils/hexfile.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if self.is_data_line(container, format_type):
                                    sections.append(Section(container.address, container.chunk))
                                else:
                                    chunk = (
                                        container.chunk if hasattr(container, "chunk") else None
        Severity: Major
        Found in objutils/hexfile.py - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language