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
- Read upRead up
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 "s390x"
Avoid too many return
statements within this function. Open
return OSInfo.get_e2k_architecture()
Avoid too many return
statements within this function. Open
return "Windows 10"
Avoid too many return
statements within this function. Open
return "Yosemite"
Avoid too many return
statements within this function. Open
return "lenny"
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return "armv8"
Avoid too many return
statements within this function. Open
return "armv7"
Avoid too many return
statements within this function. Open
return "sparc"
Avoid too many return
statements within this function. Open
return "woody"
Avoid too many return
statements within this function. Open
return "Windows 8.1"
Avoid too many return
statements within this function. Open
return "sarge"
Avoid too many return
statements within this function. Open
return "Tiger"
Avoid too many return
statements within this function. Open
return WSL
Avoid too many return
statements within this function. Open
return "sparcv9"
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return "Leopard"
Avoid too many return
statements within this function. Open
return "mips"
Avoid too many return
statements within this function. Open
return "s390"
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return "mips64"
Avoid too many return
statements within this function. Open
return "Windows 8"
Avoid too many return
statements within this function. Open
return "Mountain Lion"
Avoid too many return
statements within this function. Open
return "Lion"
Avoid too many return
statements within this function. Open
return "Jaguar"
Avoid too many return
statements within this function. Open
return "Puma"
Avoid too many return
statements within this function. Open
return CYGWIN
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return "Mavericks"
Avoid too many return
statements within this function. Open
return "armv8"
Avoid too many return
statements within this function. Open
return "x86"
Avoid too many return
statements within this function. Open
return "Panther"
Avoid too many return
statements within this function. Open
return "sparc"
Avoid too many return
statements within this function. Open
return "armv8"
Avoid too many return
statements within this function. Open
return "x86_64"
Avoid too many return
statements within this function. Open
return MSYS2
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return "armv6"
Avoid too many return
statements within this function. Open
return "etch"
Avoid too many return
statements within this function. Open
return "Snow Leopard"
Avoid too many return
statements within this function. Open
return "Cheetha"
Avoid too many return
statements within this function. Open
return MSYS
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
- Read upRead up
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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":
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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":
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Do not use bare 'except' Open
except:
- Read upRead up
- Exclude checks
When catching exceptions, mention specific exceptions when possible.
Okay: except Exception:
Okay: except BaseException:
E722: except: