avocado-framework/avocado

View on GitHub
optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py

Summary

Maintainability
D
2 days
Test Coverage
A
99%

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

        switch = random.randint(0, 9)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                        row[index] = random.randint(0, self.data[index] - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

            column_index = random.randint(0, len(row) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

            row[column_index] = random.choice(possible_numbers)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

        combination_index = random.randint(0, len(possible_combinations) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                combination_index = random.randint(0, len(possible_combinations) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

        column_index = random.randint(0, len(self.data) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

            row_index = random.randint(0, len(matrix) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                column_index = random.randint(0, len(row) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                delete_row = matrix.pop(random.randint(0, len(matrix) - 1))

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

        row[column_index] = random.choice(possible_numbers)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                row_index = random.randint(0, len(matrix) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                combination_parameters_index = random.randint(
                    0, len(possible_parameters) - 1

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

        combination_parameters_index = random.randint(0, len(possible_parameters) - 1)

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

            value_choice = random.choice(possible_values)

Function compute_row has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_row(self):
        """
        Computation of one row which covers most of combinations

        :return: new solution row
Severity: Minor
Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.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 Cit.py has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import random

from avocado_varianter_cit.CombinationMatrix import CombinationMatrix
from avocado_varianter_cit.Solver import Solver
Severity: Minor
Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 3 hrs to fix

    Function compute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def compute(self):
            """
            Searching for the best solution. It creates one solution and from that,
            it tries to create smaller solution. This searching process is limited
            by ITERATIONS_SIZE. When ITERATIONS_SIZE is 0 the last found solution is
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 1 hr 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 cover_missing_combination has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def cover_missing_combination(self, matrix):
            """
            Randomly finds one missing combination. This combination puts into each
            row of the matrix. The row with the best coverage is the solution
    
    
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 1 hr 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 change_one_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def change_one_value(self, matrix, row_index=None, column_index=None):
            """
            Change one cell inside the matrix
    
            :param matrix: matrix to be changed
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 45 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 change_one_column has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def change_one_column(self, matrix):
            """
            Randomly choose one column of the matrix. In each cell of this column
            changes value. The row with the best coverage is the solution.
    
    
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.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 compute_hamming_distance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def compute_hamming_distance(self, row):
            """
            :return: hamming distance of row from final matrix
            """
            distance = 0
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 25 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

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

                    possible_numbers = list(range(0, row[column_index])) + list(
                        range(row[column_index] + 1, self.data[column_index])
    Severity: Major
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py and 1 other location - About 2 hrs to fix
    optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py on lines 283..284

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

    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

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

            possible_numbers = list(range(0, row[column_index])) + list(
                range(row[column_index] + 1, self.data[column_index])
    Severity: Major
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py and 1 other location - About 2 hrs to fix
    optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py on lines 295..296

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

    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

            if column_index is None:
                is_cell_chosen = False
                column_index = random.randint(0, len(row) - 1)
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py and 1 other location - About 55 mins to fix
    optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py on lines 276..278

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

    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

            if row_index is None:
                is_cell_chosen = False
                row_index = random.randint(0, len(matrix) - 1)
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py and 1 other location - About 55 mins to fix
    optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py on lines 280..282

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

    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

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

                if self.combination_matrix.total_uncovered < best_uncover:
                    best_uncover = self.combination_matrix.total_uncovered
                    best_solution = solution
                    best_row_index = row_index
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py and 1 other location - About 35 mins to fix
    optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py on lines 210..213

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

    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

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

                    if self.combination_matrix.total_uncovered < best_uncover:
                        best_uncover = self.combination_matrix.total_uncovered
                        best_solution = solution
                        best_row_index = row_index
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py and 1 other location - About 35 mins to fix
    optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py on lines 256..259

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

    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

    There are no issues that match your filters.

    Category
    Status