Showing 7 of 11 total issues
Function warnings_wrapper
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def warnings_wrapper(args):
parser = argparse.ArgumentParser(prog='mlx-warnings')
group1 = parser.add_argument_group('Configuration command line options')
group1.add_argument('--coverity', dest='coverity', action='store_true')
group1.add_argument('-d', '--doxygen', dest='doxygen', action='store_true')
- 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
File warnings.py
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import errno
Function add_code_quality_finding
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_code_quality_finding(self, match):
finding = {
"severity": "major",
"location": {
"path": self.cq_default_path,
- 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
Consider simplifying this complex logical expression. Open
if args.configfile is not None:
checker_flags = args.sphinx or args.doxygen or args.junit or args.coverity or args.xmlrunner or args.robot
warning_args = args.maxwarnings or args.minwarnings or args.exact_warnings
if checker_flags or warning_args:
print("Configfile cannot be provided with other arguments")
Function warnings_wrapper
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def warnings_wrapper(args):
parser = argparse.ArgumentParser(prog='mlx-warnings')
group1 = parser.add_argument_group('Configuration command line options')
group1.add_argument('--coverity', dest='coverity', action='store_true')
group1.add_argument('-d', '--doxygen', dest='doxygen', action='store_true')
Function return_check_limits
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def return_check_limits(self, name=None):
''' Function for determining the return value of the script
If the name parameter is set, this function will check (and return) the
return value of that checker. If not, this function checks whether the
- 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
Function substitute_envvar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def substitute_envvar(checker_config, keys):
"""Modifies configuration for checker in-place, resolving any environment variables for ``keys``
Args:
checker_config (dict): Configuration for a specific WarningsChecker
- 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"