avocado-framework/avocado

View on GitHub

Showing 885 of 903 total issues

Function system has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Function run has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function cmd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def cmd(self, command):
              """
              Sends a command and parses all lines until prompt is received
      
              :param command: the GDB command, hopefully in MI language
      Severity: Minor
      Found in avocado/utils/gdb.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 lv_create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def lv_create(
          vg_name, lv_name, lv_size, force_flag=True, pool_name=None, pool_size="1G"
      ):
          """
          Create a (possibly thin) logical volume in a volume group.
      Severity: Minor
      Found in avocado/utils/lv_utils.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_path_status has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_path_status(disk_path):
          """
          Return the status of a path in multipath.
      
          :param disk_path: disk path. Example: sda, sdb.
      Severity: Minor
      Found in avocado/utils/multipath.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 validate_ipv4_netmask_format has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_ipv4_netmask_format(self, netmask):
              """
              This function validates IPv4 Netmask address with following format set.
      
              1. A string in decimal-dot notation,consisting of four decimal integers
      Severity: Minor
      Found in avocado/utils/network/interfaces.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 create_job_logs_dir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_job_logs_dir(base_dir=None, unique_id=None):
          """
          Create a log directory for a job, or a stand alone execution of a test.
      
          :param base_dir: Base log directory, if `None`, use value from configuration.
      Severity: Minor
      Found in avocado/core/data_dir.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 map_method has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def map_method(self, method_name, *args):
              """
              Maps method_name on each extension in case the extension has the attr
      
              :param method_name: Name of the method to be called on each ext
      Severity: Minor
      Found in avocado/core/extension_manager.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 to_str has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_str(self, summary=0, variants=0, **kwargs):  # pylint: disable=W0613
              if not self.variants:
                  return ""
              out = []
              for variant in self.variants:
      Severity: Minor
      Found in avocado/core/varianter.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

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

          def test_is_not_ar(self):
              path = os.path.join(BASEDIR, "selftests", ".data", "hello.rpm")
              self.assertFalse(ar.Ar(path).is_valid())
      Severity: Major
      Found in selftests/unit/utils/ar.py and 1 other location - About 1 hr to fix
      selftests/unit/utils/ar.py on lines 9..11

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

      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_ar(self):
              path = os.path.join(BASEDIR, "selftests", ".data", "hello.deb")
              self.assertTrue(ar.Ar(path).is_valid())
      Severity: Major
      Found in selftests/unit/utils/ar.py and 1 other location - About 1 hr to fix
      selftests/unit/utils/ar.py on lines 13..15

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

      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_fedora_38(self):
              """
              :avocado: dependency={"type": "podman-image", "uri": "registry.fedoraproject.org/fedora:38"}
              """
              self.run_job(
      Severity: Major
      Found in selftests/functional/utils/distro.py and 1 other location - About 1 hr to fix
      selftests/functional/utils/distro.py on lines 46..54

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

      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_rhel_9_1(self):
              """
              :avocado: dependency={"type": "podman-image", "uri": "registry.access.redhat.com/ubi9:9.1"}
              """
              self.run_job(
      Severity: Major
      Found in selftests/functional/utils/distro.py and 1 other location - About 1 hr to fix
      selftests/functional/utils/distro.py on lines 35..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 41.

      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

                  with unittest.mock.patch(
                      "builtins.open", return_value=self._get_data_mock("s390x")
                  ):
                      self.assertEqual(len(cpu.online_list()), 2)
      Severity: Major
      Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
      selftests/unit/utils/cpu.py on lines 29..32
      selftests/unit/utils/cpu.py on lines 33..36
      selftests/unit/utils/cpu.py on lines 37..40
      selftests/unit/utils/cpu.py on lines 43..49

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

      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

                  with unittest.mock.patch(
                      "builtins.open", return_value=self._get_data_mock("s390x_4")
                  ):
                      self.assertEqual(len(cpu.online_list()), 16)
      Severity: Major
      Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
      selftests/unit/utils/cpu.py on lines 25..28
      selftests/unit/utils/cpu.py on lines 29..32
      selftests/unit/utils/cpu.py on lines 33..36
      selftests/unit/utils/cpu.py on lines 43..49

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

      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

                  with unittest.mock.patch(
                      "builtins.open", return_value=self._get_data_mock("s390x_2")
                  ):
                      self.assertEqual(len(cpu.online_list()), 4)
      Severity: Major
      Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
      selftests/unit/utils/cpu.py on lines 25..28
      selftests/unit/utils/cpu.py on lines 33..36
      selftests/unit/utils/cpu.py on lines 37..40
      selftests/unit/utils/cpu.py on lines 43..49

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

      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

                  with unittest.mock.patch(
                      "builtins.open", return_value=self._get_data_mock("s390x_3")
                  ):
                      self.assertEqual(len(cpu.online_list()), 6)
      Severity: Major
      Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
      selftests/unit/utils/cpu.py on lines 25..28
      selftests/unit/utils/cpu.py on lines 29..32
      selftests/unit/utils/cpu.py on lines 37..40
      selftests/unit/utils/cpu.py on lines 43..49

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

      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

              with unittest.mock.patch(
                  "avocado.utils.cpu.platform.machine", return_value="x86_64"
              ):
                  with unittest.mock.patch(
                      "builtins.open", return_value=self._get_data_mock("x86_64")
      Severity: Major
      Found in selftests/unit/utils/cpu.py and 4 other locations - About 1 hr to fix
      selftests/unit/utils/cpu.py on lines 25..28
      selftests/unit/utils/cpu.py on lines 29..32
      selftests/unit/utils/cpu.py on lines 33..36
      selftests/unit/utils/cpu.py on lines 37..40

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

      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_master_connection_no_password(self):
              session = ssh.Session("hostname", user="user")
              master_connection = session._master_connection()
              self.assertIn(" -o 'PasswordAuthentication=no'", master_connection)
      Severity: Major
      Found in selftests/unit/utils/ssh.py and 1 other location - About 1 hr to fix
      selftests/unit/utils/ssh.py on lines 32..35

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

      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_master_connection_no_key(self):
              session = ssh.Session("hostname", user="user")
              master_connection = session._master_connection()
              self.assertIn(" -o 'PubkeyAuthentication=no'", master_connection)
      Severity: Major
      Found in selftests/unit/utils/ssh.py and 1 other location - About 1 hr to fix
      selftests/unit/utils/ssh.py on lines 42..45

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

      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