avocado-framework/avocado

View on GitHub

Showing 885 of 903 total issues

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

    def test_one_test_skip_failure(self):
        events = self.parse_tap("not ok 1 abc # SKIP")
        self.assert_test(events, number=1, name="abc", result=TestResult.FAIL)
        self.assert_last(events)
Severity: Major
Found in selftests/unit/tap.py and 5 other locations - About 1 hr to fix
selftests/unit/tap.py on lines 92..95
selftests/unit/tap.py on lines 97..100
selftests/unit/tap.py on lines 102..105
selftests/unit/tap.py on lines 107..110
selftests/unit/tap.py on lines 121..124

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

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

    def test_one_test_with_number(self):
        events = self.parse_tap("ok 1")
        self.assert_test(events, number=1, name="", result=TestResult.PASS)
        self.assert_last(events)
Severity: Major
Found in selftests/unit/tap.py and 5 other locations - About 1 hr to fix
selftests/unit/tap.py on lines 92..95
selftests/unit/tap.py on lines 102..105
selftests/unit/tap.py on lines 107..110
selftests/unit/tap.py on lines 121..124
selftests/unit/tap.py on lines 126..129

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

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

    def test_one_test_with_name(self):
        events = self.parse_tap("ok 1 abc")
        self.assert_test(events, number=1, name="abc", result=TestResult.PASS)
        self.assert_last(events)
Severity: Major
Found in selftests/unit/tap.py and 5 other locations - About 1 hr to fix
selftests/unit/tap.py on lines 92..95
selftests/unit/tap.py on lines 97..100
selftests/unit/tap.py on lines 107..110
selftests/unit/tap.py on lines 121..124
selftests/unit/tap.py on lines 126..129

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

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 add_argparser_to_option has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def add_argparser_to_option(
Severity: Major
Found in avocado/core/settings.py - About 1 hr to fix

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

        def test_one_test_not_ok(self):
            events = self.parse_tap("not ok")
            self.assert_test(events, number=1, name="", result=TestResult.FAIL)
            self.assert_last(events)
    Severity: Major
    Found in selftests/unit/tap.py and 5 other locations - About 1 hr to fix
    selftests/unit/tap.py on lines 92..95
    selftests/unit/tap.py on lines 97..100
    selftests/unit/tap.py on lines 102..105
    selftests/unit/tap.py on lines 121..124
    selftests/unit/tap.py on lines 126..129

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

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

        def test_one_test_skip(self):
            events = self.parse_tap("ok 1 abc # SKIP")
            self.assert_test(events, number=1, name="abc", result=TestResult.SKIP)
            self.assert_last(events)
    Severity: Major
    Found in selftests/unit/tap.py and 5 other locations - About 1 hr to fix
    selftests/unit/tap.py on lines 92..95
    selftests/unit/tap.py on lines 97..100
    selftests/unit/tap.py on lines 102..105
    selftests/unit/tap.py on lines 107..110
    selftests/unit/tap.py on lines 126..129

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

    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_extract_from_deb(self):
            mn = manager.SoftwareManager()
            result = mn.extract_from_package(self.deb_path, self.tmpdir.name)
            self.assertEqual(self.tmpdir.name, result)
    Severity: Major
    Found in selftests/functional/software_manager.py and 1 other location - About 1 hr to fix
    selftests/functional/software_manager.py on lines 18..21

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

    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_extract_from_rpm(self):
            mn = manager.SoftwareManager()
            result = mn.extract_from_package(self.rpm_path, self.tmpdir.name)
            self.assertEqual(self.tmpdir.name, result)
    Severity: Major
    Found in selftests/functional/software_manager.py and 1 other location - About 1 hr to fix
    selftests/functional/software_manager.py on lines 23..26

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

    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

            self.iso_path = os.path.abspath(
                os.path.join(
                    os.path.dirname(os.path.dirname(__file__)),
                    os.path.pardir,
                    ".data",
    Severity: Major
    Found in selftests/unit/utils/iso9660.py and 1 other location - About 1 hr to fix
    selftests/unit/utils/iso9660.py on lines 16..22

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

    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

        def setUp(self):
            self.iso_path = os.path.abspath(
                os.path.join(
                    os.path.dirname(os.path.dirname(__file__)),
                    os.path.pardir,
    Severity: Major
    Found in selftests/unit/utils/iso9660.py and 1 other location - About 1 hr to fix
    selftests/unit/utils/iso9660.py on lines 61..66

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

    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_is_not_valid(self):
            not_deb_path = os.path.join(BASEDIR, "selftests", ".data", "guaca.a")
            dpkg = backends.dpkg.DpkgBackend
            self.assertFalse(dpkg.is_valid(not_deb_path))
    Severity: Major
    Found in selftests/unit/utils/software_manager.py and 1 other location - About 1 hr to fix
    selftests/unit/utils/software_manager.py on lines 26..29

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

    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 __eq__(self, other):
            return (
                self.total_uncovered == other.total_uncovered
                and self.total_covered_more_than_ones == other.total_covered_more_than_ones
                and self.hash_table == other.hash_table
    optional_plugins/varianter_cit/avocado_varianter_cit/CombinationRow.py on lines 129..133

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

    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_is_valid(self):
            deb_path = os.path.join(BASEDIR, "selftests", ".data", "hello.deb")
            dpkg = backends.dpkg.DpkgBackend
            self.assertTrue(dpkg.is_valid(deb_path))
    Severity: Major
    Found in selftests/unit/utils/software_manager.py and 1 other location - About 1 hr to fix
    selftests/unit/utils/software_manager.py on lines 31..34

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

    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 __eq__(self, other):
            return (
                self.covered_more_than_ones == other.covered_more_than_ones
                and self.uncovered == other.uncovered
                and self.hash_table == other.hash_table
    optional_plugins/varianter_cit/avocado_varianter_cit/CombinationMatrix.py on lines 206..210

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

    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 create_namespace has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create_namespace(
    Severity: Major
    Found in avocado/utils/pmem.py - About 1 hr to fix

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

          def handle_default():
              LOG_UI.info(
                  "Config files read (in order, '*' means the file exists "
                  "and had been read):"
              )
      Severity: Minor
      Found in avocado/plugins/config.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 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 _handle_control_tag has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _handle_control_tag(path, node, value):
          """
          Handling of most YAML control tags (all but "!using")
      
          :param path: path on the YAML

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

          def _display_extra(suite, verbose=True):
              """Display extra data when in verbose mode."""
              if not verbose:
                  return
      
      
      Severity: Minor
      Found in avocado/plugins/list.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 _get_version_match has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_version_match(self):
              """
              Returns the match result for the version regex on the file content
              """
              if self.check_version():
      Severity: Minor
      Found in avocado/utils/distro.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

      Severity
      Category
      Status
      Source
      Language