melexis/warnings-plugin

View on GitHub

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')
Severity: Minor
Found in src/mlx/warnings/warnings.py - About 5 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

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
Severity: Minor
Found in src/mlx/warnings/warnings.py - About 4 hrs to fix

    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,
    Severity: Minor
    Found in src/mlx/warnings/regex_checker.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

    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")
    Severity: Critical
    Found in src/mlx/warnings/warnings.py - About 1 hr to fix

      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')
      Severity: Minor
      Found in src/mlx/warnings/warnings.py - About 1 hr to fix

        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
        Severity: Minor
        Found in src/mlx/warnings/warnings.py - About 35 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 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
        Severity: Minor
        Found in src/mlx/warnings/warnings.py - About 35 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

        Severity
        Category
        Status
        Source
        Language