avocado-framework/avocado

View on GitHub

Showing 840 of 857 total issues

File basic.py has 1172 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import glob
import json
import os
import re
import tempfile
Severity: Major
Found in selftests/functional/basic.py - About 3 days to fix

    File process.py has 1114 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File test.py has 741 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; specifically version 2 of the License.
      #
      # This program is distributed in the hope that it will be useful,
      Severity: Major
      Found in avocado/core/test.py - About 1 day to fix

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

            def test_too_few(self):
                events = self.parse_tap("ok 1\nnot ok 2\n1..3")
                self.assert_test(events, number=1, name="", result=TestResult.PASS)
                self.assert_test(events, number=2, name="", result=TestResult.FAIL)
                self.assert_plan(events, count=3, late=True)
        Severity: Major
        Found in selftests/unit/tap.py and 1 other location - About 1 day to fix
        selftests/unit/tap.py on lines 204..217

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

        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_too_many(self):
                events = self.parse_tap("ok 1\nnot ok 2\n1..1")
                self.assert_test(events, number=1, name="", result=TestResult.PASS)
                self.assert_test(events, number=2, name="", result=TestResult.FAIL)
                self.assert_plan(events, count=1, late=True)
        Severity: Major
        Found in selftests/unit/tap.py and 1 other location - About 1 day to fix
        selftests/unit/tap.py on lines 219..232

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

        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 process.py has 687 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import io
        import logging
        import os
        import sys
        import time
        Severity: Major
        Found in selftests/unit/utils/process.py - About 1 day to fix

          Function parse has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse(self):
                  found_late_test = False
                  bailed_out = False
                  plan = None
                  lineno = 0
          Severity: Minor
          Found in avocado/core/tapparser.py - About 1 day to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          File check.py has 651 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #!/usr/bin/env python3
          
          import argparse
          import copy
          import glob
          Severity: Major
          Found in selftests/check.py - About 1 day to fix

            File interfaces.py has 648 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File gdb.py has 636 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

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

                    def test_runner_python_unittest_ok(self):
                        runnable = Runnable(
                            "python-unittest", "selftests/.data/unittests.py:First.test_pass"
                        )
                        runner_klass = runnable.pick_runner_class()
                Severity: Major
                Found in selftests/unit/nrunner.py and 1 other location - About 1 day to fix
                selftests/unit/nrunner.py on lines 317..334

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

                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_runner_python_unittest_skip(self):
                        runnable = Runnable(
                            "python-unittest", "selftests/.data/unittests.py:Second.test_skip"
                        )
                        runner_klass = runnable.pick_runner_class()
                Severity: Major
                Found in selftests/unit/nrunner.py and 1 other location - About 1 day to fix
                selftests/unit/nrunner.py on lines 273..290

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def test_success_remove(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: True
                        self.mock_sm.return_value.remove = lambda remove: True
                        runnable = Runnable(
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 54..71
                selftests/unit/runner_package.py on lines 91..108
                selftests/unit/runner_package.py on lines 147..164

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def test_fail_install(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: False
                        self.mock_sm.return_value.install = lambda install: False
                        runnable = Runnable(
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 54..71
                selftests/unit/runner_package.py on lines 110..127
                selftests/unit/runner_package.py on lines 147..164

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def test_success_install(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: False
                        self.mock_sm.return_value.install = lambda install: True
                        runnable = Runnable(
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 91..108
                selftests/unit/runner_package.py on lines 110..127
                selftests/unit/runner_package.py on lines 147..164

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def test_fail_remove(self):
                
                        self.mock_sm.return_value.check_installed = lambda check_installed: True
                        self.mock_sm.return_value.remove = lambda remove: False
                        runnable = Runnable(
                Severity: Major
                Found in selftests/unit/runner_package.py and 3 other locations - About 1 day to fix
                selftests/unit/runner_package.py on lines 54..71
                selftests/unit/runner_package.py on lines 91..108
                selftests/unit/runner_package.py on lines 110..127

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

                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

                    @skipUnlessPathExists("/bin/sh")
                    def test_runner_tap_fail(self):
                        tap_script = """#!/bin/sh
                echo '1..2'
                echo '# Defining an basic test'
                Severity: Major
                Found in selftests/unit/nrunner.py and 4 other locations - About 1 day to fix
                selftests/unit/nrunner.py on lines 384..402
                selftests/unit/nrunner.py on lines 404..422
                selftests/unit/nrunner.py on lines 424..442
                selftests/unit/nrunner.py on lines 444..462

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

                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

                    @skipUnlessPathExists("/bin/sh")
                    def test_runner_tap_skip(self):
                        tap_script = """#!/bin/sh
                echo '1..2'
                echo '# Defining an basic test'
                Severity: Major
                Found in selftests/unit/nrunner.py and 4 other locations - About 1 day to fix
                selftests/unit/nrunner.py on lines 364..382
                selftests/unit/nrunner.py on lines 384..402
                selftests/unit/nrunner.py on lines 424..442
                selftests/unit/nrunner.py on lines 444..462

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

                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

                    @skipUnlessPathExists("/bin/sh")
                    def test_runner_tap_bailout(self):
                        tap_script = """#!/bin/sh
                echo '1..2'
                echo '# Defining an basic test'
                Severity: Major
                Found in selftests/unit/nrunner.py and 4 other locations - About 1 day to fix
                selftests/unit/nrunner.py on lines 364..382
                selftests/unit/nrunner.py on lines 384..402
                selftests/unit/nrunner.py on lines 404..422
                selftests/unit/nrunner.py on lines 444..462

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

                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

                    @skipUnlessPathExists("/bin/sh")
                    def test_runner_tap_error(self):
                        tap_script = """#!/bin/sh
                echo '1..2'
                echo '# Defining an basic test'
                Severity: Major
                Found in selftests/unit/nrunner.py and 4 other locations - About 1 day to fix
                selftests/unit/nrunner.py on lines 364..382
                selftests/unit/nrunner.py on lines 384..402
                selftests/unit/nrunner.py on lines 404..422
                selftests/unit/nrunner.py on lines 424..442

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

                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

                Severity
                Category
                Status
                Source
                Language