conan-io/conan

View on GitHub

Showing 364 of 2,550 total issues

Avoid deeply nested control flow statements.
Open

                        for token in tokens:
                            if token.startswith("-D") or token.startswith("/D"):
                                token = token[2:]
                                if '=' in token:
                                    name, value = token.split('=', 2)
Severity: Major
Found in conans/client/conf/compiler_id.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ret:
                                self._conanfile.output.info("Patched paths for %s: %s to %s"
                                                            % (dep, from_str, dep_str))
    
    
    Severity: Major
    Found in conans/client/build/cmake.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if response.status_code == 404:
                                  raise PackageNotFoundException(pref)
                              if response.status_code != 200:  # Error message is text
      Severity: Major
      Found in conans/client/rest/rest_client_v2.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if self._print_commands_to_output:
                                    log_handler.write(call_message)
                                return self._pipe_os_call(command, stream_output, log_handler, cwd, user_output)
        Severity: Major
        Found in conans/client/runner.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if pkg_metadata.remote not in remotes:
                                      pkg_metadata.remote = None
          
          
          Severity: Major
          Found in conans/client/cache/remote_registry.py - About 45 mins to fix

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

            def get_graph_info(profile_host, profile_build, cwd, install_folder, cache, output,
                               name=None, version=None, user=None, channel=None, lockfile=None):
                if lockfile:
                    try:
                        graph_info_folder = lockfile if os.path.isdir(lockfile) else os.path.dirname(lockfile)
            Severity: Minor
            Found in conans/client/conan_api.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 os.path.isfile(dst) or os.path.islink(dst):
                                        os.unlink(dst)
                                    os.symlink(linkto, dst)
            Severity: Major
            Found in conans/client/generators/deploy.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for pkg_metadata in metadata.packages.values():
                                          if pkg_metadata.remote == renamed:
                                              pkg_metadata.remote = remote_name
              
              
              Severity: Major
              Found in conans/client/cache/remote_registry.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if response.status_code != 200:  # Error message is text
                                            # To be able to access ret.text (ret.content are bytes)
                                            response.charset = "utf-8"
                                            raise get_exception_from_error(response.status_code)(response.text)
                
                
                Severity: Major
                Found in conans/client/rest/rest_client_v2.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if pkg_metadata.remote == remote_name:
                                              pkg_metadata.remote = new_remote_name
                  
                  
                  Severity: Major
                  Found in conans/client/cache/remote_registry.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if isinstance(stmt.targets[0], ast.Name) and stmt.targets[0].id == "scm":
                                            try:
                                                if i + 1 == len(statements):  # Last statement in my ClassDef
                                                    if i_body + 1 == len(tree.body):  # Last statement over all
                                                        next_line = len(lines)
                    Severity: Major
                    Found in conans/client/cmd/export.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if not os.path.isabs(link_target):
                                                  link_target = os.path.join(os.path.dirname(src), link_target)
                                              linkto = os.path.relpath(link_target, os.path.dirname(src))
                      Severity: Major
                      Found in conans/client/generators/deploy.py - About 45 mins to fix

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

                            def __init__(self, text, allowed_fields=None, parse_lines=False, raise_unexpected_field=True):
                                self._sections = {}
                                self._allowed_fields = allowed_fields or []
                                pattern = re.compile(r"^\[([a-z_]{2,50})]")
                                current_lines = None
                        Severity: Minor
                        Found in conans/util/config_parser.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 _apply_inner_profile has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                        Open

                        def _apply_inner_profile(doc, base_profile):
                            """
                        
                            :param doc: ConfigParser object from the current profile (excluding includes and vars,
                            and with values already replaced)
                        Severity: Minor
                        Found in conans/client/profile_loader.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 ref.revision != rec_rev:
                                                    self._output.warn("Skipping package '%s', it doesn't belong to the"
                                                                      " current recipe revision" % package_id)
                                                    continue
                                            package_revision = metadata.packages[package_id].revision
                        Severity: Major
                        Found in conans/client/cmd/uploader.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              with open(abs_path, 'rb') as file_handler:
                                                  tgz.addfile(tarinfo=info, fileobj=file_handler)
                                  tgz.close()
                          Severity: Major
                          Found in conans/client/cmd/uploader.py - About 45 mins to fix

                            Function info has 12 arguments (exceeds 10 allowed). Consider refactoring.
                            Open

                                def info(self, reference_or_path, remote_name=None, settings=None, options=None, env=None,
                            Severity: Major
                            Found in conans/client/conan_api.py - About 45 mins to fix

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

                                  def config(self, *args):
                                      """
                                      Manages Conan configuration.
                              
                                      Used to edit conan.conf, or install config files.
                              Severity: Minor
                              Found in conans/client/command.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 is_pristine has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                              Open

                                  def is_pristine(self):
                                      # Check if working copy is pristine/consistent
                                      if self.version >= SVN.API_CHANGE_VERSION:
                                          try:
                                              output = self.run("status -u -r {} --xml".format(self.get_revision()))
                              Severity: Minor
                              Found in conans/client/tools/scm.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 workspace_install has 12 arguments (exceeds 10 allowed). Consider refactoring.
                              Open

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