xlab-si/xopera-opera

View on GitHub

Showing 99 of 99 total issues

Avoid too many return statements within this function.
Open

            return 0
Severity: Major
Found in src/opera/commands/undeploy.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return 1
    Severity: Major
    Found in src/opera/commands/notify.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return "unknown"
      Severity: Major
      Found in src/opera/instance/topology.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 1
        Severity: Major
        Found in src/opera/commands/undeploy.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return "error"
          Severity: Major
          Found in src/opera/instance/topology.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 0
            Severity: Major
            Found in src/opera/commands/undeploy.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return 1
              Severity: Major
              Found in src/opera/commands/update.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        return rel.template.properties[prop].eval(self, prop)
                Severity: Major
                Found in src/opera/instance/relationship.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return 0
                  Severity: Major
                  Found in src/opera/commands/undeploy.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return prompt_yes_no_question(yes_responses, no_responses, case_sensitive, default_yes_response)
                    Severity: Major
                    Found in src/opera/utils.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return rel.attributes[attr].eval(self, attr)
                      Severity: Major
                      Found in src/opera/instance/relationship.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return 1
                        Severity: Major
                        Found in src/opera/commands/deploy.py - About 30 mins to fix

                          Function notify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def notify(self, verbose: bool, workdir: str, trigger_name_or_event: Optional[str],
                                         notification_file_contents: Optional[str], num_workers=1):
                                  # This will run selected interface operations on triggers from policies that have been applied to nodes.
                                  with NodeExecutor(num_workers) as executor:
                                      do_notify = True
                          Severity: Minor
                          Found in src/opera/instance/topology.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 run_operation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def run_operation(self,
                                                host: OperationHost,
                                                interface: str,
                                                operation_type: Union[StandardInterfaceOperation, ConfigureInterfaceOperation],
                                                verbose: bool,
                          Severity: Minor
                          Found in src/opera/instance/base.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 _parser_callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _parser_callback(args):
                              try:
                                  inputs = yaml.safe_load(args.inputs) if args.inputs else {}
                              except yaml.YAMLError as e:
                                  print(f"Invalid inputs: {e}")
                          Severity: Minor
                          Found in src/opera/commands/validate.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 prepare_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def prepare_update(self, topology_template1, topology_template2, template_diff):
                                  # no need to take relationships into account
                                  # as they are always in "initial" state
                                  nodes_diff = template_diff.changed.get("nodes", Diff())
                                  for node1 in topology_template1.nodes.values():
                          Severity: Minor
                          Found in src/opera/compare/instance_comparer.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 _configure_requirements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _configure_requirements(self,
                                                          source_operation: ConfigureInterfaceOperation,
                                                          target_operation: ConfigureInterfaceOperation,
                                                          verbose: bool, workdir: str,
                                                          validate: bool = False):
                          Severity: Minor
                          Found in src/opera/instance/node.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_node_or_relationship has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def find_node_or_relationship(self, entity_name):
                                  node = self.find_node(entity_name)
                                  relationship = self.find_relationship(entity_name)
                          
                                  if not node and not relationship:
                          Severity: Minor
                          Found in src/opera/instance/topology.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 _parser_callback has a Cognitive Complexity of 6 (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/outputs.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