conan-io/conan

View on GitHub
conans/client/tools/oss.py

Summary

Maintainability
F
1 wk
Test Coverage

Function get_gnu_triplet has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
Open

def get_gnu_triplet(os_, arch, compiler=None):
    """
    Returns string with <machine>-<vendor>-<op_system> triplet (<vendor> can be omitted in practice)

    :param os_: os to be used to create the triplet
Severity: Minor
Found in conans/client/tools/oss.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

Avoid too many return statements within this function.
Open

        return "x86"
Severity: Major
Found in conans/client/tools/oss.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return False
    Severity: Major
    Found in conans/client/tools/oss.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return "sarge"
      Severity: Major
      Found in conans/client/tools/oss.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return "Puma"
        Severity: Major
        Found in conans/client/tools/oss.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return "mips64"
          Severity: Major
          Found in conans/client/tools/oss.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return "armv7"
            Severity: Major
            Found in conans/client/tools/oss.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return "sparc"
              Severity: Major
              Found in conans/client/tools/oss.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return "lenny"
                Severity: Major
                Found in conans/client/tools/oss.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return CYGWIN
                  Severity: Major
                  Found in conans/client/tools/oss.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return None
                    Severity: Major
                    Found in conans/client/tools/oss.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return "Jaguar"
                      Severity: Major
                      Found in conans/client/tools/oss.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return WSL
                        Severity: Major
                        Found in conans/client/tools/oss.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return "mips"
                          Severity: Major
                          Found in conans/client/tools/oss.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return "etch"
                            Severity: Major
                            Found in conans/client/tools/oss.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return "woody"
                              Severity: Major
                              Found in conans/client/tools/oss.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return "Windows 10"
                                Severity: Major
                                Found in conans/client/tools/oss.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return "Yosemite"
                                  Severity: Major
                                  Found in conans/client/tools/oss.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return "Tiger"
                                    Severity: Major
                                    Found in conans/client/tools/oss.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                          return MSYS2
                                      Severity: Major
                                      Found in conans/client/tools/oss.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return "sparc"
                                        Severity: Major
                                        Found in conans/client/tools/oss.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return "s390x"
                                          Severity: Major
                                          Found in conans/client/tools/oss.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return OSInfo.get_e2k_architecture()
                                            Severity: Major
                                            Found in conans/client/tools/oss.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                          return "Cheetha"
                                              Severity: Major
                                              Found in conans/client/tools/oss.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                    return False
                                                Severity: Major
                                                Found in conans/client/tools/oss.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return "armv8"
                                                  Severity: Major
                                                  Found in conans/client/tools/oss.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                        return None
                                                    Severity: Major
                                                    Found in conans/client/tools/oss.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                  return "Windows 8"
                                                      Severity: Major
                                                      Found in conans/client/tools/oss.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                    return "Mavericks"
                                                        Severity: Major
                                                        Found in conans/client/tools/oss.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                      return "Lion"
                                                          Severity: Major
                                                          Found in conans/client/tools/oss.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                        return "Snow Leopard"
                                                            Severity: Major
                                                            Found in conans/client/tools/oss.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                      return "x86_64"
                                                              Severity: Major
                                                              Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        return "armv6"
                                                                Severity: Major
                                                                Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                          return "s390"
                                                                  Severity: Major
                                                                  Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                return "Mountain Lion"
                                                                    Severity: Major
                                                                    Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                                  return "Windows 8.1"
                                                                      Severity: Major
                                                                      Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                    return "Panther"
                                                                        Severity: Major
                                                                        Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return "armv8"
                                                                          Severity: Major
                                                                          Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                        return None
                                                                            Severity: Major
                                                                            Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return "sparcv9"
                                                                              Severity: Major
                                                                              Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                        return "armv8"
                                                                                Severity: Major
                                                                                Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                              return "Leopard"
                                                                                  Severity: Major
                                                                                  Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                        return MSYS
                                                                                    Severity: Major
                                                                                    Found in conans/client/tools/oss.py - About 30 mins to fix

                                                                                      Function detected_architecture has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                                                                                      Open

                                                                                      def detected_architecture():
                                                                                          # FIXME: Very weak check but not very common to run conan in other architectures
                                                                                          machine = platform.machine()
                                                                                          os_info = OSInfo()
                                                                                          arch = None
                                                                                      Severity: Minor
                                                                                      Found in conans/client/tools/oss.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

                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                      def get_gnu_triplet(os_, arch, compiler=None):
                                                                                          """
                                                                                          Returns string with <machine>-<vendor>-<op_system> triplet (<vendor> can be omitted in practice)
                                                                                      
                                                                                          :param os_: os to be used to create the triplet
                                                                                      Severity: Major
                                                                                      Found in conans/client/tools/oss.py and 1 other location - About 5 days to fix
                                                                                      conan/tools/gnu/get_gnu_triplet.py on lines 4..99

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 558.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                              if not version:
                                                                                                  return None
                                                                                              elif version.major() == "8.Y.Z":
                                                                                                  return "jessie"
                                                                                              elif version.major() == "7.Y.Z":
                                                                                      Severity: Major
                                                                                      Found in conans/client/tools/oss.py and 1 other location - About 1 day to fix
                                                                                      conans/client/tools/oss.py on lines 317..332

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 125.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                              elif version.minor() == "10.7.Z":
                                                                                                  return "Lion"
                                                                                              elif version.minor() == "10.6.Z":
                                                                                                  return "Snow Leopard"
                                                                                              elif version.minor() == "10.5.Z":
                                                                                      Severity: Major
                                                                                      Found in conans/client/tools/oss.py and 1 other location - About 1 day to fix
                                                                                      conans/client/tools/oss.py on lines 267..282

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 125.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                      Open

                                                                                          if skip_x64_x86 and host_os is not None and (build_os == host_os) and \
                                                                                                  host_arch is not None and ((build_arch == "x86_64") and (host_arch == "x86") or
                                                                                                                             (build_arch == "sparcv9") and (host_arch == "sparc") or
                                                                                                                             (build_arch == "ppc64") and (host_arch == "ppc32")):
                                                                                              return False
                                                                                      Severity: Major
                                                                                      Found in conans/client/tools/oss.py and 1 other location - About 5 hrs to fix
                                                                                      conan/tools/build/cross_building.py on lines 6..10

                                                                                      Duplicated Code

                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                      Tuning

                                                                                      This issue has a mass of 90.

                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                      Refactorings

                                                                                      Further Reading

                                                                                      Do not use bare 'except'
                                                                                      Open

                                                                                              except:
                                                                                      Severity: Minor
                                                                                      Found in conans/client/tools/oss.py by pep8

                                                                                      When catching exceptions, mention specific exceptions when possible.

                                                                                      Okay: except Exception:
                                                                                      Okay: except BaseException:
                                                                                      E722: except:

                                                                                      There are no issues that match your filters.

                                                                                      Category
                                                                                      Status