suoto/hdl_checker

View on GitHub

Showing 96 of 152 total issues

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

    def _parseLine(self, line):  # type: (str) -> None
        """
        Parses a line a calls the appropriate extraction methods
        """
        for match in _configFileScan(line):
Severity: Minor
Found in hdl_checker/parsers/config_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

Avoid too many return statements within this function.
Open

        return locations
Severity: Major
Found in hdl_checker/lsp.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return {"version": "0+unknown", "full-revisionid": None,
    Severity: Major
    Found in hdl_checker/_version.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return bytes(value, encoding="utf8")
      Severity: Major
      Found in hdl_checker/utils.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return toBytes(str(value))
        Severity: Major
        Found in hdl_checker/utils.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return {"version": "0+unknown", "full-revisionid": None,
          Severity: Major
          Found in versioneer.py - About 30 mins to fix

            Function get_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_versions():
                """Get version information or return default if unable to do so."""
                # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
                # __file__, we can work backwards from there to the root. Some
                # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
            Severity: Minor
            Found in hdl_checker/_version.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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def default(self, o):  # pylint: disable=method-hidden
                    if hasattr(o, "__jsonEncode__"):
                        dct = o.__jsonEncode__()
                        # Set a __class__ entry into the dict so we can use it to get from
                        # CLASS_MAP when recreating the object
            Severity: Minor
            Found in hdl_checker/serialization.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 get_root has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_root():
                """Get the project root directory.
            
                We require that all commands are run from the project root, i.e. the
                directory that contains setup.py, setup.cfg, and versioneer.py .
            Severity: Minor
            Found in versioneer.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 _updatePathLibrary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _updatePathLibrary(self, path, library):
                    # type: (Path, Identifier) -> None
                    """
                    Updates dependencies of the given path so they reflect the change in
                    their owner's path
            Severity: Minor
            Found in hdl_checker/database.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 getDependencyInfoForHover has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def getDependencyInfoForHover(self, dependency):
                    # type: (BaseDependencySpec) -> str
                    """
                    Report which source defines a given dependency when the user hovers
                    over its name
            Severity: Minor
            Found in hdl_checker/lsp.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 _getMiscChecks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _getMiscChecks(objects):
                """
                Get generic code hints (or it should do that sometime in the future...)
                """
                if "library" not in [x["type"] for x in objects.values()]:
            Severity: Minor
            Found in hdl_checker/static_check.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 getLibrary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def getLibrary(self, path):
                    # type: (Path) -> UnresolvedLibrary
                    """
                    Gets the library the path is in, inferring and updating it if needed.
                    Any unit that can be used from VHDL code can be bound to a library,
            Severity: Minor
            Found in hdl_checker/database.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 _parseArguments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _parseArguments():
                parser = argparse.ArgumentParser()
            
                # Options
                parser.add_argument(
            Severity: Minor
            Found in .ci/scripts/run_tests.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, locations=None):
                    # type: (Optional[LocationList]) -> None
                    set_of_locations = set()  # type: Set[Location]
                    for line_number, column_number in locations or []:
                        set_of_locations.add(
            Severity: Minor
            Found in hdl_checker/parsers/elements/parsed_element.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 getElementAtPosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def getElementAtPosition(
                    self, path: Path, position: Position
                ) -> Union[BaseDependencySpec, tAnyDesignUnit, None]:
                    """
                    Gets design units and dependencies (in this order) of path and checks
            Severity: Minor
            Found in hdl_checker/lsp.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