aspiers/git-deps

View on GitHub

Showing 14 of 15 total issues

Function serve has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def serve(options):
    try:
        import flask
        from flask import Flask, send_file
        from flask.json import jsonify
Severity: Minor
Found in git_deps/server.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 detector.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import re
import subprocess

import pygit2

Severity: Minor
Found in git_deps/detector.py - About 2 hrs to fix

    Function cli has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def cli(options, args):
        detector = DependencyDetector(options)
    
        if options.json:
            listener = JSONDependencyListener(options)
    Severity: Minor
    Found in git_deps/cli.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 tree_lookup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def tree_lookup(self, target_path, commit):
            """Navigate to the tree or blob object pointed to by the given target
            path for the given commit.  This is necessary because each git
            tree only contains entries for the directory it refers to, not
            recursively for all subdirectories.
    Severity: Minor
    Found in git_deps/detector.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 new_dependency has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def new_dependency(self, dependent, dependency, path, line_num):
            dependent_sha1 = dependent.hex
            dependency_sha1 = dependency.hex
    
            if self.options.multi:
    Severity: Minor
    Found in git_deps/listener/cli.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 parse_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_args():
        #####################################################################
        # REMINDER!!  If you change this, remember to update README.md too.
        #####################################################################
        parser = argparse.ArgumentParser(
    Severity: Minor
    Found in git_deps/cli.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 find_dependencies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_dependencies(self, dependent_rev, recurse=None):
            """Find all dependencies of the given revision, recursively traversing
            the dependency tree if requested.
            """
            if recurse is None:
    Severity: Minor
    Found in git_deps/detector.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 record_dependency_source has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def record_dependency_source(self, parent,
    Severity: Major
    Found in git_deps/detector.py - About 1 hr to fix

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

      function RunPrefixMethod(obj, method) {
      
          var p = 0, m, t;
          while (p < pfx.length && !obj[m]) {
              m = method;
      Severity: Minor
      Found in git_deps/html/js/fullscreen.js - 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 process_new_dependency has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def process_new_dependency(self, dependent, dependent_sha1,
      Severity: Minor
      Found in git_deps/detector.py - About 45 mins to fix

        Function process_blame_hunk has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def process_blame_hunk(self, dependent, dependent_sha1, parent,
        Severity: Minor
        Found in git_deps/detector.py - About 45 mins to fix

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

          def blame_via_subprocess(path, commit, start_line, num_lines):
              """
              Generate a list of blame hunks by calling 'git blame' as a separate process.
              This is a workaround for the slowness of pygit2's own blame algorithm.
              See https://github.com/aspiers/git-deps/issues/1
          Severity: Minor
          Found in git_deps/blame.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 debug_hunk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def debug_hunk(self, line_range_before, line_range_after, hunk,
                             line_to_culprit):
                  diff_format = '          | %8.8s %5s %s%s'
                  hunk_header = '@@ %s %s @@' % (line_range_before, line_range_after)
                  self.logger.debug(diff_format % ('--------', '-----', '', hunk_header))
          Severity: Minor
          Found in git_deps/detector.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 process_new_dependency has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_new_dependency(self, dependent, dependent_sha1,
                                         dependency, dependency_sha1,
                                         path, line_num):
                  if not self.seen_commit(dependency):
                      self.notify_listeners("new_commit", dependency)
          Severity: Minor
          Found in git_deps/detector.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