private-dreamnet/dreampower

View on GitHub

Showing 22 of 100 total issues

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

    def _setup(self, *args):
        """
        Process Image Constructor.

        :param args: <dict> args parameter to run the image transformation (default use Conf.args)
Severity: Minor
Found in src/processing/image.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

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

def merge_json_args(parser, args, json_data=None):
    def filter_conflict_args(l1, l2):
        # l2 args got priority on l1
        l1 = copy.copy(l1)
        l2 = copy.copy(l2)
Severity: Minor
Found in src/argv/__init__.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 __draw_ellipse has 16 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __draw_ellipse(a_max, a_min, angle, aurmax, aurmin, details, hairmax, hairmin, nipmax, nipmin, obj,
Severity: Major
Found in src/transform/opencv/mask.py - About 2 hrs to fix

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

    def check_arg_input(parser, args):
        if not args.input:
            parser.error("-i, --input INPUT is required.")
    
        loader = Loader.get_loader(args.input)
    Severity: Minor
    Found in src/argv/run/config.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 __define_g has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __define_g(
    Severity: Major
    Found in src/transform/gan/model.py - About 1 hr to fix

      Function init_run_parser has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def init_run_parser(subparsers):
          run_parser = subparsers.add_parser(
              'run',
              description="Process image(s) with dreampower.",
              help="Process image(s) with dreampower.",
      Severity: Minor
      Found in src/argv/run/__init__.py - About 1 hr to fix

        Function run has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function run(release) {
          if (PROVIDERS.length === 0) {
            return
          }
        
        
        Severity: Minor
        Found in src/scripts/deploy.js - About 1 hr to fix

          Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in src/transform/gan/generator.py - About 50 mins to fix

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

                def _execute(self, *args):
                    """
                    Execute all phases on the image.
            
                    :return: None
            Severity: Minor
            Found in src/processing/image.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 find_color has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def find_color(img, lower, upper):
              color_mask = cv2.inRange(img, lower, upper)
              contours, _ = cv2.findContours(color_mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
            
              found = False
            Severity: Minor
            Found in src/transform/opencv/bodypart/extract.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 shift_step has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def shift_step(args, p, reason, shift_start_add=0, shift_end_add=0):
            Severity: Minor
            Found in src/processing/utils.py - About 35 mins to fix

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

                  def __encode_input(
              Severity: Minor
              Found in src/transform/gan/model.py - About 35 mins to fix

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

                    def __init__(
                Severity: Minor
                Found in src/transform/gan/generator.py - About 35 mins to fix

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

                  def cli_build(args, dist_path="../dist"):
                      def pyinstaller_args():
                          pyinstaller_args = [
                              '--distpath={}'.format(dist_path),
                              '--workpath=./build/',
                  Severity: Minor
                  Found in src/scripts/build.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 check_arg_checkpoints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def check_arg_checkpoints(parser, args):
                      #Conf.log.debug(args.checkpoints)
                      if not ('download' in str(args.func)):
                          for _, v in args.checkpoints.items():
                              if (_ != 'checkpoints_path' and not os.path.isfile(v)):
                  Severity: Minor
                  Found in src/argv/checkpoints.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 correct_color has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def correct_color(img, percent):
                          """
                          Correct the color of an image.
                  
                          :param img: <RGB> Image to correct
                  Severity: Minor
                  Found in src/transform/opencv/correct.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 run_worker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def run_worker(klass, image_step, config=None):
                      r = None
                      for k in ("gan", "opencv"):
                          if workers.get(k).get(klass) is not None:
                              #Conf.log.debug("wk {}".format(workers.get(k).get(klass)))
                  Severity: Minor
                  Found in src/processing/worker.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 is_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def is_file(args, path):
                      if not os.path.isfile(path):
                          return False
                  
                      for mod in (overlay, auto_resize, auto_resize_crop, auto_rescale):
                  Severity: Minor
                  Found in src/processing/utils.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 __draw_ellipse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __draw_ellipse(a_max, a_min, angle, aurmax, aurmin, details, hairmax, hairmin, nipmax, nipmin, obj,
                                         titmax, titmin, vagmax, vagmin, x, y):
                          # Draw ellipse
                          if obj.name == "tit":
                              cv2.ellipse(details, (x, y), (titmax, titmin), angle, 0, 360, (0, 205, 0), -1)  # (0,0,0,50)
                  Severity: Minor
                  Found in src/transform/opencv/mask.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 find_min has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def find_min(bp_list, min_a, min_b, min_diff):
                      for a, _ in enumerate(bp_list):
                          for b, _ in enumerate(bp_list):
                              # TODO: avoid repetition (1,0) (0,1)
                              diff = abs(bp_list[a].y - bp_list[b].y)
                  Severity: Minor
                  Found in src/transform/opencv/bodypart/extract.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