suoto/hdl_checker

View on GitHub

Showing 152 of 152 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

def render_pep440_pre(pieces):
    """TAG[.post.devDISTANCE] -- No -dirty.

    Exceptions:
    1: no tags. 0.post.devDISTANCE
Severity: Major
Found in hdl_checker/_version.py and 1 other location - About 4 hrs to fix
versioneer.py on lines 1257..1270

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 80.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

def render_pep440_pre(pieces):
    """TAG[.post.devDISTANCE] -- No -dirty.

    Exceptions:
    1: no tags. 0.post.devDISTANCE
Severity: Major
Found in versioneer.py and 1 other location - About 4 hrs to fix
hdl_checker/_version.py on lines 307..320

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 80.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File _version.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains the computed version number.
Severity: Minor
Found in hdl_checker/_version.py - About 4 hrs to fix

    File base_builder.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # This file is part of HDL Checker.
    #
    # Copyright (c) 2015 - 2019 suoto (Andre Souto)
    #
    # HDL Checker is free software: you can redistribute it and/or modify
    Severity: Minor
    Found in hdl_checker/builders/base_builder.py - About 4 hrs to fix

      Function _findObjects has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      def _findObjects(lines):
          """
          Returns an iterator with the object name and a dict with info about its
          location
          """
      Severity: Minor
      Found in hdl_checker/static_check.py - About 3 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

      File utils.py has 329 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # This file is part of HDL Checker.
      #
      # Copyright (c) 2015 - 2019 suoto (Andre Souto)
      #
      # HDL Checker is free software: you can redistribute it and/or modify
      Severity: Minor
      Found in hdl_checker/utils.py - About 3 hrs to fix

        Database has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Database(HashableByKey):  # pylint: disable=too-many-instance-attributes
            "Stores info on and provides operations for a project file set"
        
            def __init__(self):  # type: () -> None
                self._lock = RLock()
        Severity: Minor
        Found in hdl_checker/database.py - About 3 hrs to fix

          File diagnostics.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # This file is part of HDL Checker.
          #
          # Copyright (c) 2015 - 2019 suoto (Andre Souto)
          #
          # HDL Checker is free software: you can redistribute it and/or modify
          Severity: Minor
          Found in hdl_checker/diagnostics.py - About 3 hrs to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            def register_vcs_handler(vcs, method):  # decorator
                """Decorator to mark a method as the handler for a particular VCS."""
                def decorate(f):
                    """Store f in HANDLERS[vcs][method]."""
                    if vcs not in HANDLERS:
            Severity: Major
            Found in hdl_checker/_version.py and 1 other location - About 3 hrs to fix
            versioneer.py on lines 442..450

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            def register_vcs_handler(vcs, method):  # decorator
                """Decorator to mark a method as the handler for a particular VCS."""
                def decorate(f):
                    """Store f in HANDLERS[vcs][method]."""
                    if vcs not in HANDLERS:
            Severity: Major
            Found in versioneer.py and 1 other location - About 3 hrs to fix
            hdl_checker/_version.py on lines 58..66

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 63.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            BaseBuilder has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class BaseBuilder(object):  # pylint: disable=useless-object-inheritance
                """
                Class that implements the base builder flow
                """
            
            
            Severity: Minor
            Found in hdl_checker/builders/base_builder.py - About 3 hrs to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                              with open(cfg.versionfile_source, "w") as f:
                                  LONG = LONG_VERSION_PY[cfg.VCS]
                                  f.write(LONG %
                                          {"DOLLAR": "$",
                                           "STYLE": cfg.style,
              Severity: Major
              Found in versioneer.py and 1 other location - About 2 hrs to fix
              versioneer.py on lines 1666..1672

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function do_setup has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              def do_setup():
                  """Main VCS-independent setup function for installing Versioneer."""
                  root = get_root()
                  try:
                      cfg = get_config_from_root(root)
              Severity: Minor
              Found in versioneer.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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  with open(cfg.versionfile_source, "w") as f:
                      LONG = LONG_VERSION_PY[cfg.VCS]
                      f.write(LONG % {"DOLLAR": "$",
                                      "STYLE": cfg.style,
                                      "TAG_PREFIX": cfg.tag_prefix,
              Severity: Major
              Found in versioneer.py and 1 other location - About 2 hrs to fix
              versioneer.py on lines 1563..1570

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      try:
                          dispcmd = str([c] + args)
                          # remember shell=False, so use git.cmd on windows, not just git
                          p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE,
                                               stderr=(subprocess.PIPE if hide_stderr
              Severity: Major
              Found in versioneer.py and 1 other location - About 2 hrs to fix
              hdl_checker/_version.py on lines 74..80

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      try:
                          dispcmd = str([c] + args)
                          # remember shell=False, so use git.cmd on windows, not just git
                          p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE,
                                               stderr=(subprocess.PIPE if hide_stderr
              Severity: Major
              Found in hdl_checker/_version.py and 1 other location - About 2 hrs to fix
              versioneer.py on lines 458..464

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              HdlCheckerCore has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class HdlCheckerCore:
                  """
                  HDL Checker project builder class
                  """
              
              
              Severity: Minor
              Found in hdl_checker/core.py - About 2 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                class VhdlIdentifier(Identifier):
                    "Equivalent of Identifier(name, case_sensitive=False)"
                
                    def __init__(self, name):
                        # type: (str, ) -> None
                Severity: Major
                Found in hdl_checker/parsers/elements/identifier.py and 1 other location - About 2 hrs to fix
                hdl_checker/parsers/elements/identifier.py on lines 101..110

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 57.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                class VerilogIdentifier(Identifier):
                    "Equivalent of Identifier(name, case_sensitive=True)"
                
                    def __init__(self, name):
                        # type: (str, ) -> None
                Severity: Major
                Found in hdl_checker/parsers/elements/identifier.py and 1 other location - About 2 hrs to fix
                hdl_checker/parsers/elements/identifier.py on lines 89..98

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 57.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                def get_versions(verbose=False):
                    """Get the project version from whatever source is available.
                
                    Returns dict with two keys: 'version' and 'full'.
                    """
                Severity: Minor
                Found in versioneer.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

                Severity
                Category
                Status
                Source
                Language