avocado-framework/avocado

View on GitHub

Showing 885 of 903 total issues

Function ResizeControl has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function ResizeControl(table) {
    var tableBorderSize = table.outerWidth() - table.innerWidth();
    this.resizeData = {
      isResizing: false,
      mouseDownFired: false
Severity: Major
Found in optional_plugins/html/avocado_result_html/templates/avocado_html.js - About 3 hrs to fix

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

        elif action == "add-repo":
            if software_manager.add_repo(args):
                log.info(MESSAGES[action]["success"], args)
            else:
                log.error(MESSAGES[action]["fail"], args)
    Severity: Major
    Found in avocado/utils/software_manager/main.py and 4 other locations - About 3 hrs to fix
    avocado/utils/software_manager/main.py on lines 104..109
    avocado/utils/software_manager/main.py on lines 111..116
    avocado/utils/software_manager/main.py on lines 118..123
    avocado/utils/software_manager/main.py on lines 140..145

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

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

        elif action == "remove":
            if software_manager.remove(args):
                log.info(MESSAGES[action]["success"], args)
            else:
                log.error(MESSAGES[action]["fail"], args)
    Severity: Major
    Found in avocado/utils/software_manager/main.py and 4 other locations - About 3 hrs to fix
    avocado/utils/software_manager/main.py on lines 104..109
    avocado/utils/software_manager/main.py on lines 118..123
    avocado/utils/software_manager/main.py on lines 133..138
    avocado/utils/software_manager/main.py on lines 140..145

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

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

        elif action == "remove-repo":
            if software_manager.remove_repo(args):
                log.info(MESSAGES[action]["success"], args)
            else:
                log.error(MESSAGES[action]["fail"], args)
    Severity: Major
    Found in avocado/utils/software_manager/main.py and 4 other locations - About 3 hrs to fix
    avocado/utils/software_manager/main.py on lines 104..109
    avocado/utils/software_manager/main.py on lines 111..116
    avocado/utils/software_manager/main.py on lines 118..123
    avocado/utils/software_manager/main.py on lines 133..138

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

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

        if action == "install":
            if software_manager.install(args):
                log.info(MESSAGES[action]["success"], args)
            else:
                log.error(MESSAGES[action]["fail"], args)
    Severity: Major
    Found in avocado/utils/software_manager/main.py and 4 other locations - About 3 hrs to fix
    avocado/utils/software_manager/main.py on lines 111..116
    avocado/utils/software_manager/main.py on lines 118..123
    avocado/utils/software_manager/main.py on lines 133..138
    avocado/utils/software_manager/main.py on lines 140..145

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

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

        elif action == "check-installed":
            if software_manager.check_installed(args):
                log.info(MESSAGES[action]["success"], args)
            else:
                log.info(MESSAGES[action]["fail"], args)
    Severity: Major
    Found in avocado/utils/software_manager/main.py and 4 other locations - About 3 hrs to fix
    avocado/utils/software_manager/main.py on lines 104..109
    avocado/utils/software_manager/main.py on lines 111..116
    avocado/utils/software_manager/main.py on lines 133..138
    avocado/utils/software_manager/main.py on lines 140..145

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

    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

    File __init__.py has 291 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 optional_plugins/html/avocado_result_html/__init__.py - About 3 hrs to fix

      File sqlite.py has 289 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/dependencies/requirements/cache/backends/sqlite.py - About 2 hrs to fix

        Function _get_test_variants has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_test_variants(self):
                def add_variant(runnable, variant):
                    runnable = deepcopy(runnable)
                    runnable.variant = dump_variant(variant)
                    runnable_with_variant.append(runnable)
        Severity: Minor
        Found in avocado/core/suite.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

        Function get_docstring_directives_tags has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_docstring_directives_tags(docstring):
            """
            Returns the test categories based on a `:avocado: tags=category`
            docstring
        
        
        Severity: Minor
        Found in avocado/core/safeloader/docstring.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

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

                with mock.patch.object(
                    LXCSpawner, "run_container_cmd", return_value=(0, "", "")
                ):
                    with mock.patch.object(
                        LXCSpawner, "run_container_cmd_async", return_value=(0, "", "")
        Severity: Major
        Found in selftests/functional/plugin/spawners/lxc.py and 1 other location - About 2 hrs to fix
        selftests/functional/plugin/spawners/lxc.py on lines 99..106

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

        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

                with mock.patch.object(
                    LXCSpawner, "run_container_cmd", return_value=(0, "", "")
                ):
                    with mock.patch.object(
                        LXCSpawner, "run_container_cmd_async", return_value=(0, "", "")
        Severity: Major
        Found in selftests/functional/plugin/spawners/lxc.py and 1 other location - About 2 hrs to fix
        selftests/functional/plugin/spawners/lxc.py on lines 118..125

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

        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_result_rate_half_succeeded(self):
                result = Result(UNIQUE_ID, LOGFILE)
                result.check_test({"status": "PASS"})
                result.check_test({"status": "FAIL"})
                result.end_tests()
        Severity: Major
        Found in selftests/unit/result.py and 3 other locations - About 2 hrs to fix
        selftests/unit/result.py on lines 24..29
        selftests/unit/result.py on lines 31..36
        selftests/unit/result.py on lines 38..43

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

        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_result_rate_all_succeeded_with_warns(self):
                result = Result(UNIQUE_ID, LOGFILE)
                result.check_test({"status": "PASS"})
                result.check_test({"status": "WARN"})
                result.end_tests()
        Severity: Major
        Found in selftests/unit/result.py and 3 other locations - About 2 hrs to fix
        selftests/unit/result.py on lines 31..36
        selftests/unit/result.py on lines 38..43
        selftests/unit/result.py on lines 45..50

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

        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_result_rate_all_succeeded_with_cancelled(self):
                result = Result(UNIQUE_ID, LOGFILE)
                result.check_test({"status": "PASS"})
                result.check_test({"status": "CANCEL"})
                result.end_tests()
        Severity: Major
        Found in selftests/unit/result.py and 3 other locations - About 2 hrs to fix
        selftests/unit/result.py on lines 24..29
        selftests/unit/result.py on lines 31..36
        selftests/unit/result.py on lines 45..50

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

        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_result_rate_all_succeeded_with_skips(self):
                result = Result(UNIQUE_ID, LOGFILE)
                result.check_test({"status": "PASS"})
                result.check_test({"status": "SKIP"})
                result.end_tests()
        Severity: Major
        Found in selftests/unit/result.py and 3 other locations - About 2 hrs to fix
        selftests/unit/result.py on lines 24..29
        selftests/unit/result.py on lines 38..43
        selftests/unit/result.py on lines 45..50

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

        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

            def test_relative_level0_name_from_level2(self):
                path = os.path.join(self.tmpdir.name, "l1", "l2", "l2lib1.py")
                self.assertEqual(
                    find_avocado_tests(path)[0],
                    {"BaseL2": [("test_l2", {}, []), ("test_l0", {}, [])]},
        Severity: Major
        Found in selftests/unit/safeloader_core.py and 1 other location - About 2 hrs to fix
        selftests/unit/safeloader_core.py on lines 364..368

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

        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

            def test_relative_level0_from_level2(self):
                path = os.path.join(self.tmpdir.name, "l1", "l2", "l2lib2.py")
                self.assertEqual(
                    find_avocado_tests(path)[0],
                    {"BaseL2": [("test_l2", {}, []), ("test_l0", {}, [])]},
        Severity: Major
        Found in selftests/unit/safeloader_core.py and 1 other location - About 2 hrs to fix
        selftests/unit/safeloader_core.py on lines 357..361

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

        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

        File archive.py has 288 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/archive.py - About 2 hrs to fix

          File gdbmi_parser.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #
          # Copyright (c) 2008 Michael Eddington
          #
          # Permission is hereby granted, free of charge, to any person obtaining a copy
          # of this software and associated documentation files (the "Software"), to deal
          Severity: Minor
          Found in avocado/utils/external/gdbmi_parser.py - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language