avocado-framework/avocado

View on GitHub

Showing 885 of 903 total issues

File output_check.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import os
import unittest

from avocado.core import exit_codes
Severity: Minor
Found in selftests/functional/output_check.py - About 5 hrs to fix

    File core.py has 368 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import ast
    import collections
    import sys
    from importlib.machinery import PathFinder
    
    
    Severity: Minor
    Found in avocado/core/safeloader/core.py - About 4 hrs to fix

      Function factory has 120 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var factory = function( $, DataTable ) {
          "use strict";
      
      
          /* Set the defaults for DataTables initialisation */

        File memory.py has 364 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: Minor
        Found in avocado/utils/memory.py - About 4 hrs to fix

          ArchiveTest has 36 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ArchiveTest(unittest.TestCase):
              def setUp(self):
                  prefix = temp_dir_prefix(self)
                  self.basedir = tempfile.TemporaryDirectory(prefix=prefix)
                  self.compressdir = tempfile.mkdtemp(dir=self.basedir.name)
          Severity: Minor
          Found in selftests/unit/utils/archive.py - About 4 hrs to fix

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

                def test_greater_than_equal_chunk_size(self, buddy_mocked):
                    chunk_size = ">=3"
                    result = memory.get_buddy_info(chunk_size)
                    self.assertEqual(result["3"], 12819)
                    self.assertEqual(result["4"], 19278)
            Severity: Major
            Found in selftests/unit/utils/memory.py and 2 other locations - About 4 hrs to fix
            selftests/unit/utils/memory.py on lines 40..46
            selftests/unit/utils/memory.py on lines 76..82

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

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

                def test_multiple_chunk_size_filtering(self, buddy_mocked):
                    chunk_size = ">=2 <=4"
                    result = memory.get_buddy_info(chunk_size)
                    self.assertEqual(result["2"], 10048)
                    self.assertEqual(result["3"], 12819)
            Severity: Major
            Found in selftests/unit/utils/memory.py and 2 other locations - About 4 hrs to fix
            selftests/unit/utils/memory.py on lines 40..46
            selftests/unit/utils/memory.py on lines 55..61

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

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

                def test_less_than_equal_chunk_size(self, buddy_mocked):
                    chunk_size = "<=2"
                    result = memory.get_buddy_info(chunk_size)
                    self.assertEqual(result["0"], 6418)
                    self.assertEqual(result["1"], 10439)
            Severity: Major
            Found in selftests/unit/utils/memory.py and 2 other locations - About 4 hrs to fix
            selftests/unit/utils/memory.py on lines 55..61
            selftests/unit/utils/memory.py on lines 76..82

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

            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 makeState has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

                def makeState(self, state, sym):
                    assert sym is not None
                    #
                    #  Compute \epsilon-kernel state's core and see if
                    #  it exists already.
            Severity: Minor
            Found in avocado/utils/external/spark.py - About 4 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 plugin_interfaces.py has 357 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: Minor
            Found in avocado/core/plugin_interfaces.py - About 4 hrs to fix

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

              import logging
              import os
              import tempfile
              import unittest.mock
              
              
              Severity: Minor
              Found in selftests/unit/job.py - About 4 hrs to fix

                TapParserTests has 35 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class TapParserTests(unittest.TestCase):
                    def assert_test(self, events, **kwargs):
                        if "explanation" not in kwargs:
                            kwargs["explanation"] = None
                        self.assertEqual(next(events), TapParser.Test(**kwargs))
                Severity: Minor
                Found in selftests/unit/tap.py - About 4 hrs to fix

                  File multipath.py has 353 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: Minor
                  Found in avocado/utils/multipath.py - About 4 hrs to fix

                    Function clean_hash_table has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def clean_hash_table(self, combination_matrix, t_value):
                            for constraint in self.constraints:
                                if len(constraint) > t_value:
                                    continue
                                parameters_in_constraint = []
                    Severity: Minor
                    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Solver.py - About 4 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

                    Function simplify_constraints has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def simplify_constraints(self):
                            items_to_remove = set()
                            copy = list(self.constraints.copy())
                            for i in range(len(copy)):
                                is_brake = False
                    Severity: Minor
                    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Solver.py - About 4 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

                    Function compare_matrices has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def compare_matrices(matrix1, matrix2, threshold=0.05):
                        """
                        Compare 2 matrices nxm and return a matrix nxm with comparison data and
                        stats. When the first columns match, they are considered as header and
                        included in the results intact.
                    Severity: Minor
                    Found in avocado/utils/data_structures.py - About 4 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

                    Function makeSet has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def makeSet(self, token, sets, i):
                            cur, next_item = sets[i], sets[i + 1]
                    
                            ttype = (  # pylint: disable=R1709
                                token is not None and self.typestring(token) or None
                    Severity: Minor
                    Found in avocado/utils/external/spark.py - About 4 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

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

                    Severity: Major
                    Found in selftests/.data/exec_test_std/exec_test_1mib.py and 1 other location - About 4 hrs to fix
                    selftests/.data/exec_test_std/exec_test_64kib.py on lines 0..9

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

                    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

                    Severity: Major
                    Found in selftests/.data/exec_test_std/exec_test_64kib.py and 1 other location - About 4 hrs to fix
                    selftests/.data/exec_test_std/exec_test_1mib.py on lines 0..9

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

                    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 sys_v_init_result_parser has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def sys_v_init_result_parser(command):
                        """
                        Parse results from sys_v style commands.
                    
                        command status: return true if service is running.
                    Severity: Minor
                    Found in avocado/utils/service.py - About 4 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