conan-io/conan

View on GitHub

Showing 364 of 2,550 total issues

Avoid deeply nested control flow statements.
Open

                    if os.path.isfile(windows_h):
                        return sdk_version
    return None
Severity: Major
Found in conans/client/tools/win.py - About 45 mins to fix

    Function _evaluate_remote_pkg has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

        def _evaluate_remote_pkg(self, node, pref, remote, remotes, remote_selected):
            remote_info = None
            # If the remote is pinned (remote_selected) we won't iterate the remotes.
            # The "remote" can come from -r or from the registry (associated ref)
            if remote_selected or remote:
    Severity: Minor
    Found in conans/client/graph/graph_binaries.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

    Avoid deeply nested control flow statements.
    Open

                            if node.binary not in (BINARY_MISSING, ):
                                node.conanfile.output.info("Main binary package '%s' missing. Using "
                                                           "compatible package '%s'"
                                                           % (node.package_id, package_id))
    
    
    Severity: Major
    Found in conans/client/graph/graph_binaries.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if member.linkpath.startswith(common_folder):
                              # https://github.com/conan-io/conan/issues/11065
                              linkpath = member.linkpath.replace("\\", "/")
                              member.linkpath = linkpath.split("/", 1)[1]
                              member.linkname = member.linkpath
      Severity: Major
      Found in conans/client/tools/files.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (temp_value.isnumeric() or
                                    temp_value in ['true', 'false', 'undefined']):
                                value = temp_value
                        config[key] = value
        Severity: Major
        Found in conan/tools/qbs/qbsprofile.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if "@" not in ref:
                                      ref += "@"
                              else:
          Severity: Major
          Found in conans/model/graph_lock.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if start:
                                    break
                                start = True
            Severity: Major
            Found in conans/cli/commands/help.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if name in libs:
                                      _save_lib_path(name, full_path)
              
              
              Severity: Major
              Found in conan/tools/google/bazeldeps.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if node.prev is None:
                                            node.prev = prev
                
                
                Severity: Major
                Found in conans/model/graph_lock.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for comp_name, comp_cpp_info in sorted_components:
                                              public_deps.append((_format_name(d.ref.name), _format_name(comp_name)))
                                      else:
                  Severity: Major
                  Found in conan/tools/apple/xcodedeps.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for file_doc in down_module["files"]:
                                            module.dependencies.append(_get_dependency(file_doc, mod_dep_id))
                    
                    
                    Severity: Major
                    Found in conans/build_info/conan_build_info.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for comp_name, comp in components.items():
                                                  for dep_name, dep in components.items():
                                                      for require in self._filter_component_requires(dep.requires):
                                                          if require == comp_name:
                                                              dset.add("   {} requires {}".format(dep_name, comp_name))
                      Severity: Major
                      Found in conans/model/build_info.py - About 45 mins to fix

                        Function context has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                        Open

                            def context(self):
                                # Parsing existing toolchain file to get existing configured runtimes
                                settings = self._conanfile.settings
                                if settings.get_safe("os") != "Windows":
                                    return
                        Severity: Minor
                        Found in conan/tools/cmake/toolchain/blocks.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 __init__ has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                        Open

                            def __init__(self, conanfile, backend=None):
                                self._conanfile = conanfile
                                self._os = self._conanfile.settings.get_safe("os")
                                self._is_apple_system = is_apple_os(self._conanfile)
                        
                        
                        Severity: Minor
                        Found in conan/tools/meson/toolchain.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 infix_to_postfix has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                        Open

                        def infix_to_postfix(exp):
                            """
                            Translates an infix expression to postfix using an standard algorithm
                            with little hacks for parse complex expressions like "compiler.version=4"
                            instead of just numbers and without taking in account the operands priority
                        Severity: Minor
                        Found in conans/search/query_parse.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

                        Avoid deeply nested control flow statements.
                        Open

                                                if "@" not in ref:
                                                    ref = ref.replace("#", "@#")
                                            if (ref, locked_node.package_id, locked_node.context) not in total_prefs:
                        Severity: Major
                        Found in conans/model/graph_lock.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if member.linkpath.startswith(common_folder):
                                                  # https://github.com/conan-io/conan/issues/11065
                                                  linkpath = member.linkpath.replace("\\", "/")
                                                  member.linkpath = linkpath.split("/", 1)[1]
                                                  member.linkname = member.linkpath
                          Severity: Major
                          Found in conan/tools/files/files.py - About 45 mins to fix

                            Function get_graph_info has 11 arguments (exceeds 10 allowed). Consider refactoring.
                            Open

                            def get_graph_info(profile_host, profile_build, cwd, install_folder, cache, output,
                            Severity: Major
                            Found in conans/client/conan_api.py - About 35 mins to fix

                              Function info_nodes_to_build has 11 arguments (exceeds 10 allowed). Consider refactoring.
                              Open

                                  def info_nodes_to_build(self, reference, build_modes, settings=None, options=None, env=None,
                              Severity: Major
                              Found in conans/client/conan_api.py - About 35 mins to fix

                                Function info_build_order has 11 arguments (exceeds 10 allowed). Consider refactoring.
                                Open

                                    def info_build_order(self, reference, settings=None, options=None, env=None,
                                Severity: Major
                                Found in conans/client/conan_api.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language