xlab-si/xopera-opera

View on GitHub

Showing 82 of 99 total issues

Function _parser_callback has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _parser_callback(args):
    if args.instance_path and not path.isdir(args.instance_path):
        raise argparse.ArgumentTypeError(f"Directory {args.instance_path} is not a valid path!")

    if args.workers < 1:
Severity: Minor
Found in src/opera/commands/update.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 convert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def convert(self, diff):
        if isinstance(diff, set):
            return list(diff)
        if not isinstance(diff, Diff):
            return diff
Severity: Minor
Found in src/opera/compare/diff.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 compare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def compare(self, collection1, collection2, context):  # pylint: disable=arguments-differ
        diff = Diff()
        for item1 in collection1:
            item2 = next((i for i in collection2 if self.item_id_func(item1) == self.item_id_func(i)), None)
            if not item2:
Severity: Minor
Found in src/opera/compare/comparisons.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 diff_templates has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def diff_templates(
Severity: Major
Found in src/opera/commands/diff.py - About 1 hr to fix

    Function run has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def run(host, primary, dependencies, artifacts, variables, verbose, workdir, validate):
    Severity: Major
    Found in src/opera/executors/ansible/ansible.py - About 1 hr to fix

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

      def _parser_callback(args):
          if not Path(args.service_template_folder).is_dir():
              raise argparse.ArgumentTypeError(f"Directory {args.service_template_folder} is not a valid path!")
      
          # this variable sets the default CLI packaging format, user can still change it (for example to tar) when using
      Severity: Minor
      Found in src/opera/commands/package.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 prompt_yes_no_question has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def prompt_yes_no_question(
              yes_responses=("y", "yes"),
              no_responses=("n", "no"),
              case_sensitive=False,
              default_yes_response=True
      Severity: Minor
      Found in src/opera/utils.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 diff_instances has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def diff_instances(
      Severity: Major
      Found in src/opera/commands/diff.py - About 50 mins to fix

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

        def _parser_callback(args):
            if args.instance_path and not path.isdir(args.instance_path):
                raise argparse.ArgumentTypeError(f"Directory {args.instance_path} is not a valid path!")
        
            storage = Storage.create(args.instance_path)
        Severity: Minor
        Found in src/opera/commands/info.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 wait_results has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def wait_results(self):
                proceed = bool(self.futures)
        
                results = wait(
                    self.futures,
        Severity: Minor
        Found in src/opera/threading/node_executor.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 deploy_service_template has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def deploy_service_template(
        Severity: Minor
        Found in src/opera/commands/deploy.py - About 45 mins to fix

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

          def deploy_compressed_csar(
          Severity: Minor
          Found in src/opera/commands/deploy.py - About 45 mins to fix

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

                def run_operation(self,
            Severity: Minor
            Found in src/opera/instance/base.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if trigger_name_or_event in (trigger.name, trigger.event.data):
                                      trigger_name_or_event_exists = True
                                      break
              
              
              Severity: Major
              Found in src/opera/commands/notify.py - About 45 mins to fix

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

                    def eval(self, instance, key):
                        if not self.present:
                            raise DataError(f"Cannot use an unset value: {key}")
                
                        if self.is_function:
                Severity: Minor
                Found in src/opera/value.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(self, operation, host: OperationHost, verbose, workdir, validate):
                        # TODO: Respect the timeout option.
                        # TODO: Add host validation.
                        # TODO: Properly handle SELF - not even sure what this proper way would be at this time.
                        actual_host = self.get_host(operation.host or host)
                Severity: Minor
                Found in src/opera/instance/base.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 validate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def validate(csar_or_st_path: PurePath, inputs: typing.Optional[dict], storage: Storage, verbose: bool,
                Severity: Minor
                Found in src/opera/commands/validate.py - About 35 mins to fix

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

                      def _configure_requirements(self,
                  Severity: Minor
                  Found in src/opera/instance/node.py - About 35 mins to fix

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

                    def validate_csar(csar_path: PurePath, inputs: typing.Optional[dict], storage: Storage, verbose: bool,
                    Severity: Minor
                    Found in src/opera/commands/validate.py - About 35 mins to fix

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

                          def notify(self, verbose: bool, workdir: str, trigger_name_or_event: Optional[str],
                      Severity: Minor
                      Found in src/opera/instance/node.py - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language