fatiando/rockhound

View on GitHub

Showing 31 of 75 total issues

File versioneer.py has 1326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Version: 0.18

"""The Versioneer - like a rocketeer, but for versions.

The Versioneer
Severity: Major
Found in versioneer.py - About 3 days to fix

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

    # pylint: skip-file
    # 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
    Severity: Minor
    Found in rockhound/_version.py - About 5 hrs to fix

      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

      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

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

      def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None):
          """Call the given command(s)."""
          assert isinstance(commands, list)
          p = None
          for c in commands:
      Severity: Minor
      Found in rockhound/_version.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 run_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
                      env=None):
          """Call the given command(s)."""
          assert isinstance(commands, list)
          p = None
      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

      Function git_get_keywords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def git_get_keywords(versionfile_abs):
          """Extract version information from the given file."""
          # the code embedded in _version.py can just fetch the value of these
          # keywords. When used from setup.py, we don't want to import _version.py,
          # so we do it with a regexp instead. This function is not used from
      Severity: Minor
      Found in rockhound/_version.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 git_get_keywords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def git_get_keywords(versionfile_abs):
          """Extract version information from the given file."""
          # the code embedded in _version.py can just fetch the value of these
          # keywords. When used from setup.py, we don't want to import _version.py,
          # so we do it with a regexp instead. This function is not used from
      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

      Function git_versions_from_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def git_versions_from_keywords(keywords, tag_prefix, verbose):
          """Get version information from git keywords."""
          if not keywords:
              raise NotThisMethod("no keywords at all, weird")
          date = keywords.get("date")
      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

      Function git_pieces_from_vcs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
          """Get version from 'git describe' in the root of the source tree.
      
          This only gets called if the git-archive 'subst' keywords were *not*
          expanded, and _version.py hasn't already been rewritten with a short
      Severity: Minor
      Found in rockhound/_version.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 git_pieces_from_vcs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
          """Get version from 'git describe' in the root of the source tree.
      
          This only gets called if the git-archive 'subst' keywords were *not*
          expanded, and _version.py hasn't already been rewritten with a short
      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

      Function git_versions_from_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def git_versions_from_keywords(keywords, tag_prefix, verbose):
          """Get version information from git keywords."""
          if not keywords:
              raise NotThisMethod("no keywords at all, weird")
          date = keywords.get("date")
      Severity: Minor
      Found in rockhound/_version.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 get_cmdclass has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_cmdclass():
          """Get the custom setuptools/distutils subclasses used by Versioneer."""
          if "versioneer" in sys.modules:
              del sys.modules["versioneer"]
              # this fixes the "python setup.py develop" case (also 'install' and
      Severity: Minor
      Found in versioneer.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 do_vcs_install has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def do_vcs_install(manifest_in, versionfile_source, ipy):
          """Git-specific installation logic for Versioneer.
      
          For Git, this means creating/changing .gitattributes to mark _version.py
          for export-subst keyword substitution.
      Severity: Minor
      Found in versioneer.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 scan_setup_py has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def scan_setup_py():
          """Validate the contents of setup.py against Versioneer's expectations."""
          found = set()
          setters = False
          errors = 0
      Severity: Minor
      Found in versioneer.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 render_pep440 has a Cognitive Complexity of 10 (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 rockhound/_version.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 render_pep440_old has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def render_pep440_old(pieces):
          """TAG[.postDISTANCE[.dev0]] .
      
          The ".dev0" means dirty.
      
      
      Severity: Minor
      Found in rockhound/_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 render_pep440_post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def render_pep440_post(pieces):
          """TAG[.postDISTANCE[.dev0]+gHEX] .
      
          The ".dev0" means dirty. Note that .dev0 sorts backwards
          (a dirty tree will appear "older" than the corresponding clean one),
      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_pep440_old has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def render_pep440_old(pieces):
          """TAG[.postDISTANCE[.dev0]] .
      
          The ".dev0" means 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",
      Severity: Minor
      Found in rockhound/_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

      Severity
      Category
      Status
      Source
      Language