avocado-framework/avocado

View on GitHub

Showing 685 of 703 total issues

File service.py has 620 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#  Copyright(c) 2013 Intel Corporation.
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms and conditions of the GNU General Public License,
#  version 2, as published by the Free Software Foundation.
Severity: Major
Found in avocado/utils/service.py - About 1 day to fix

    File output.py has 609 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    #
    Severity: Major
    Found in avocado/core/output.py - About 1 day to fix

      File job.py has 592 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # This program is free software; you can redistribute it and/or modify
      # it under the terms of the GNU General Public License as published by
      # the Free Software Foundation; either version 2 of the License, or
      # (at your option) any later version.
      #
      Severity: Major
      Found in avocado/core/job.py - About 1 day to fix

        File output.py has 582 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        import os
        import re
        import shlex
        import unittest
        Severity: Major
        Found in selftests/functional/output.py - About 1 day to fix

          File lv_utils.py has 581 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Copyright (C) IBM 2016 - Harish <harisrir@linux.vnet.ibm.com>
          # Copyright (C) Red Hat 2016 - Lukas Doktor <ldoktor@redhat.com>
          # Copyright (C) Intra2net AG 2018 - Plamen Dimitrov <pdimitrov@pevogam.com>
          #
          # This program is free software; you can redistribute it and/or modify it
          Severity: Major
          Found in avocado/utils/lv_utils.py - About 1 day to fix

            File spark.py has 580 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #  Copyright (c) 1998-2002 John Aycock
            #
            #  Permission is hereby granted, free of charge, to any person obtaining
            #  a copy of this software and associated documentation files (the
            #  "Software"), to deal in the Software without restriction, including
            Severity: Major
            Found in avocado/utils/external/spark.py - About 1 day to fix

              File vmimage.py has 580 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # This program is free software; you can redistribute it and/or modify
              # it under the terms of the GNU General Public License as published by
              # the Free Software Foundation; either version 2 of the License, or
              # (at your option) any later version.
              #
              Severity: Major
              Found in avocado/utils/vmimage.py - About 1 day to fix

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

                    def test_already_installed(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: True
                        runnable = Runnable(
                            kind="package", uri=None, **{"action": "install", "name": "foo"}
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 135..151
                selftests/unit/runner_package.py on lines 172..188
                selftests/unit/runner_package.py on lines 190..206

                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 142.

                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 4 locations. Consider refactoring.
                Open

                    def test_success_check(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: True
                        runnable = Runnable(
                            kind="package", uri=None, **{"action": "check", "name": "foo"}
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 79..95
                selftests/unit/runner_package.py on lines 135..151
                selftests/unit/runner_package.py on lines 190..206

                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 142.

                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 4 locations. Consider refactoring.
                Open

                    def test_not_installed(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: False
                        runnable = Runnable(
                            kind="package", uri=None, **{"action": "remove", "name": "foo"}
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 79..95
                selftests/unit/runner_package.py on lines 172..188
                selftests/unit/runner_package.py on lines 190..206

                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 142.

                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 4 locations. Consider refactoring.
                Open

                    def test_fail_check(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: False
                        runnable = Runnable(
                            kind="package", uri=None, **{"action": "check", "name": "foo"}
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 79..95
                selftests/unit/runner_package.py on lines 135..151
                selftests/unit/runner_package.py on lines 172..188

                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 142.

                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

                Function makeSet_fast has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
                Open

                    def makeSet_fast(self, token, sets, i):
                        #
                        #  Call *only* when the entire state machine has been built!
                        #  It relies on self.edges being filled in completely, and
                        #  then duplicates and inlines code to boost speed at the
                Severity: Minor
                Found in avocado/utils/external/spark.py - About 1 day 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 list_downloaded_images has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                Open

                def list_downloaded_images():
                    """
                    List the available Image inside avocado cache
                    :return: list with image's parameters
                    :rtype: list of dicts
                Severity: Minor
                Found in avocado/plugins/vmimage.py - About 1 day 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 asset.py has 558 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # This program is free software; you can redistribute it and/or modify
                # it under the terms of the GNU General Public License as published by
                # the Free Software Foundation; either version 2 of the License, or
                # (at your option) any later version.
                #
                Severity: Major
                Found in avocado/utils/asset.py - About 1 day to fix

                  File cpu.py has 551 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # This program is free software; you can redistribute it and/or modify
                  # it under the terms of the GNU General Public License as published by
                  # the Free Software Foundation; either version 2 of the License, or
                  # (at your option) any later version.
                  #
                  Severity: Major
                  Found in avocado/utils/cpu.py - About 1 day to fix

                    File runnable.py has 535 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import base64
                    import collections
                    import copy
                    import json
                    import logging
                    Severity: Major
                    Found in avocado/core/nrunner/runnable.py - About 1 day to fix

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

                              for parent in parents:
                                  try:
                                      (
                                          parent_class,
                                          imported_symbol,
                      Severity: Major
                      Found in avocado/core/safeloader/core.py and 1 other location - About 1 day to fix
                      avocado/core/safeloader/core.py on lines 426..455

                      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 124.

                      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

                              for parent in parents:
                                  try:
                                      (
                                          parent_class,
                                          imported_symbol,
                      Severity: Major
                      Found in avocado/core/safeloader/core.py and 1 other location - About 1 day to fix
                      avocado/core/safeloader/core.py on lines 283..312

                      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 124.

                      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

                      Function compute_constraints has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def compute_constraints(self):
                              for p in self.parameters:
                                  if p.is_full:
                                      array = [c for c in p.constraints if len(c) != 0]
                                      con = list(itertools.product(*array))
                      Severity: Minor
                      Found in optional_plugins/varianter_cit/avocado_varianter_cit/Solver.py - About 1 day 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 main has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def main(args):  # pylint: disable=W0621
                      
                          args.dict_tests = {
                              "static-checks": False,
                              "job-api": False,
                      Severity: Minor
                      Found in selftests/check.py - About 7 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

                      Severity
                      Category
                      Status
                      Source
                      Language