suoto/hdl_checker

View on GitHub

Showing 96 of 152 total issues

Function render_pep440 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def render_pep440(pieces):
    """Build up version string, with post-release "local version identifier".

    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Severity: Minor
Found in versioneer.py - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def render(pieces, style):
    """Render the given version pieces into the requested style."""
    if pieces["error"]:
        return {"version": "unknown",
                "full-revisionid": pieces.get("long"),
Severity: Minor
Found in hdl_checker/_version.py - About 55 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 _makeRecords has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _makeRecords(self, line):
        # type: (str) -> Iterable[BuilderDiag]
        for match in GHDL._stdout_message_parser(line):
            info = match.groupdict()

Severity: Minor
Found in hdl_checker/builders/ghdl.py - About 55 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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(  # pylint: disable=too-many-arguments
Severity: Major
Found in hdl_checker/diagnostics.py - About 50 mins to fix

    Function _makeRecords has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _makeRecords(self, line):
            # type: (str) -> Iterable[BuilderDiag]
            for match in _STDOUT_MESSAGE_SCANNER.finditer(line):
    
                info = match.groupdict()
    Severity: Minor
    Found in hdl_checker/builders/xvhdl.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 _setupLogging has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _setupLogging(stream, level):  # pragma: no cover
        "Setup logging according to the command line parameters"
        color = False
    
        if stream is sys.stdout:
    Severity: Minor
    Found in .ci/scripts/run_tests.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(  # pylint: disable=too-many-arguments
    Severity: Minor
    Found in hdl_checker/diagnostics.py - About 45 mins to fix

      Function build has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def build(self, path, library, scope, forced=False):
              # type: (Path, Identifier, BuildFlagScope, bool) -> Tuple[Set[CheckerDiagnostic], Set[RebuildInfo]]
              """
              Method that interfaces with parents and implements the building
              chain
      Severity: Minor
      Found in hdl_checker/builders/base_builder.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 configure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def configure(self, config):
              # type: (Dict[Any, Any]) -> None
              "Updates configuration from a dictionary"
      
              _logger.debug("Updating with base config:\n%s", pformat(config))
      Severity: Minor
      Found in hdl_checker/core.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 removeSource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def removeSource(self, path):
              # type: (Path) -> None
              """
              Removes a path from the database. No error is raised if the path wasn't
              added previously. In this case, avoid clearning LRU caches
      Severity: Minor
      Found in hdl_checker/database.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(  # pylint: disable=too-many-arguments
      Severity: Minor
      Found in hdl_checker/diagnostics.py - About 45 mins to fix

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

        def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
        Severity: Minor
        Found in hdl_checker/_version.py - About 35 mins to fix

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

          def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
          Severity: Minor
          Found in versioneer.py - About 35 mins to fix

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

            def _filterGitIgnoredPathsOnWin(path_to_repo, paths):
                # type: (Path, Iterable[Path]) -> Iterable[Path]
                """
                Filters out paths that are ignored by git; paths outside the repo are kept.
                Uses a multiple calls to 'git check-ignore' and checks if the output is
            Severity: Minor
            Found in hdl_checker/parser_utils.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 _filterGitIgnoredPathsOnUnix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _filterGitIgnoredPathsOnUnix(path_to_repo, paths):
                # type: (Path, Iterable[Path]) -> Iterable[Path]
                """
                Filters out paths that are ignored by git; paths outside the repo are kept.
                Uses a 'git check-ignore --stdin' and writes <paths> iteratively to avoid
            Severity: Minor
            Found in hdl_checker/parser_utils.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 _getLibraries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _getLibraries(self):
                    # type: (...) -> Any
                    """
                    Parses the source file to find design units and dependencies
                    """
            Severity: Minor
            Found in hdl_checker/parsers/vhdl_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 _searchForRebuilds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _searchForRebuilds(self, path, line):
                    # type: (Path, str) -> Iterable[Mapping[str, str]]
                    if line.startswith("** Warning: ") and "Waiting for lock by" in line:
                        yield {"rebuild_path": path.abspath}
                    for match in MSim._iter_rebuild_units(line):
            Severity: Minor
            Found in hdl_checker/builders/msim.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 _logBuildResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _logBuildResults(self, diagnostics, rebuilds):  # pragma: no cover
                    # type: (...) -> Any
                    """
                    Logs diagnostics and rebuilds only for debugging purposes
                    """
            Severity: Minor
            Found in hdl_checker/builders/base_builder.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 references has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def references(self, params: ReferenceParams) -> Optional[List[Location]]:
                    "Tries to find references for the selected element"
            
                    element = self.getElementAtPosition(
                        Path(to_fs_path(params.textDocument.uri)), params.position
            Severity: Minor
            Found in hdl_checker/lsp.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 _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

            Severity
            Category
            Status
            Source
            Language